As written in the GNU make manual: "VPATH: Search Path for All Prerequisites". VPATH is used by make for some purposes.
The "-I" flag has nothing to do with make. make passes the whole "gcc -I include" to the shell and does not know anything about it. Hence, -I and VPATH do not duplicate each other. -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of MD.Mahbubur Rahman Sent: Wednesday, September 28, 2011 10:04 PM To: [email protected] Subject: Usage: CPPFLAGS vs VPATH Dear all, I have found below code in a make file that uses CPPFLAGS and VPATH AS FOLLOWS: VPATH = src include CPPFLAGS = -I include count_words: count_words.o counter.o lexer.o -lfl gcc $^ -o $@ count_words.o: count_words.c counter.h gcc $(CPPFLAGS) -c $< -o $@ counter.o: counter.c counter.h lexer.h gcc $(CPPFLAGS) -c $< -o $@ lexer.o: lexer.c lexer.h gcc $(CPPFLAGS) -c $< -o $@ lexer.c: lexer.l flex -t $< > $@ My question is , if I use VPATH to tell MAKE to find the required files from the paths mentioned in VPATH, than why should I need to use gcc $(CPPFLAGS) <--- This kind of things? What is the mystery?? -- View this message in context: http://old.nabble.com/Usage%3A-CPPFLAGS-vs-VPATH-tp32550826p32550826.html Sent from the Gnu - Make - Help mailing list archive at Nabble.com. _______________________________________________ Help-make mailing list [email protected] https://lists.gnu.org/mailman/listinfo/help-make _______________________________________________ Help-make mailing list [email protected] https://lists.gnu.org/mailman/listinfo/help-make
