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