Makefile tips
Makefile tips
I am using makefiles heavily in last year and I am still feeling like a completely newbie.
I hope that putting my knowledge together will improve my feeling.
- To find out dependencies from C/C++ files use makedepend utility. Be careful it modifies Makefile and Makefile.bat
- More variables at cprogramming.com. Samples I use.
$< #stands for first dependency
$@ # stands for target
$^ # stands for all dependencies
$? # stands for dependencies newer than target
#example
p1 : MovieList.o Movie.o NameList.o Name.o Iterator.o
g++ -Wall MoveList.o Movie.o NameList.o Name.o Iterator.o -o p1
p1_ekvivalent : MovieList.o Movie.o NameList.o Name.o Iterator.o
g++ -Wall $^; -o $@