> > Ok, fair enough. But what's the easiest way to create a new > recursive > > target such as checkprogs? Hopefully there's a more or less > automatic > > way using automake. > > No, it's not, which is a real bummer. Best you can do is somehow copy > the $(RECURSIVE_TARGETS) rule as a fragment file and include that in > the > other Makefile.am files. > > I'd like to improve this situation at some point. > > Cheers, > Ralf
Good advice, Ralf. I've done just that. Now I have the freedom to add any recursive targets I need. I used find with sed to insert into the top of all of my Makefile.am files: find -name 'Makefile.am' -exec sed -i '1i\include $(top_srcdir)/config/ga_recur.mk\n' {} \; All I need to do is add a few lines to my ga_recur.mk to add additional recursive targets, if I ever need them. I could probably have removed the -am target stuff, right? Oh, well. There were only a handful of Makefile.am files which had a check_PROGRAMS target, so in those files I've added: TESTS = $(check_PROGRAMS) checkprogs: $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) The contents of ga_recur.mk are: # COPIED FROM MAKEFILE GENERATED BY AUTOMAKE 1.11.1 # # Modified to use our own recursive targets. # # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. # To change the values of `make' variables: instead of editing Makefiles, # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(GA_RECURSIVE_TARGETS): @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" # END COPY GA_RECURSIVE_TARGETS = checkprogs-recursive checkprogs: checkprogs-recursive checkprogs-am: