/[pdpsoft]/trunk/fetchcrl/Makefile
ViewVC logotype

Contents of /trunk/fetchcrl/Makefile

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1759 - (show annotations) (download)
Fri Jun 11 15:41:40 2010 UTC (11 years, 6 months ago) by davidg
File size: 4363 byte(s)
Moved fetch-crl to a tagger part of the repo

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 cd /var/tmp/ ; tar cvfz ${RELEASE}.tar.gz --exclude=CVS \
26 --exclude='*~' --exclude='#*#' --exclude='20*' ${RELEASE}
27 cp /var/tmp/${RELEASE}.tar.gz .
28
29 #####################################################################
30 # Create substitution script
31 ####################################################################
32 #
33 # This target reads the config file and creates a shell script which
34 # can substitute variables of the form @VAR@ for all config
35 # variables VAR.
36
37 config.sh: Makefile $(_test_dep) config.mk
38 @cp /dev/null makefile.tmp
39 @echo include config.mk >>makefile.tmp
40 @echo dumpvars: >>makefile.tmp
41 @cat config.mk | \
42 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 fetch-crl: $(SOURCEFILES)
55 cat $(SOURCEFILES) > $@ && chmod +x $@
56
57 %:: %.cin config.sh
58 @echo configuring $@ ...
59 @rm -f $@ ; cp $< $@
60 @./config.sh <$< >$@ ; chmod oug-w $@
61
62 %.$(MANSECT):: %.$(MANSECT).man.cin
63 @echo creating $@ ...
64 @./config.sh <$< >$@ ; chmod oug-w $@
65
66 configure: $(shell find . -name \*\.cin 2>/dev/null | sed -e 's/.cin//' || echo)
67
68 install: configure
69 install -m755 -D fetch-crl $(PREFIX)/sbin/fetch-crl
70 install -m644 -D fetch-crl-cron.cron $(PREFIX)/share/doc/$(RELEASE)/fetch-crl-cron.cron
71 install -m644 -D fetch-crl-cron.init $(PREFIX)/share/doc/$(RELEASE)/fetch-crl-cron.init
72 install -m644 -D fetch-crl-boot.init $(PREFIX)/share/doc/$(RELEASE)/fetch-crl-boot.init
73 install -m644 -D fetch-crl.8 $(PREFIX)/share/man/man8/fetch-crl.8
74 install -m644 -D fetch-crl.cnf $(ETC)/fetch-crl.cnf
75 install -m644 fetch-crl.cnf.example $(PREFIX)/share/doc/$(RELEASE)/fetch-crl.cnf.example
76 install -m644 README $(PREFIX)/share/doc/$(RELEASE)/README
77 install -m644 NOTICE $(PREFIX)/share/doc/$(RELEASE)/NOTICE
78 install -m644 LICENSE $(PREFIX)/share/doc/$(RELEASE)/LICENSE
79 install -m644 CHANGES $(PREFIX)/share/doc/$(RELEASE)/CHANGES
80 mkdir -p $(CACHE)/fetch-crl && chmod 0700 $(CACHE)/fetch-crl
81
82 rpm: tar
83 rpmbuild -ta ${RELEASE}.tar.gz
84 @if [ -f ${RPMTOPDIR}/SRPMS/${NAME}-${VERSION}-${PATCHLEVEL}.src.rpm ] ; then \
85 mv ${RPMTOPDIR}/SRPMS/${NAME}*-${VERSION}-${PATCHLEVEL}.src.rpm . ; \
86 fi
87 @if [ -f ${RPMTOPDIR}/RPMS/i386/${NAME}-${VERSION}-${PATCHLEVEL}.i386.rpm ] ; then \
88 mv ${RPMTOPDIR}/RPMS/i386/${NAME}*-${VERSION}-${PATCHLEVEL}.i386.rpm . ; \
89 fi
90 @if [ -f ${RPMTOPDIR}/RPMS/i686/${NAME}-${VERSION}-${PATCHLEVEL}.i686.rpm ] ; then \
91 mv ${RPMTOPDIR}/RPMS/i686/${NAME}*-${VERSION}-${PATCHLEVEL}.i686.rpm . ; \
92 fi
93 @if [ -f ${RPMTOPDIR}/RPMS/noarch/${NAME}-${VERSION}-${PATCHLEVEL}.noarch.rpm ] ; then \
94 mv ${RPMTOPDIR}/RPMS/noarch/${NAME}*-${VERSION}-${PATCHLEVEL}.noarch.rpm . ; \
95 fi
96 @echo DO NOT FORGET TO SIGN THE RPM WITH rpm --resign ${NAME}*-${VERSION}-${PATCHLEVEL}.noarch.rpm
97
98 clean:
99 -rm -rf *.tar.gz *.rpm fetch-crl config.sh fetch-crl.spec

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