This is the mail archive of the automake@gnu.org mailing list for the automake project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Changing library does *not* always cause executable to beremade with "make"!?!?..


On Wednesday 07 May 2003 10:25, cs@gnumatica.com wrote:
> I have a complex tree of source code.
>
> Some directories have Makefile.am's that create noinst libraries.
>
> All the noinst libraries are used to build a single executable.
>
> If noinst library is changed... this does *not* always cause
>
> executable to be rebuilt!?!?!
>
> How fix???
>
> Executable is only rebuilt if one of name_SOURCES files is changed.
>
> This is a problem because modifying something in the
>
> name_LDADD list does NOT cause executable to be remade?!?!?!
>
> Chris

I have almost the same tree as yours. My solution is:

Ex:

bin_PROGRAMS = name
name_SOURCES = ...
name_DEPENDENCIES = $(top_builddir)/path/libnoinst.a ...
name_LDADD = $(name_DEPENDENCIES)

The main trick is to explain to make how to rebuild noinst library in other 
than current directory.To do this I use the following in my 
admin/Makefile.deps (which is included in _EVERY_ Makefile.am's):

#
# Get all depended targets for all 'main' targets as space separated list
#
AM_DEPTGTS := $(sort $(foreach t, \
                $(bin_PROGRAMS) $(pkgbin_PROGRAMS) $(lib_LTLIBRARIES) 
$(pkglib_LTLIBRARIES) \
                $(noinst_LIBRARIES) $(LIBRARIES) $(check_PROGRAMS), \
                $($(addsuffix _DEPENDENCIES, $(subst .,_,$(subst 
-,_,$(t)))))))


#
# Rule to make all depended libs
#
$(AM_DEPTGTS):
        +@$(MKMSG) "Make depended target \`$(@)'"; \
        $(MAKE) $(AM_MAKEFLAGS) -C $(@D) $(DEPDIR)/includes && \
        $(MAKE) $(AM_MAKEFLAGS) -C $(@D) $(@F) || exit 1

... so make will know how to build $(top_builddir)/path/libnoinst.a (and other 
depended libs)

good luck




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]