/[pdpsoft]/nl.nikhef.pdp.tcs/nl.nikhef.pdp.tcs.dctcs-cli/trunk/Makefile
ViewVC logotype

Contents of /nl.nikhef.pdp.tcs/nl.nikhef.pdp.tcs.dctcs-cli/trunk/Makefile

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2774 - (show annotations) (download) (as text)
Fri Mar 20 02:05:46 2015 UTC (7 years, 2 months ago) by davidg
File MIME type: application/octet-stream
File size: 3811 byte(s)
Initial package version

1 #
2 # @(#)$Id$
3 # Makefile for dctcs-cli
4 # David Groep, Nikhef <davidg@nikhef.nl>
5 #
6
7 NAME=$(shell echo *.spec | sed 's/\.spec//')
8 VERSION=$(shell egrep '^Version:' ${NAME}.spec | colrm 1 9)
9 RELEASE=${NAME}-${VERSION}
10 PATCHLEVEL=$(shell egrep '^Release:' ${NAME}.spec | colrm 1 9 | sed -e 's/%.*//' )
11 RPMTOPDIR=$(shell rpm --eval '%_topdir')
12 PREFIX=/usr
13 ETC=/etc
14 CACHE=/var/cache
15 FILES=dctcs-cli NOTICE LICENSE README.txt CHANGES Makefile dctcs-cli.spec
16 # source files that will constitute as a single file, with the primary perl script first
17 SOURCEFILES=dctcs-cli
18
19 all: configure
20
21 tar: clean configure dctcs-cli
22 -rm -rf /var/tmp/${RELEASE} /var/tmp/${RELEASE}-buildroot
23 -mkdir /var/tmp/${RELEASE}
24 cp -r ${FILES} /var/tmp/${RELEASE}
25 -chmod -R u+rw /var/tmp/${RELEASE}
26 cd /var/tmp/ ; tar cvfz ${RELEASE}.tar.gz --exclude=CVS \
27 --exclude='*~' --exclude='#*#' --exclude='20*' ${RELEASE}
28 cp /var/tmp/${RELEASE}.tar.gz .
29
30 #####################################################################
31 # Create substitution script
32 ####################################################################
33 #
34 # This target reads the config file and creates a shell script which
35 # can substitute variables of the form @VAR@ for all config
36 # variables VAR.
37
38 config.sh: Makefile $(_test_dep) config.mk
39 @cp /dev/null makefile.tmp
40 @echo include config.mk >>makefile.tmp
41 @echo dumpvars: >>makefile.tmp
42 @cat config.mk | perl >>makefile.tmp -e 'my $$fmt = "\t\@echo \"-e \\\"s\@%s\@\$$(%s)g\\\" \\\\\"" ; while (<>) { $$v{$$1}=1 if /^([A-Za-z0-9_]+)\s*:?=.*$$/; } map { printf "$$fmt >>config.sh\n", $$_, $$_; } sort(keys(%v)); print "\n"; '
43 @echo '#!/bin/sh' >config.sh
44 @echo 'sed \' >>config.sh
45 @$(MAKE) -f makefile.tmp dumpvars >/dev/null
46 @echo ' -e "s/\@MSG\@/ ** Generated file : do not edit **/"'>>config.sh
47 @chmod oug+x config.sh
48 @rm makefile.tmp
49
50 ####################################################################
51 # Configure
52 ####################################################################
53
54 %:: %.cin config.sh
55 @echo configuring $@ ...
56 @rm -f $@ ; cp $< $@
57 @./config.sh <$< >$@ ; chmod oug-w $@
58
59 %.$(MANSECT):: %.$(MANSECT).man.cin
60 @echo creating $@ ...
61 @./config.sh <$< >$@ ; chmod oug-w $@
62
63 configure: $(shell find . -name \*\.cin 2>/dev/null | sed -e 's/.cin//' || echo)
64
65 install: configure
66 mkdir -p $(ETC)
67 mkdir -p $(PREFIX)
68 mkdir -p $(PREFIX)/bin
69 mkdir -p $(PREFIX)/share
70 mkdir -p $(PREFIX)/share/doc
71 mkdir -p $(PREFIX)/share/doc/$(RELEASE)
72 mkdir -p $(PREFIX)/share/man
73 mkdir -p $(PREFIX)/share/man/man8
74 install -m755 dctcs-cli $(PREFIX)/bin/dctcs-cli
75 install -m644 README.txt $(PREFIX)/share/doc/$(RELEASE)/README
76 install -m644 NOTICE $(PREFIX)/share/doc/$(RELEASE)/NOTICE
77 install -m644 LICENSE $(PREFIX)/share/doc/$(RELEASE)/LICENSE
78 install -m644 CHANGES $(PREFIX)/share/doc/$(RELEASE)/CHANGES
79
80 rpm: tar
81 rpmbuild -ta --eval "%undefine dist" ${RELEASE}.tar.gz
82 @if [ -f ${RPMTOPDIR}/SRPMS/${NAME}-${VERSION}-${PATCHLEVEL}.src.rpm ] ; then \
83 mv ${RPMTOPDIR}/SRPMS/${NAME}*-${VERSION}-${PATCHLEVEL}.src.rpm . ; \
84 fi
85 @if [ -f ${RPMTOPDIR}/RPMS/i386/${NAME}-${VERSION}-${PATCHLEVEL}.i386.rpm ] ; then \
86 mv ${RPMTOPDIR}/RPMS/i386/${NAME}*-${VERSION}-${PATCHLEVEL}.i386.rpm . ; \
87 fi
88 @if [ -f ${RPMTOPDIR}/RPMS/i686/${NAME}-${VERSION}-${PATCHLEVEL}.i686.rpm ] ; then \
89 mv ${RPMTOPDIR}/RPMS/i686/${NAME}*-${VERSION}-${PATCHLEVEL}.i686.rpm . ; \
90 fi
91 @if [ -f ${RPMTOPDIR}/RPMS/noarch/${NAME}-${VERSION}-${PATCHLEVEL}.noarch.rpm ] ; then \
92 mv ${RPMTOPDIR}/RPMS/noarch/${NAME}*-${VERSION}-${PATCHLEVEL}.noarch.rpm . ; \
93 mv ${RPMTOPDIR}/RPMS/noarch/${NAME}*-${VERSION}-${PATCHLEVEL}.suse.noarch.rpm . ; \
94 fi
95
96 clean:
97 -rm -rf *.tar.gz *.rpm dctcs-cli config.sh dctcs-cli.spec

Properties

Name Value
svn:mime-type application/octet-stream

grid.support@nikhef.nl
ViewVC Help
Powered by ViewVC 1.1.28