bug-automake
[Top][All Lists]
Advanced

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

Re: how to create dependencies for conditional sources


From: Ralf Wildenhues
Subject: Re: how to create dependencies for conditional sources
Date: Sun, 1 Jul 2007 12:19:25 +0200
User-agent: Mutt/1.5.13 (2006-08-11)

Hello Roumen,

* Roumen Petrov wrote on Thu, Jun 28, 2007 at 10:26:31PM CEST:
> Please find attached test case "bootstrap.sh".
> 
> How to write Makefile.am so that created makefiles to contain 
> dependencies for conditional sources ?

For example, you coud use this Makefile.am instead:

--- snip ---
noinst_PROGRAMS = target
target_SOURCES = main.c

if WITH_CASE1
target_SOURCES += case1.c
endif

if WITH_CASE2
target_SOURCES += case2.c
endif
--- snip ---

With the above, there is no need to set target_LDADD or
target_DEPENDENCIES.

Does that work for you?  If no, there is also the possibility to do
something like this:

--- snip ---
if WITH_CASE1
DEPS1=case1.lo
else
DEPS1=
endif

if WITH_CASE2
DEPS2=
else
DEPS2=case2.lo
endif

noinst_PROGRAMS=target

target_SOURCES = main.c
EXTRA_target_SOURCES = case1.c case2.c
target_LDADD= $(DEPS1) $(DEPS2)
--- snip ---

But you would still not need to set target_DEPENDENCIES: automake is
smart enough to figure it out itself.

Cheers,
Ralf




reply via email to

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