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
Help-make@gnu.org
http://lists.gnu.org/mailman/listinfo/help-make

Reply via email to