automake
[Top][All Lists]
Advanced

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

dynamically define variables?


From: Daniel Neuberger
Subject: dynamically define variables?
Date: Mon, 01 Oct 2012 16:05:20 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120713 Thunderbird/14.0

All,

I'm afraid that what I want to do might be impossible, but I'm hoping you all can help me think of a way. What I have is something like:

----------------Makefile.am----------------
# specific to this Makefile.am
bin_PROGRAMS = foo bar

foo_SOURCES = foo.cpp
bar_SOURCES = bar.cpp

# I'd get rid of having to define empty versions of these
foo_CPPFLAGS =
bar_CPPFLAGS =

# things that should be done globally
foo_SOURCES += global.cpp
foo_CPPFLAGS += -DEXECUTABLE_NAME=foo

bar_SOURCES += global.cpp
bar_CPPFLAGS += -DEXECUTABLE_NAME=bar
----------------Makefile.am----------------

What I want is to replace the global section at the end with an include .am file that iteratively adds global.cpp to the SOURCES list and the define to the flags for each program in the Makefile.am.

Put another way, I have a bunch of programs. There's one source file that I need to compile and link to each program using a different flag based on the program name.

Also note that the global section above currently requires that the variables being appended to already exist. I'd like to find a way around that too.

Any ideas?

Thanks.

- Daniel




reply via email to

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