Subdirectories And Extra Files

In a project organised with mostly administrative files in the top-level directory and source, documentation, graphics, etc files one level down in subdirectories, the top-level Makefile.am will often look like:

SUBDIRS = libsmil dtd po

EXTRA_DIST =                    \
        libsmil.spec.in \
        libsmil.spec            \
        intltool-extract.in     \
        intltool-merge.in       \
        intltool-update.in

snap:
   cp libsmil.spec libsmil.spec.orig; \
   sed -e "s/\(^Version: \)\(.*\)/\1\2.`date +'%Y%m%d'`.snap/" libsmil.spec \
     > libsmil.spec.tmp; \
   mv libsmil.spec.tmp libsmil.spec; \
   $(MAKE) dist distdir=$(PACKAGE)-$(VERSION).`date +"%Y%m%d"`.snap; \
   mv libsmil.spec.orig libsmil.spec

Note that the top-level subdirectory is not listed in SUBDIRS, so it is built last. To force the top-level directory to be built at a specific time, just put . into the SUBDIRS list somewhere.