help-make
[Top][All Lists]
Advanced

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

Re: Target specific variables


From: Jens Schweikhardt
Subject: Re: Target specific variables
Date: Thu, 22 Mar 2001 08:39:02 +0100
User-agent: Mutt/1.2.5i

On Wed, Mar 21, 2001 at 04:50:36PM +0000, Paul D. Smith wrote:
# %% Jens Schweikhardt <address@hidden> writes:
# 
#   js> However, I also need to set some more variables, e.g. I'd like to say
# 
#   js>  foo Foo: CFLAGS = -DMUBMLE, LDFLAGS = -DFROB, YFLAGS = bar baz
# 
# Nope.
# 
#   js> For now I simply repeat the targets,
# 
#   js>   foo Foo: CFLAGS = -DMUMBLE
#   js>   foo Foo: LDFLAGS = -DFROB
#   js>   foo Foo: YFLAGS = bar baz
# 
# Yup.
# 
#   js> This does work, but it's somewhat ugly because my list of targets
#   js> (foo Foo) actually consists of up to one hundred separate targets
#   js> and repeating them leads to considerable Makefile bloat... 
# 
# Why not put them in a variable, and use:
# 
#   $(100-targets) : CFLAGS = -DMUMBLE
#     ...

I considered that as well but am not sure if it fits in with my other
requirements. Because my project must avoid recursive make in
subdirectories (you've probably seen
http://www.canb.auug.org.au/~millerp/rmch/recu-make-cons-harm.html) we
use a master Makefile that includes one makefile per subdirectory (about
90) that says how to build dependency (*.d) and object files (*.o). For
each of the up to 100 *.[od] files I need to specify my CFLAGS etc
variables. I probably can get away with $(100-targets_N) and use a
different N in each of the 90 files. This adds a bit more complexity
because I want to autogenerate the makefiles as much as possible, but
the more I think about it, the more I realize it's the only sensible way
to do it lacking feature "foo Foo: CFLAGS = -DMUBMLE, LDFLAGS = -DFROB"

...
# Well, you've obviously hit on the most devastating problem.  The
# right-hand side of a variable assignment has no illegal characters.
# 
# The only possible solution would be (and this does _not_ work now so
# don't even bother trying it) using define, like this:
# 
#   define SET_SOME_VARS
#     CFLAGS = -DMUMBLE
#     LDFLAGS = -DFROB
#     YFLAGS = bar baz
#   enddef
# 
#   foo Foo: $(SET_SOME_VARS)
# 
# Since define preserves newline characters this could possibly be made to
# work.  It would be very difficult, though; the code is not structured in
# a way to make this easy at all.
# 
# Read: don't expect it any time soon :).

I won't. Doing "very difficult" feature additions is out of the question.
I have a hard time even fixing minor bugs in BSD make :-)

Regards,

        Jens
-- 
Jens Schweikhardt  http://www.schweikhardt.net/
SIGSIG -- signature too long (core dumped)



reply via email to

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