automake
[Top][All Lists]
Advanced

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

Re: How to setup an example programs subdirectory?


From: Stepan Kasal
Subject: Re: How to setup an example programs subdirectory?
Date: Tue, 11 Jan 2005 12:16:17 +0100
User-agent: Mutt/1.4.1i

Hi,

On Sun, Jan 02, 2005 at 01:08:22PM -0500, Simon Perreault wrote:
> SUBDIRS = ...
> DIST_SUBDIRS = $(SUBDIRS) examples
> 
> .PHONY: examples clean-examples
> 
> examples: all
>     ( cd $(top_builddir)/examples && $(MAKE) $(MFLAGS) )
> 
> clean-examples:
>     ( cd $(top_builddir)/examples && $(MAKE) $(MFLAGS) clean )
> 
> clean-local: clean-examples

your example wouldn't remove examples/Makefile.in on ``make distclean''.
(You can fix this similarily as you fix the clean-local target.)

You omit the subdir from SUBDIRS, and add rule for clean.
Another approach would be to put the subdir into SUBDIRS, but prevent
the target `all' from making the programs there:
========================================================================
SUBDIRS = ... examples

.PHONY: examples

examples: all
        cd $(top_builddir)/examples && $(MAKE) $(AM_MAKEFLAGS) examples
========================================================================

The examples/Makefile.am could contain this:
========================================================================
EXTRA_PROGRAMS = one two

.PHONY: examples

examples: $(EXTRA_PROGRAMS)
========================================================================

With this approach ``cd examples; make'' does _not_ build the examples,
which might be counterintuitive.

HTH,
        Stepan Kasal




reply via email to

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