help-make
[Top][All Lists]
Advanced

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

Re: Conditionally run "-include" in a rule?


From: Paul D. Smith
Subject: Re: Conditionally run "-include" in a rule?
Date: Sat, 11 Mar 2006 12:13:45 -0500

%% Matt England <address@hidden> writes:

I don't think there's an answer to your original question, but you can
_certainly_ make your tests cleaner than this:

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

NINCLUDE_TARGETS := clean distclean cleanall cleanandfiles cleantmpdfiles \
                    cleanendtgts printvar printvar2 cleanpkg

ifneq (,$(filter $(NINCLUDE_TARGETS),$(MAKECMDGOALS)))
  -include $(ALL_DFILES)
endif

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <address@hidden>          Find some GNU make tips at:
 http://www.gnu.org                      http://make.paulandlesley.org
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist




reply via email to

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