help-make
[Top][All Lists]
Advanced

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

Re: one more thought about a non-recursive make structure


From: Noel Yap
Subject: Re: one more thought about a non-recursive make structure
Date: Tue, 18 Jan 2005 06:55:30 -0500
User-agent: Mozilla Thunderbird 0.5 (Windows/20040212)

IMHO, one should use target-specific variables for what you want to do. Yes, this would require modifying the makefile, but this is the only way you can be sure the build is reproducible (eg by checking in the changes into source control). OTOH, if all you need is a temporary thing (eg turning on debug for only one file), what you say below is fine.

IME, a good solution would be to have a GNUlocal.mk file that contains 
temporary stuff and is -include'd into the framework.  One could then do 
something like:

# GNUlocal.mk
foo.o: CFLAGS += -g

HTH,
Noel

Robert P. J. Day wrote:
  (since i'm on the road shortly, i figured i might as well push my
luck and ask for feedback on one more idea i had to support a really
customizable non-recursive make structure.  and if you just happen to
have done something like this in the past, hey, i'd definitely like to
hear from you.  i can't imagine this idea hasn't been re-invented
about a bazillion times in the past already.)

  recap:  sizable, multi-level, build structure, which consists of
several components at various levels; components which can be given
names like "foo", "bar" and so on.

  now, strictly from the top level Makefile, i want to be able to
tweak any aspect of the build, including things like preprocessor,
compile and link flags without messing with editing makefiles.  it
occurs to me that i can do something like this.

  say i want to support the standard make variables like CPPFLAGS,
CFLAGS, LDFLAGS, LDLIBS and so on.  and, for the next build, i want to
tweak the CFLAGS value for a single component, say "foo", but for
absolutely no other component.

  it seems that i can define a number of variables (and support them
with some fairly straightforward macros) like:

  export foo_CFLAGS=
  export foo_CFLAGS_APPEND=
  export foo_CFLAGS_PREPEND=

what those variables represent should be obvious -- when the makefile
for the "foo" component is invoked, it checks for any variables with
the prefix "foo" and processes them accordingly.  and it seems like it
would be easy to whip up a few macros to do the string processing.

  thoughts?  is this really as simple as it looks?  or is there
something i'm missing that makes this a bad idea?  thanks.

rday


_______________________________________________
Help-make mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/help-make




reply via email to

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