[Top][All Lists]

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

Re: One command updates many targets

From: Paul D. Smith
Subject: Re: One command updates many targets
Date: Mon, 31 Mar 2003 21:45:45 -0500

%% Bill Moseley <address@hidden> writes:

  bm> The problem I'm having is getting make to only run the program *once*.

  bm> I tried some rules like this:

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

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

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

  bm> API.html: $(top_srcdir)/perl/
  bm>         $(MAKE) html

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

You need a stamp file: a single file that represents the last time the
build was performed.  Just write it like this:

 all: .html-stamp

 .html-stamp: $(version_file) $(pod_dir)/CHANGES.pod \
                 $(pod_dir)/INSTALL.pod $(top_srcdir)/perl/
         cd $(srcdir)/../doc && bin/build
         @touch .html-stamp

No need for an extra level of make recursion.

 Paul D. Smith <address@hidden>          Find some GNU make tips at:            
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist

reply via email to

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