Looks like reversing the logic works:
clean : TARGCLEAN = 1
ifndef TARGCLEAN
-include $(HDRDEPS)
endif
From: Buonopane, Robert
Sent: Wednesday, May 19, 2010 11:25 AM
To: '[email protected]'
Subject: automatic dependency generation
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) $< >
$...@.$$$$; \
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $...@.$$$$ > $@; \
rm -f $...@.$$$$<mailto:$...@.$$$$>
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
_______________________________________________
Help-make mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-make