help-make
[Top][All Lists]
Advanced

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

Question Regarding Emile van Bergen's Non-Recursive Make


From: Davidson, Josh
Subject: Question Regarding Emile van Bergen's Non-Recursive Make
Date: Sun, 30 Nov 2008 14:11:21 -0700

I have a question regarding the following article:  http://www.xs4all.nl/~evbergen/nonrecursive-make.html

 

The author sets of a compiler invocation as follows:

COMP            = $(CC) $(CF_ALL) $(CF_TGT) -o $@ -c $<

 

The CF_TGT variable holds the target specific compiler flags that can be set in each subdirectory’s makefile.

 

And an implicit rule:

 

%.o:           %.c
               $(COMP)

 

 

For each of his subdirectory makefiles, he has a group of object file targets called OBJS_$(d) that are ultimately compiled using the implicit rule above ($(d) is the subdirectory for that makefile).  The way he enables custom compilation flags for his object targets is by adding a prerequisite as follows:

 

$(OBJS_$(d)):  CF_TGT := -I$(d)

 

 

Is there a potential race condition with this approach if –j is used?  It seems to me that CF_TGT could be overridden by another $(OBJS_$(d)) in a different subdirectory.  If there isn’t a race condition, is GNU make creating a target specific copy of CF_TGT or somehow locking it until the target has finished updating?

 

Thanks,

Josh


reply via email to

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