help-make
[Top][All Lists]
Advanced

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

One command updates many targets


From: Bill Moseley
Subject: One command updates many targets
Date: Sun, 30 Mar 2003 08:37:02 -0800 (PST)

I have a program that generates HTML documentation.  The program itself
knows how to build HTML files that are out of data or missing.  The
program does not build single files, but it knows how to create an entire
directory of HTML files from a list of source files.

What I'd like to do in a Makefile (actually Makefile.am) is write rules
that check for missing or out of date files and run the program, but only
run the program one time (because it will update all files as needed).

The problem I'm having is getting make to only run the program *once*.
All that needs to happen is for make to determine that one one of many
targets are out of data or missing and run the program, which will rebuild
everything.

I tried some rules like this:

# the "build" program uses the version info from the configure script

$(version_file): $(top_srcdir)/configure
        rm -f $(version_file)
        echo 'package SWISHE::Doc;$$VERSION=q[$(VERSION)];1' > $(version_file)

html: $(version_file)
        cd $(srcdir)/../doc && bin/build

CHANGES.html: $(pod_dir)/CHANGES.pod
        $(MAKE) html

INSTALL.html: $(pod_dir)/INSTALL.pod
        $(MAKE) html

API.html: $(top_srcdir)/perl/API.pm
        $(MAKE) html

As you can see, CHANGES.html and INSTALL.html depend on *.pod files.
API.html, on the other hand, depend on a Perl module (the build program
extracts out the docs from the module).

The "build" program creates an index.html (and index_long.html) table of
contents for all the docs.  So if either of those are missing I need to
run the "build" program, too.  There's also a bunch of image files that
are just copied by "build" to the destination HTML directory when it is
run.

The above does not work, of course, because "make html" gets run over and
over for each target, instead of just once.   

Thanks,



-- 
Bill Moseley address@hidden





reply via email to

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