[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: defining multiple targets
From: |
Ralf Wildenhues |
Subject: |
Re: defining multiple targets |
Date: |
Wed, 12 Mar 2008 20:27:12 +0100 |
User-agent: |
Mutt/1.5.17+20080114 (2008-01-14) |
Hello Stefan,
* steve_k wrote on Tue, Mar 11, 2008 at 02:20:25PM CET:
> Could somebody of you explain to me how to
> define multiple targets in one configure.ac Makefile.am ? I got it compiling
> everything with SUBDIRS - but now it was requested that i should make the
> testcases ( in tests/Testcase1 tests/TestcaseX ) a separate target.
If you need a recursive target that is not one of the targets known by
automake, you will need to define a recursive rule yourself, sorry.
In this case however, you may want to use the 'check' target, though,
look at the documentation.
> I got so far that i defined :
>
> examples : $(TEST_SUBDIRS)
This just states that the target examples depends on some directories
being present.
> in the hope that this would trigger automake to kickoff the building
> process by using the Makefiles in each of the TestcaseX directories - sadly
> automake does not know to use make recursivly in that case...
Use something like:
recursive-target:
$preorder_commands
for dir in $(SUBDIRS); do \
cd $$dir && $(MAKE) $(AM_MAKEFLAGS) $@ || exit 1; \
done
$postorder_commands
.PHONY: recursive-target
(or the slightly more involved scheme that automake itself uses).
> DISTCLEANDIRS = autom4te.cache doc
Please note that DISTCLEANDIRS has no special meaning to automake.
> DIST_SUBDIRS= src tests/GenEvATestCase1 tests/GenEvATestCase2
> tests/GenEvATestCase3 tests/GenEvATestCase4
Usually there is no need to defined DIST_SUBDIRS yourself (it defaults
to $(SUBDIRS)).
> AM_LDFLAGS = -shared
If you do this, then all outputs get linked as shared objects, which
would be wrong for programs. I suggest putting -shared into per-target
link flags (lib*_LDFLAGS), or, more portably, using libtool.
Hope that helps.
Cheers,
Ralf