[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Changing library does *not* always cause executable to be remade wit
Re: Changing library does *not* always cause executable to be remade with "make"!?!?..
Wed, 7 May 2003 13:09:27 +0400
On Wednesday 07 May 2003 10:25, address@hidden 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?!?!?!
I have almost the same tree as yours. My solution is:
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)
$(noinst_LIBRARIES) $(LIBRARIES) $(check_PROGRAMS), \
$($(addsuffix _DEPENDENCIES, $(subst .,_,$(subst
# Rule to make all depended libs
address@hidden(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