%% Chris Jaeger <[EMAIL PROTECTED]> writes:
cj> I'm working on a build-environment where we want to have our own
cj> header files included rather than the system includes. However,
cj> the number of places where our header files can be found is large,
cj> and makes for a rather messy command line. You can hide this
cj> information using gcc's C_INCLUDE_PATH. However, I would like the
cj> ability to have a debug mode where the -I directives are made part
cj> of CPPFLAGS instead. Here is essentially what I am looking for:
cj> ifndef SHOW_INCLUDES
cj> add_include_paths = C_INCLUDE_PATH += :$(subst $(space),:,$(1))
cj> else
cj> add_include_paths = CPPFLAGS += $(addprefix -I,$(1))
cj> endif
cj> %.c: $(call add_include_paths,../includes)
cj> Unfortunately, the code in read_makefile() requires
cj> that target-specific variable assignments be visible before
cj> any expansion of the dependency list is done. Is the above
cj> something that could fit into make's parsing philosophy?
It would be difficult given the current parser. There is work going on
in the parser; maybe in the future this would be possible. There are a
lot of things to consider, though: changing the way make decides what to
expand, etc. can't ever be done lightly.
Why don't you just do this:
ifndef SHOW_INCLUDES
%.c: C_INCLUDE_PATH += :$(subst $(space),:,../includes)
else
%.c: CPPFLAGS += $(addprefix -I,../includes)
endif
--
-------------------------------------------------------------------------------
Paul D. Smith <[EMAIL PROTECTED]> Find some GNU make tips at:
http://www.gnu.org http://www.paulandlesley.org/gmake/
"Please remain calm...I may be mad, but I am a professional." --Mad Scientist