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?

OMake build tools (it development stop now) work in that manner:

  http://omake.metaprl.org/index.html

For GNU Make there 2 possibility:

 1) You change variable assignment in original or included Makefiles.
Add such dependence:

%.c: $(MAKEFILE_LIST)
...

  2) You change variable by 'make' invoking or by changing env var.
For this case I 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)

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

_______________________________________________
Help-make mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-make

Reply via email to