/[pdpsoft]/trunk/nl.nikhef.ndpf.tools/nikhef-fabric-ca/Makefile
ViewVC logotype

Contents of /trunk/nl.nikhef.ndpf.tools/nikhef-fabric-ca/Makefile

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2807 - (show annotations) (download)
Wed Nov 11 11:44:52 2015 UTC (6 years, 6 months ago) by dennisvd
File size: 12809 byte(s)
Summary: typo: remove spurious .0 extension from hashed certs

1 #
2 # @(#)$Id: Makefile,v 1.1 2007/08/13 08:15:14 davidg Exp $
3 #
4
5 .PHONY: release minorversion majorversion tagversion
6 .PHONY: pack rpm pkg prep clean dist userdoc apidoc check
7
8 _os := $(shell uname -s)
9 _date := $(shell date '+%d/%m/%y %H:%M')
10
11 #######################################################
12 #
13 # General settings
14 #
15 #######################################################
16
17 ####################################################################
18 # Linux specific settings
19 ####################################################################
20 #
21 #
22
23 _rpmbuild := $(shell [ -x /usr/bin/rpmbuild ] && echo rpmbuild || echo rpm)
24 _builddir := $(shell rpm --eval %_builddir)
25 _specdir := $(shell rpm --eval %_specdir)
26 _sourcedir := $(shell rpm --eval %_sourcedir)
27 _srcrpmdir := $(shell rpm --eval %_srcrpmdir)
28 _rpmdir := $(shell rpm --eval %_rpmdir)
29
30
31 include config.mk
32 _module = $(NAME)
33 _vpfx = $(NAME)_
34 _vtag = $(subst -,_,$(subst .,_,$(_vpfx)$(VERSION)$(BRANCH)))
35 _prodname = $(NAME)-$(VERSION)$(BRANCH)
36 _prodtar = $(_prodname).src.tgz
37
38
39 ###################################################################
40 # Create linux specific build directories
41 ###################################################################
42
43 envdir:: $(_srcrpmdir) $(_rpmdir)
44 $(_srcrpmdir):
45 mkdir -p $(_srcrpmdir)
46 $(_rpmdir):
47 mkdir -p $(_rpmdir)
48
49 ####################################################################
50 # Create new release/version/majorversion
51 ####################################################################
52 #
53 # These targets update the X.Y.Z components of the version in the
54 # config file and then commit the current version, tagging all
55 # files with the release number from the config file. Also
56 # wires the current date and time into the config file. Also
57 # adds an entry to the ChangeLog.
58
59
60 release: config.tmp
61 @echo 'increasing release number x.x.<X> and timestamp..'
62 @perl <config.tmp >config.mk -e 'while (<>) \
63 { s/^(VERSION=\d+\.\d+\.)(\d+)(.*)$$/$$1.($$2+1).$$3/e; \
64 s/^(RELEASE=)(\d+)(.*)$$/$$1."1".$$3/e; print; }'
65 @$(MAKE) tagversion
66
67 minorversion: config.tmp
68 @echo 'increasing minorversion number x.<X>.x and timestamp..'
69 @perl <config.tmp >config.mk -e 'while (<>) \
70 { s/^(VERSION=\d+\.)(\d+)(\..*)$$/$$1.($$2+1).".0"/e; \
71 s/^(RELEASE=)(\d+)(.*)$$/$$1."1".$$3/e; print; }'
72 @$(MAKE) tagversion
73
74 majorversion: config.tmp
75 @echo 'increasing majorversion number <X>.x.x and timestamp..'
76 @perl <config.tmp >config.mk -e 'while (<>) \
77 { s/^(VERSION=)(\d+)(\..*)$$/$$1.($$2+1).".0.0"/e; \
78 s/^(RELEASE=)(\d+)(.*)$$/$$1."1".$$3/e; print; }'
79 @$(MAKE) tagversion
80
81 config.tmp: config.mk
82 @cvs update .
83 @sed <config.mk >config.tmp '/^DATE=/d'
84 @echo 'DATE=$(_date)' >>config.tmp
85 @cp config.mk config.mk~
86
87 tagversion:
88 @echo cvs tagging new release: $(VERSION)
89 @rm -f config.tmp
90 @echo Enter ChangeLog comment or hit return key:
91 @perl -e '$$cl=<STDIN>; chomp($$cl); $$date=`date +%Y-%m-%d`; \
92 chomp($$date); \
93 $$login=getlogin(); \
94 $$logstr="<unknown>"; \
95 $$logstr=(getpwnam($$login))[6] if defined $$login; \
96 print $$date." $$logstr\n\n"; \
97 print " * Release: $(VERSION)\n"; \
98 print " - ".$$cl."\n" unless ($$cl eq ""); \
99 print "\n"; ' >ChangeLog.tmp
100 @if [ ! -r ChangeLog ] ; then touch ChangeLog ; cvs add ChangeLog ; fi
101 @cat ChangeLog >>ChangeLog.tmp
102 @mv ChangeLog.tmp ChangeLog
103 @cvs commit -m "Release: $(VERSION)"
104 @cvs tag -F -c `echo $(_vtag) |sed -e s/\\\./_/g -e s/-/_/g`
105 @cvs tag -F -c latest
106
107 ####################################################################
108 # Build distributions in tar & RPM/PKG format
109 ####################################################################
110 #
111 # These targets make distribution tar files and PKGs/RPMs from the
112 # CVS repository, using the version declared in the config file.
113 # The checked-out files in the current directory are neither
114 # modified, nor read (apart from the config file).
115 #
116 # "pack" and "rpm" built from the sources in the current directory.
117 #
118 #
119 # The prep:: target allows the including makefile to specify actions
120 # required to process the files at distribution pack time.
121 #
122 # These targets make distribution tar files and PKGs/RPMs based on the
123 # checked-out sources in the current directory. No connection to
124 # the CVS repository is required, and the files do not need to be
125 # committed. The RPM version numbers are generated from the
126 # version number specified in the config file.
127 #
128
129 pack: envdir
130 @echo packing distribution...
131 @rm -rf $(_builddir)/$(_prodname)
132 @rm -f $(_sourcedir)/$(_prodtar)
133 @mkdir -p $(_builddir)/$(_prodname)
134 @find . -path '*CVS*' -prune -o -type f -print >files.tmp
135 @tar cfT - files.tmp |(cd $(_builddir)/$(_prodname) ; tar xf -)
136 @rm -f files.tmp
137 @[ ! -f specfile.spec -a -f specfile.cin ] \
138 && cp specfile.cin \
139 $(_builddir)/$(_prodname)/specfile.spec \
140 || : ;
141 @cp cl2rpm \
142 $(_builddir)/$(_prodname)/ > /dev/null 2>&1 \
143 || : ;
144 @cd $(_builddir)/$(_prodname) ; \
145 sed <config.mk >config.tmp \
146 -e 's%^RELEASE=\(.*\)%RELEASE=\1%' \
147 -e 's%^VERSION=.*%&$(BRANCH)%' ; \
148 mv config.tmp config.mk ; \
149 echo 'TARFILE=$(_prodtar)' >>config.mk ; \
150 echo 'PROD=\#' >>config.mk ; \
151 $(MAKE) config.sh ;\
152 $(MAKE) prep ;\
153 test -n "$(_test_dep)" && rm -f $(_test_dep) ;\
154 rm -f config.sh
155 @cd $(_builddir) ; tar czf $(_sourcedir)/$(_prodtar) $(_prodname)
156
157 spec: pack
158 @echo generating specfile.spec ...
159 @cd $(_builddir)/$(_prodname) ; \
160 $(MAKE) config.sh ;\
161 ./config.sh <specfile.spec >$(_specdir)/$(_prodname).spec
162 @test -f ChangeLog && \
163 cl2rpm ChangeLog \
164 >>$(_specdir)/$(_prodname).spec 2>/dev/null || true
165
166 rpm: spec
167 @echo building rpm ...
168 @cd $(_specdir) ; $(_rpmbuild) -ba $(_specdir)/$(_prodname).spec
169
170 pkg: spec
171 @echo building pkg ...
172 @cd $(_specdir) ; $(_pkgbuild) -f $(_specdir)/$(_prodname).spec
173
174 prep::
175
176 #####################################################################
177 # Create substitution script
178 ####################################################################
179 #
180 # This target reads the config file and creates a shell script which
181 # can substitute variables of the form @VAR@ for all config
182 # variables VAR. The messing around with the temporary makefile is
183 # to ensure that any recursive or external references in the
184 # variable values are evaluated by "make" in the same context as
185 # when the config file is included in the makefile.
186
187 config.sh: Makefile $(_test_dep)
188 @cp /dev/null makefile.tmp
189 @echo include config.mk >>makefile.tmp
190 @echo dumpvars: >>makefile.tmp
191 @cat config.mk | \
192 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"; '
193 @echo '#!/bin/sh' >config.sh
194 @echo 'sed \' >>config.sh
195 @$(MAKE) -f makefile.tmp dumpvars >/dev/null
196 @echo ' -e "s/\@MSG\@/ ** Generated file : do not edit **/"'>>config.sh
197 @chmod oug+x config.sh
198 @rm makefile.tmp
199
200 ####################################################################
201 # Configure
202 ####################################################################
203
204 %:: %.cin config.sh
205 @echo configuring $@ ...
206 @rm -f $@ ; cp $< $@
207 @./config.sh <$< >$@ ; chmod oug-w $@
208
209 %.$(MANSECT):: %.$(MANSECT).man.cin
210 @echo creating $@ ...
211 @./config.sh <$< >$@ ; chmod oug-w $@
212
213 configure: $(shell find . -name \*\.cin 2>/dev/null | sed -e 's/.cin//' || echo)
214
215 default-install:
216 @[ -f MAINTAINER ] && install -D -m 0644 MAINTAINER $(PREFIX)$(DOCDIR)/MAINTAINER || :
217 @[ -f CHANGES ] && install -D -m 0644 CHANGES $(PREFIX)$(DOCDIR)/CHANGES || :
218 @[ -f ChangeLog ] && install -D -m 0644 ChangeLog $(PREFIX)$(DOCDIR)/ChangeLog || :
219 @[ -f README ] && install -D -m 0644 README $(PREFIX)$(DOCDIR)/README || :
220 @[ -f INSTALL ] && install -D -m 0644 INSTALL $(PREFIX)$(DOCDIR)/INSTALL || :
221 @[ -f LICENSE ] && install -D -m 0644 LICENSE $(PREFIX)$(DOCDIR)/LICENSE || :
222 @[ -d doc ] && cd doc && for i in * ; do \
223 test `expr match $$i .\*\.cin\$$` -eq 0 && install -m 0444 $$i $(PREFIX)/$(DOCDIR)/$$i ; \
224 done || :
225
226
227 ####################################################################
228 # Install
229 ####################################################################
230
231 install: configure default-install
232 @echo installing in $(PREFIX) ...
233 #
234 # MODIFY location of installed scripts/binaries here
235 #
236 @mkdir -p $(PREFIX)$(LOCDIR)
237 @mkdir -p $(PREFIX)/etc/openldap/cacerts
238 @mkdir -p $(PREFIX)/usr/share/ssl/certs
239 @mkdir -p $(PREFIX)$(DOCDIR)
240 install -m 0644 NIKHEF.doc $(PREFIX)$(DOCDIR)/NIKHEF.doc
241 for i in AAACertificateServices AddTrust-External-CA-Root NIKHEF TERENAeSciencePersonalCA TERENA-eScience-SSL-CA TERENA-SSL-CA UTNAAAClient UTN-USERFirst-Hardware DigiCertHighAssuranceEVRootCA TERENA-SSL-High-Assurance-CA-3 DigiCertAssuredIDRootCA-Root TERENA-eScience-SSL-CA-3 TERENA-SSL-CA-3 tcschain tcs3chain ; do \
242 install -m 0644 $$i.pem $(PREFIX)$(LOCDIR)/$$i.pem ; \
243 test -f $$i.info && install -m 0644 $$i.info $(PREFIX)$(LOCDIR)/$$i.info ; \
244 done
245 # OpenSSL link installation locations
246 # 75680d2e.0 -> AAACertificateServices.pem
247 # ee64a828.0 -> AAACertificateServices.pem
248 # 157753a5.0 -> AddTrust-External-CA-Root.pem
249 # 3c58f906.0 -> AddTrust-External-CA-Root.pem
250 # 16da7552.0 -> NIKHEF.pem
251 # dfb080e4.0 -> NIKHEF.pem
252 # 169d7f9c.0 -> TERENAeSciencePersonalCA.pem
253 # 82a0ca89.0 -> TERENAeSciencePersonalCA.pem
254 # 20ce830e.0 -> TERENA-eScience-SSL-CA.pem
255 # 9d772be7.0 -> TERENA-eScience-SSL-CA.pem
256 # 9df51c42.0 -> TERENA-SSL-CA.pem
257 # d9be2151.0 -> TERENA-SSL-CA.pem
258 # 9ec3a561.0 -> UTNAAAClient.pem
259 # c5e082db.0 -> UTNAAAClient.pem
260 # b13cc6df.0 -> UTN-USERFirst-Hardware.pem
261 # ff783690.0 -> UTN-USERFirst-Hardware.pem
262 # 244b5494.0 -> DigiCertHighAssuranceEVRootCA.pem
263 # 81b9768f.0 -> DigiCertHighAssuranceEVRootCA.pem
264 # dd5d4ea8.0 -> TERENA-SSL-High-Assurance-CA-3.pem
265 # dcd1bb1a.0 -> TERENA-SSL-High-Assurance-CA-3.pem
266 # b1159c4c.0 -> DigiCertAssuredIDRootCA-Root.pem
267 # 69105f4f.0 -> DigiCertAssuredIDRootCA-Root.pem
268 # e523eeaa.0 -> TERENA-eScience-SSL-CA-3.pem
269 # 1db3b27f.0 -> TERENA-eScience-SSL-CA-3.pem
270 # d919ffd0.0 -> TERENA-SSL-CA-3.pem
271 # c493a2ab.0 -> TERENA-SSL-CA-3.pem
272
273 for d in /etc/pki/tls/certs /etc/openldap/cacerts /usr/share/ssl/certs ; do \
274 for i in 16da7552 dfb080e4 ; do \
275 ln -fs $(LOCDIR)/NIKHEF.pem $(PREFIX)$$d/$$i.0 ; \
276 done ; \
277 for i in 75680d2e ee64a828 ; do \
278 ln -fs $(LOCDIR)/AAACertificateServices.pem $(PREFIX)$$d/$$i.0 ; \
279 done ; \
280 for i in 157753a5 3c58f906 ; do \
281 ln -fs $(LOCDIR)/AddTrust-External-CA-Root.pem $(PREFIX)$$d/$$i.0 ; \
282 done ; \
283 for i in 169d7f9c 82a0ca89 ; do \
284 ln -fs $(LOCDIR)/TERENAeSciencePersonalCA.pem $(PREFIX)$$d/$$i.0 ; \
285 done ; \
286 for i in 20ce830e 9d772be7 ; do \
287 ln -fs $(LOCDIR)/TERENA-eScience-SSL-CA.pem $(PREFIX)$$d/$$i.0 ; \
288 done ; \
289 for i in 9df51c42 d9be2151 ; do \
290 ln -fs $(LOCDIR)/TERENA-SSL-CA.pem $(PREFIX)$$d/$$i.0 ; \
291 done ; \
292 for i in 9ec3a561 c5e082db ; do \
293 ln -fs $(LOCDIR)/UTNAAAClient.pem $(PREFIX)$$d/$$i.0 ; \
294 done ; \
295 for i in b13cc6df ff783690 ; do \
296 ln -fs $(LOCDIR)/UTN-USERFirst-Hardware.pem $(PREFIX)$$d/$$i.0 ; \
297 done ; \
298 for i in 244b5494 81b9768f ; do \
299 ln -fs $(LOCDIR)/DigiCertHighAssuranceEVRootCA.pem $(PREFIX)$$d/$$i.0 ; \
300 done ; \
301 for i in dd5d4ea8 dcd1bb1a ; do \
302 ln -fs $(LOCDIR)/TERENA-SSL-High-Assurance-CA-3.pem $(PREFIX)$$d/$$i.0 ; \
303 done ; \
304 for i in b1159c4c 69105f4f ; do \
305 ln -fs $(LOCDIR)/DigiCertAssuredIDRootCA-Root.pem $(PREFIX)$$d/$$i.0 ; \
306 done ; \
307 for i in e523eeaa 1db3b27f ; do \
308 ln -fs $(LOCDIR)/TERENA-eScience-SSL-CA-3.pem $(PREFIX)$$d/$$i.0 ; \
309 done ; \
310 for i in d919ffd0 c493a2ab ; do \
311 ln -fs $(LOCDIR)/TERENA-SSL-CA-3.pem $(PREFIX)$$d/$$i.0 ; \
312 done ; \
313 done
314 for i in AAACertificateServices AddTrust-External-CA-Root NIKHEF TERENAeSciencePersonalCA TERENA-eScience-SSL-CA TERENA-SSL-CA UTNAAAClient UTN-USERFirst-Hardware DigiCertHighAssuranceEVRootCA TERENA-SSL-High-Assurance-CA-3 DigiCertAssuredIDRootCA-Root TERENA-eScience-SSL-CA-3 TERENA-SSL-CA-3 ; do \
315 ln -fs $(LOCDIR)/$$i.pem $(PREFIX)/etc/openldap/cacerts/ ; \
316 done
317
318
319 ####################################################################
320
321 filelist: install
322 @find $(PREFIX) -type d | sed -e 's^$(PREFIX)g' -e 's/^/%dir /' >> $(FILELIST)
323 @find $(PREFIX) ! -type d -a ! -name ".filelist" | sed -e 's^$(PREFIX)g' >> $(FILELIST)
324 @echo Files found in distribution listing $(FILELIST)
325 @cat $(FILELIST)
326
327
328 clean::
329 @echo cleaning common files ...
330 @rm -f config.sh config.tex
331 @rm -f `find . -name '*~'`
332 @rm -f `find . -name '*#'`
333 @rm -f `find . -name '*.tmp'`
334
335 dist: pack
336
337
338

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