gnu make help

Neil Watson tlug-neil-8agRmHhQ+n2CxnSzwYWP7Q at public.gmane.org
Fri May 11 14:31:28 UTC 2007


On Fri, May 11, 2007 at 10:24:01AM -0400, Lennart Sorensen wrote:
>I see nothing in that makefile that is a target, ie:
>
>client: dependancies
>	commands to run
>	stuff to do
>
>
>Really doens't look much like a makefile without that.

I had snipped the rest.  Here is the whole thing:
# makefile

# This file will build a boot strap client. 

SHELL=/bin/bash
AWK=/bin/awk
SVN=/usr/local/bin/svn

# Define public key based on varible input
ifeq "${NETWORK}" "172_16_0_0"
        PUBLICKEY=root-172.16.48.66.pub
endif
ifeq "${NETWORK}" "192_168_0_0"
        PUBLICKEY=root-192.168.81.43.pub
endif
ifeq "${NETWORK}" "10_208_66_0"
        PUBLICKEY=root-10.208.66.59.pub
        NETWORK=172_16_0_0
endif

WORKDIR=/var/cfengine
BINDIR=/usr/local/sbin
TARFILES=makefile \
        bin/${VERSION}/cfagent\
        bin/${VERSION}/cfkey \
        bin/${VERSION}/cfexecd \
        inputs/${NETWORK}/update.conf \
        init.d/cfexecd.sv \
        ppkeys/${PUBLICKEY} \
        REVISION.txt

INSTALLFILES= \
        ${BINDIR}/cfagent \
        ${BINDIR}/cfkey \
        ${BINDIR}/cfexecd \
        ${WORKDIR}/inputs/update.conf \
        ${WORKDIR}/bin \
        /etc/rc.d/init.d/cfexecd.sv \
        /etc/rc.d/rc3.d/S51cfexecd.sv \


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

.PHONY: help
help:
        make --print-data-base --question | \
        ${AWK} '/^[^.%][-A-Za-z0-9]*:/ \
        { print substr($$1, 1, length($$1)-1) }' | \
        sort
        # USAGE:
        # make client VERSION=[redhat_as_3 | redhat_as_4] NETWORK=[172_16_0_0 | 192_168_0_0 | 10_208_66_0]
        # make install 
        # -- makes client tarball to be copied to new client.
        #
        # Copy tarball to client system.
        # make install: install tarball on client.

# Make client tarball to be copied to client.
.PHONY: client

# Tarball file that will be copied to the client.
client: ${TARFILES}
        tar -cvzpf cfengine-bs-v$(shell cat REVISION.txt).tgz $^
        rm REVISION.txt

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

REVISION.txt:
        ${SVN} info | ${AWK} '/^Revision.*/ { print $$2 }' > $@
        
# Install client
.PHONY: install
install: ${INSTALLFILES}
        ln -s ${BINDIR}/cfexecd ${WORKDIR}/bin/cfexecd
        ln -s ${BINDIR}/cfagent ${WORKDIR}/bin/cfagent
        ${BINDIR}/cfkey
        cp ppkeys/* ${WORKDIR}/ppkeys
        chown root:root ${WORKDIR}/ppkeys/*
        chmod 600 ${WORKDIR}/ppkeys/*
        service cfexecd.sv start
        # Run cfagent to receive first updates.

${BINDIR}/cfagent:
        cp bin/redhat_as_?/cfagent $@
        chown root:root $@
        chmod 755 $@

${BINDIR}/cfkey:
        cp bin/redhat_as_?/cfkey $@
        chown root:root $@
        chmod 755 $@

${BINDIR}/cfexecd:
        cp bin/redhat_as_?/cfexecd $@
        chown root:root $@
        chmod 755 $@

${WORKDIR}/inputs/update.conf: ${WORKDIR}/inputs
        cp inputs/*_0_0/update.conf $@
        chown root:root $@
        chmod 644 $@

${WORKDIR}/ppkeys: ${WORKDIR}
        mkdir ${WORKDIR}/ppkeys
        chown root:root $@
        chmod 700 $@

${WORKDIR}/bin: ${WORKDIR}
        mkdir ${WORKDIR}/bin
        chown root:root $@
        chmod 700 $@

${WORKDIR}/inputs: ${WORKDIR}
        mkdir ${WORKDIR}/inputs
        chown root:root $@
        chmod 700 $@

${WORKDIR}:
        mkdir $@
        chown root:root $@
        chmod 755 $@

/etc/rc.d/init.d/cfexecd.sv: ${BINDIR}/cfexecd
        cp init.d/cfexecd.sv /etc/rc.d/init.d
        chmod 755 $@

/etc/rc.d/rc3.d/S51cfexecd.sv: /etc/rc.d/init.d/cfexecd.sv
        ln -s $< $@

-- 
Neil Watson             | Debian Linux
System Administrator    | Uptime 7 days
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