help-make
[Top][All Lists]
Advanced

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

Conditionally run "-include" in a rule?


From: Matt England
Subject: Conditionally run "-include" in a rule?
Date: Fri, 10 Mar 2006 07:47:06 -0600

Summary:

How can one conditionally run "-include" in a rule?

My apologies if this is a faq.


Details:

My problem is twofold:

1)

I don't know of a way to "-include" other makefiles (as per <http://www.gnu.org/software/make/manual/html_chapter/make_4.html#SEC51>) on a per-application-rule basis; I simply have to include ALL my .d files (that map to a one-to-one basis with my .cpp files) for EVERY application build, and undesirable situation (although the user can play a little trickery on the cmdline to take out the other applications from the app list with variable assignments, but this too is undesirable).

If I could somehow *conditionally* call "-include" in a rule then I think I could solve this problem.

Does make-3.80 provide a means to do this?

2)

The other problem: I have to do all sorts of extra stuff to not always call the "-include" statement for targets for which "-include does not apply as per the excerpt below. This is fairly annoying. It seems that conditional "-include" support can solve this problem as well.


MAKE_DFILES := 1
ifeq ($(MAKECMDGOALS),clean)
MAKE_DFILES := 0
endif
ifeq ($(MAKECMDGOALS),distclean)
MAKE_DFILES := 0
endif
ifeq ($(MAKECMDGOALS),cleanall)
MAKE_DFILES := 0
endif
ifeq ($(MAKECMDGOALS),cleandfiles)
MAKE_DFILES := 0
endif
ifeq ($(MAKECMDGOALS),cleantmpdfiles)
MAKE_DFILES := 0
endif
ifeq ($(MAKECMDGOALS),cleanendtgts)
MAKE_DFILES := 0
endif
ifeq ($(MAKECMDGOALS),printvar)
MAKE_DFILES := 0
endif
ifeq ($(MAKECMDGOALS),printvar2)
MAKE_DFILES := 0
endif
ifeq ($(MAKECMDGOALS),cleanpkg)
MAKE_DFILES := 0
endif
ifeq ($(MAKE_DFILES),1)
-include $(ALL_DFILES)
endif


-Matt





reply via email to

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