|
From: | Buonopane, Robert |
Subject: | FW: automatic dependency generation |
Date: | Wed, 19 May 2010 12:26:14 -0600 |
Paul: I found your article: http://make.paulandlesley.org/autodep.html Take care Bob From: Buonopane, Robert Looks like reversing the logic
works: clean : TARGCLEAN = 1 ifndef TARGCLEAN -include
$(HDRDEPS) endif From: Buonopane, Robert Hi Paul: How’s it going? Question: (gmake 3.80) I am using : HDRDEPS = $(addprefix
$(OUTPUTDIR)/,$(SRCS:.c=.d)) CLEANTARGETS = $(LNDEPS)
$(LNTARGET) $(HDRDEPS) I only want to run the include directive if the goal is
‘all’ so I do this. Is there a better way? all : TARGALL = 1 ifdef TARGALL -include
$(HDRDEPS) endif Here’s the rule: $(OUTPUTDIR)/%.d: %.c
@set -e; if [ -d $(OUTPUTDIR) ]; then rm -f $@; \
else $(MKDIR) $(MKDIRFLAGS) $(OUTPUTDIR); fi; \
$(CPREPROC) -MM $(CPPFLAGS) $(ALLDEFS) $(ENDIAN) $(ALLINCS) $< > address@hidden;
\
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < address@hidden > $@; \
rm -f address@hidden The problem is that the .d files
are removed when the include directive is in that ifdef – I assume
because TARGALL is a target specific var. I don’t want the files
removed. Is there a better way to get the
‘include directive’ to only run if the goal is ‘all’? Thanks Bob |
[Prev in Thread] | Current Thread | [Next in Thread] |