Tuesday, May 19, 2009

Understanding make

If you are compiling code in unix based operating system, then you cannot escape the omnipresent Makefile. Well, writing a Makefile requires some knowledge of the basics. Here are some tips to get by.

> make -p
Displays all the macros available in make.

One particular macro that floats around a lot is the @ macro. This is a macro that make defines for each dependency line. In a code such as:

prog : file1.o
${CXX} -o $@ file1.o

"$@" interprets as "prog"

No comments:

Post a Comment