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