help-make
[Top][All Lists]
Advanced

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

Re: rebuild when flags change


From: Oleksandr Gavenko
Subject: Re: rebuild when flags change
Date: Wed, 15 Sep 2010 13:52:00 +0300
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.9) Gecko/20100825 Thunderbird/3.1.3

On 15.09.2010 6:44, Lynn Lin wrote:
Hi all,
       Our build command
       $(QUIET_CPP)$(CPP) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c $<

       when CPPFLAGS change,how can we enable make rebuild?

I personally use such trick:

# Makefile itself.
MK_FILE := $(firstword $(MAKEFILE_LIST))
# Storage for CLI options.
MK_CLI_FILE := $(MK_FILE).cli

-include $(MK_CLI_FILE)
$(shell mkdir -p $(dir $(MK_CLI_FILE)); printf "DEBUG_OLD=$(DEBUG)\nOPT_LEVEL_OLD=$(OPT_LEVEL)\n" >$(MK_CLI_FILE))
ifneq '$(DEBUG_OLD)' '$(DEBUG)'
  $(shell touch $(MK_FILE))
endif
ifneq '$(OPT_LEVEL_OLD)' '$(OPT_LEVEL)'
  $(shell touch $(MK_FILE))
endif

and adds a lot of:

%.c: $(MK_FILE)
%.cxx: $(MK_FILE)
%.sh: $(MK_FILE)
...

--
С уважением, Александр Гавенко.



reply via email to

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