make 암시적 룰
타겟을 만들지 않아도 컴파일 되는 이유... 라고 해야하나?
*.c는 $(CC)를
*.cc나 *.C는 $(CXX)를 이용해서 컴파일 하는데
$(CPPFLAGS) 와 $(CFLAGS)를 인자로 받으니..
여기에 헤더와 링커 경로를 넣어주면 자동으로 알아서 작동하는 마법!
Compiling C programs n.o is made automatically from n.c with a recipe of the form ‘$(CC) $(CPPFLAGS) $(CFLAGS) -c’. Compiling C++ programs n.o is made automatically from n.cc, n.cpp, or n.C with a recipe of the form ‘$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c’. We encourage you to use the suffix ‘.cc’ for C++ source files instead of ‘.C’. [링크 : http://www.gnu.org/software/make/manual/make.html#Catalogue-of-Rules] |
[링크 : http://korea.gnu.org/manual/4check/make-3.77/ko/make_10.html#SEC91]
패턴 규칙 예제(Pattern Rule Examples) 다음은 make에 의해서 실제로 미리 정의된 패턴 규칙들의 몇가지 예제들이다. 먼저 `.c' 파일들을 `.o' 로 컴파일하는 규칙은: %.o : %.c $(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@ [링크 : http://korea.gnu.org/manual/4check/make-3.77/ko/make_10.html#SEC96] |