Variables in GNU make

Neil Watson tlug-neil-8agRmHhQ+n2CxnSzwYWP7Q at public.gmane.org
Fri Dec 15 19:02:50 UTC 2006


Hello,

I'm delving into GNU make for the first time.  My goal is to build a
revision labeled tar file from a working copy of source code.  Here is
what I have started:

# makefile

# This file will build a boot strap client. 

SHELL=/bin/sh

# Vpath works like PATH.  The inputs directory will be searched for any
# .conf
# files that are referenced.
vpath %.conf inputs
vpath %.sv init.d

PUBLICKEY=tor-heisenberg.pub

.PHONY: help
help:
        make --print-data-base --question | \
        awk '/^[^.%][-A-Za-z0-9]*:/ \
        { print substr($$1, 1, length($$1)-1) }' | \
        sort

# Make client tarball to be copied to client.
.PHONY: client
client: cfengine-bs.tgz

# Tarball file that will be copied to the client.
cfengine-bs.tgz: makefile cfagent cfkey cfexecd update.conf ${PUBLCKEY} cfexecd.sv
        tar -cvzpf cfengine-bs.tgz $^

# server public key
${PUBLICKEY}:
    cp /var/cfengine/ppkeys/${PUBLICKEY} ${PUBLICKEY}


This current version works.  I'd like the tar file name (from 'make client') to
include the revision number.  I can get it like this:
        REV=`svn info|awk '/^Revision.*/ { print $2 }'`

How can ensure that the dependancy in 'client: cfengine-bs.tgz' changes with
the revision (cfengine-bs-22.tgz)?  Also how could this apply to the target

cfengine-bs-22.tgz: makefile cfagent cfkey cfexecd update.conf ${PUBLCKEY} cfexecd.sv

This make file will also include the install target.  On the host where the
install target will be used, the revision is not needed (svn is not even
installed).  How can I make the revision variable conditional or a dependant of
the client target?


-- 
Neil Watson             | Debian Linux
System Administrator    | Uptime  13:49:14 up 16:16,  2 users,  load average: 0.14, 0.04, 0.01
http://watson-wilson.ca
--
The Toronto Linux Users Group.      Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists





More information about the Legacy mailing list