automake
[Top][All Lists]
Advanced

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

Re: make depend problem with hello_SOURCES = ${SRCDIR}/hello.c


From: Ralf Wildenhues
Subject: Re: make depend problem with hello_SOURCES = ${SRCDIR}/hello.c
Date: Tue, 13 Sep 2005 11:41:47 +0200
User-agent: Mutt/1.4.1i

Hi Harald,

* Harald Dunkel wrote on Tue, Sep 13, 2005 at 08:24:14AM CEST:
>
> I have some common source files that I have to compile and link
> several times in different contexts. Actually the Makefile.am
> files look more like this:
> 
>       hello_SOURCES = \
>               $(INTERFACE_DIR)/common_interface.c \
>               $(INTERFACE_DIR)/common_interface.h \
>               localfile1.c \
>               localfile2.c \
>               :
>       hello_CPPFLAGS = -D$(INTERFACE_FLAG) -I$(INTERFACE_DIR)
>       hello_CCFLAGS = -some -flags
> 
> There are several Makefile.am files of this kind (>50).

How about using either
- a convenience archive, or
- one single large Makefile.am with subdir-objects
  (see "info Automake Alternative")

to solve this problem cleanly?  Alternatively, you can cludge

linked_sources = common_interface.c more.c even-more.c
BUILT_SOURCES = $(linked_sources)
$(linked_sources):
        list='$(linked_sources)'; for file in $$list; do \
          rm -f $$file; $(LN_S) '$(INTERFACE_DIR)'/"$$file" "$$file"; \
        done

(this is still wrong w.r.t. the actual dependencies between the
originals and the copies; how to do multiple targets better is explained
in "info Automake 'Multiple Outputs'").

Cheers,
Ralf




reply via email to

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