[완료]Makefile 작성법 질문드립니다.

poplinux의 이미지

다음과 같은 세개의 소스가 있습니다.

example1.c example2.c example3.c

이 파일들을 각각 컴파일해서 결과를 얻고 싶습니다.

지금까지는 다음과 같이 Makefile 을 작성해서 사용했습니다.

#!/bin/sh
 
OBJS = example1 example2 example3
 
default: $(OBJS)
 
example1: example1.c
     gcc -g -o example1 example1.c
 
 
example2: example2.c
     gcc -g -o example2 example2.c
 
example3: example3.c
     gcc -g -o example3 example3.c
 
clean: 
    rm $(OBJS

위와 같은 코드를 간략하게 하려면 어떻게 해야 할까요?

singlet의 이미지

http://kldp.org/KoreanDoc/html/GNU-Make/GNU-Make-2.html 정도 내용까지 이용하고 계신 것 같으니, 그 다음 페이지 http://kldp.org/KoreanDoc/html/GNU-Make/GNU-Make-3.html 부터 읽어보시면 될 것 같습니다.
(추가) 해당 링크는 왼쪽의 검색창에서 Makefile 이라고 넣거나 구글님께 "Makefile site:kldp.org" 라고 문의드리면 첫번째로 뜨는 강좌 중 일부입니다. 가급적이면 검색을 우선 부탁드립니다.

poplinux의 이미지

감사합니다.

========================
조직 : E.L.D(Embedded Linux Developer/Designer)
블로그 : poplinux@tistory.com
카페 : cafe.naver.com/poplinux

임베디드 리눅스 관련 프리렌서 지향