/[pdpsoft]/nl.nikhef.pdp.fetchcrl/trunk/Makefile
ViewVC logotype

Contents of /nl.nikhef.pdp.fetchcrl/trunk/Makefile

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1807 - (show annotations) (download)
Mon Jun 21 22:22:35 2010 UTC (11 years, 4 months ago) by davidg
Original Path: trunk/fetchcrl/Makefile
File size: 4397 byte(s)
fixup user write permission on specfile in tarball

1 #
2 # @(#)$Id$
3 # Makefile for fetch-crl3
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=fetch-crl fetch-crl.8 fetch-crl-cron.cron fetch-crl-cron.init fetch-crl-boot.init fetch-crl.cnf fetch-crl.cnf.example NOTICE LICENSE README CHANGES fetch-crl.spec Makefile
16 # source files that will constitute fetch-crl as a single file, with the primary perl script first
17 SOURCEFILES=fetch-crl3.pl CRL.pm CRLWriter.pm ConfigTiny.pm FCLog.pm OSSL.pm TrustAnchor.pm base64.pm
18
19 all: configure
20
21 tar: clean configure fetch-crl
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 | \
43 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"; '
44 @echo '#!/bin/sh' >config.sh
45 @echo 'sed \' >>config.sh
46 @$(MAKE) -f makefile.tmp dumpvars >/dev/null
47 @echo ' -e "s/\@MSG\@/ ** Generated file : do not edit **/"'>>config.sh
48 @chmod oug+x config.sh
49 @rm makefile.tmp
50
51 ####################################################################
52 # Configure
53 ####################################################################
54
55 fetch-crl: $(SOURCEFILES)
56 cat $(SOURCEFILES) > $@ && chmod +x $@
57
58 %:: %.cin config.sh
59 @echo configuring $@ ...
60 @rm -f $@ ; cp $< $@
61 @./config.sh <$< >$@ ; chmod oug-w $@
62
63 %.$(MANSECT):: %.$(MANSECT).man.cin
64 @echo creating $@ ...
65 @./config.sh <$< >$@ ; chmod oug-w $@
66
67 configure: $(shell find . -name \*\.cin 2>/dev/null | sed -e 's/.cin//' || echo)
68
69 install: configure
70 install -m755 -D fetch-crl $(PREFIX)/sbin/fetch-crl
71 install -m644 -D fetch-crl-cron.cron $(PREFIX)/share/doc/$(RELEASE)/fetch-crl-cron.cron
72 install -m644 -D fetch-crl-cron.init $(PREFIX)/share/doc/$(RELEASE)/fetch-crl-cron.init
73 install -m644 -D fetch-crl-boot.init $(PREFIX)/share/doc/$(RELEASE)/fetch-crl-boot.init
74 install -m644 -D fetch-crl.8 $(PREFIX)/share/man/man8/fetch-crl.8
75 install -m644 -D fetch-crl.cnf $(ETC)/fetch-crl.cnf
76 install -m644 fetch-crl.cnf.example $(PREFIX)/share/doc/$(RELEASE)/fetch-crl.cnf.example
77 install -m644 README $(PREFIX)/share/doc/$(RELEASE)/README
78 install -m644 NOTICE $(PREFIX)/share/doc/$(RELEASE)/NOTICE
79 install -m644 LICENSE $(PREFIX)/share/doc/$(RELEASE)/LICENSE
80 install -m644 CHANGES $(PREFIX)/share/doc/$(RELEASE)/CHANGES
81 mkdir -p $(CACHE)/fetch-crl && chmod 0700 $(CACHE)/fetch-crl
82
83 rpm: tar
84 rpmbuild -ta ${RELEASE}.tar.gz
85 @if [ -f ${RPMTOPDIR}/SRPMS/${NAME}-${VERSION}-${PATCHLEVEL}.src.rpm ] ; then \
86 mv ${RPMTOPDIR}/SRPMS/${NAME}*-${VERSION}-${PATCHLEVEL}.src.rpm . ; \
87 fi
88 @if [ -f ${RPMTOPDIR}/RPMS/i386/${NAME}-${VERSION}-${PATCHLEVEL}.i386.rpm ] ; then \
89 mv ${RPMTOPDIR}/RPMS/i386/${NAME}*-${VERSION}-${PATCHLEVEL}.i386.rpm . ; \
90 fi
91 @if [ -f ${RPMTOPDIR}/RPMS/i686/${NAME}-${VERSION}-${PATCHLEVEL}.i686.rpm ] ; then \
92 mv ${RPMTOPDIR}/RPMS/i686/${NAME}*-${VERSION}-${PATCHLEVEL}.i686.rpm . ; \
93 fi
94 @if [ -f ${RPMTOPDIR}/RPMS/noarch/${NAME}-${VERSION}-${PATCHLEVEL}.noarch.rpm ] ; then \
95 mv ${RPMTOPDIR}/RPMS/noarch/${NAME}*-${VERSION}-${PATCHLEVEL}.noarch.rpm . ; \
96 fi
97 @echo DO NOT FORGET TO SIGN THE RPM WITH rpm --resign ${NAME}*-${VERSION}-${PATCHLEVEL}.noarch.rpm
98
99 clean:
100 -rm -rf *.tar.gz *.rpm fetch-crl config.sh fetch-crl.spec

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