help-make
[Top][All Lists]
Advanced

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

Re: Setting target execution order


From: Matt Perry
Subject: Re: Setting target execution order
Date: Mon, 24 Nov 2003 13:36:34 -0800 (PST)

On Mon, 24 Nov 2003, Noel Yap wrote:

> The usual way to do what you want /is/ to make all a prereq of gzip.  I
> don't understand your reasoning as to why this wouldn't work.  Can you
> elaborate with an example?

Sure.  I've attached a stripped down version of my makefile to the end of 
this message.  Notice that I get different output depending on whether I 
use targets of basic, standard, or emacs.  If gzip is specified as a 
target on the command line, I want it to execute last no matter what other 
targets have been specifed, if any.  But gzip should be optional.

 - .\\


archive  = config-$(shell date +%Y%m%d).tar
emacsarc = emacs-$(archive)

basic    = .bash_logout .bash_profile .bashrc .exrc .vimrc
standard = .cvsrc .mailcap .screenrc .slrnrc .wgetrc .ytalkrc
emacs    = .emacs elisp

.NOTPARALLEL:
.PHONY: dummy clean
dummy:
        @echo "Usage: make <target>"

basic:
        tar -rf $(archive) $(basic)

standard: basic emacs
        tar -rf $(archive) $(standard)
        tar -Af $(archive) $(emacsarc)
        rm -f $(emacsarc)

emacs:
        tar -rf $(emacsarc) $(emacs)

gzip:
        for file in $(archive) $(emacsarc) ; do \
          if [ -f $$file ]; then \
            gzip $$file ; \
          fi ; \
        done

clean:
        $(RM) $(archive) $(emacsarc)





reply via email to

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