brilliant... BRILLIANT! On 8/25/05, Allan Clark <allanc@xxxxxxxxxxxxxxxxxx> wrote: > >I have a project with source files in multiple subdirectories: src, > >tests, cfg. Doxygen will generate code documentation based on special > >hints in the comments of the code files themselves (like javadoc, if > >you're familiar with that mechanism). > > > >I could just blindly have Doxygen run each time I run "make [<something>]": > >all-local:: doxygen/html/index.html > > > >But it would be nice if it only ran as required, in other words, only > >when one of the project's sources is modified. Previously I had all > >the sources in one directory (src) so this was easy: > >doxygen/html/index.html: $(SOURCES) > > $(DOXYGEN) Doxyfile > > > >But if the sources are spread throughout the project is there any way > >at any one location to dynamically know all the sources? > >doxygen/html/index.html: $(SUBDIRS)/$(SOURCES) > > $(DOXYGEN) Doxyfile > > > The recursive behavior of automake makes this difficult. What you can > do it alter Automake to provide in every Makefile (might be non-trivial): > > .doxygen: $(SOURCES) > touch $@ > > ... then, at top-level, you could enumerate your subdirs: > > doxygen: src/.doxygen doc/.doxygen > doxygen ... > > ... with gnu-make, if you wanted to make the list of Doxygen dependents > automatic, you could: > > doxygen: $(addsuffix /.doxygen,$(DIST_SUBDIRS)) > doxygen ... > > > Alternatively, you could cause a filelist to be created from a > dependency on the Makefiles -- $(addsuffix /Makefile.am,$(DIST_SUBDIRS)) > -- or even generate a file to be included in the top-level Makefile. .. > or just wimp out and: > > doxygen: $(addsuffix /*.c,$(DIST_SUBDIRS)) $(addsuffix /*.h,$(DIST_SUBDIRS)) > doxygen ... > > > Lemme know if it works... It's so great to learn new things! I had never encountered those make functions before (i.e. addsuffix). I ended up doing a bit of a combination of things. As much as I liked the wimp-out approach it won't work for me because there doesn't exist in all $(DIST_SUBDIRS) files with both *.h and *.c suffixes (e.g. cfg, doc), and I certainly wasn't going to pollute those directories with dummy files just to make this work! So in each of my $(DIST_SUBDIRS) I ended up doing the: .doxygen: $(SOURCES) touch $@ which ensures that all the existing sources are monitored and then in the top-level I did a part-wimp-out: doxygen/html/index.html: $(addsuffix /.doxygen,$(DIST_SUBDIRS)) $(DOXYGEN) ... I like this solution because it still remains rather flexible, I don't have to hard-code the subdirectory names to monitor. If I added a new $(DIST_SUBDIR) then I wouldn't have to modify this Makefile.am. The only squeaker (which I'm perfectly happy with) was in the cfg directory (which is actually a AC_CONFIG_AUX_DIR(cfg) directory) where I had to get a bit creative be able to include config.h in this checking algorithm: SOURCES = config.h To get all this to work all Makefile.am's had to include ".doxygen" in their "all-local" declarations. For example cfg/Makefile.am looks like: SUBDIRS = SOURCES = config.h all-local:: .doxygen .doxygen: $(SOURCES) touch $@ Thanks again, great solution! _______________________________________________ Autoconf mailing list Autoconf@xxxxxxx http://lists.gnu.org/mailman/listinfo/autoconf