help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Usage: CPPFLAGS vs VPATH


From: Mark Galeck (CW)
Subject: RE: Usage: CPPFLAGS vs VPATH
Date: Wed, 28 Sep 2011 22:10:11 -0700

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: address@hidden [mailto:address@hidden On Behalf Of MD.Mahbubur Rahman
Sent: Wednesday, September 28, 2011 10:04 PM
To: address@hidden
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
address@hidden
https://lists.gnu.org/mailman/listinfo/help-make



reply via email to

[Prev in Thread] Current Thread [Next in Thread]