/[pdpsoft]/trunk/nl.nikhef.ndpf.tools/globus-gram5-glue2-info-providers/Makefile
ViewVC logotype

Contents of /trunk/nl.nikhef.ndpf.tools/globus-gram5-glue2-info-providers/Makefile

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2531 - (show annotations) (download)
Wed Apr 25 14:32:26 2012 UTC (9 years, 9 months ago) by davidg
File size: 10542 byte(s)
Add verbatim copies of creamce tools to reduce dependencies

1 #
2 # @(#)$Id: Makefile,v 1.1 2008/02/05 16:58:12 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 (<>) { s/^(VERSION=\d+\.\d+\.)(\d+)(.*)$$/$$1.($$2+1).$$3/e; s/^(RELEASE=)(\d+)(.*)$$/$$1."1".$$3/e; print; }'
63 @$(MAKE) tagversion
64
65 minorversion: config.tmp
66 @echo 'increasing minorversion number x.<X>.x and timestamp..'
67 @perl <config.tmp >config.mk -e 'while (<>) \
68 { s/^(VERSION=\d+\.)(\d+)(\..*)$$/$$1.($$2+1).".0"/e; \
69 s/^(RELEASE=)(\d+)(.*)$$/$$1."1".$$3/e; print; }'
70 @$(MAKE) tagversion
71
72 majorversion: config.tmp
73 @echo 'increasing majorversion number <X>.x.x and timestamp..'
74 @perl <config.tmp >config.mk -e 'while (<>) \
75 { s/^(VERSION=)(\d+)(\..*)$$/$$1.($$2+1).".0.0"/e; \
76 s/^(RELEASE=)(\d+)(.*)$$/$$1."1".$$3/e; print; }'
77 @$(MAKE) tagversion
78
79 config.tmp: config.mk
80 @cvs update .
81 @sed <config.mk >config.tmp '/^DATE=/d'
82 @echo 'DATE=$(_date)' >>config.tmp
83 @cp config.mk config.mk~
84
85 tagversion:
86 @echo cvs tagging new release: $(VERSION)
87 @rm -f config.tmp
88 @echo Enter ChangeLog comment or hit return key:
89 @perl -e '$$cl=<STDIN>; chomp($$cl); $$date=`date +%Y-%m-%d`; \
90 chomp($$date); \
91 $$login=getlogin(); \
92 $$logstr="<unknown>"; \
93 $$logstr=(getpwnam($$login))[6] if defined $$login; \
94 print $$date." $$logstr\n\n"; \
95 print " * Release: $(VERSION)\n"; \
96 print " - ".$$cl."\n" unless ($$cl eq ""); \
97 print "\n"; ' >ChangeLog.tmp
98 @if [ ! -r ChangeLog ] ; then touch ChangeLog ; cvs add ChangeLog ; fi
99 @cat ChangeLog >>ChangeLog.tmp
100 @mv ChangeLog.tmp ChangeLog
101 @cvs commit -m "Release: $(VERSION)"
102 @cvs tag -F -c `echo $(_vtag) |sed -e s/\\\./_/g -e s/-/_/g`
103 @cvs tag -F -c latest
104
105 ####################################################################
106 # Build distributions in tar & RPM/PKG format
107 ####################################################################
108 #
109 # These targets make distribution tar files and PKGs/RPMs from the
110 # CVS repository, using the version declared in the config file.
111 # The checked-out files in the current directory are neither
112 # modified, nor read (apart from the config file).
113 #
114 # "pack" and "rpm" built from the sources in the current directory.
115 #
116 #
117 # The prep:: target allows the including makefile to specify actions
118 # required to process the files at distribution pack time.
119 #
120 # These targets make distribution tar files and PKGs/RPMs based on the
121 # checked-out sources in the current directory. No connection to
122 # the CVS repository is required, and the files do not need to be
123 # committed. The RPM version numbers are generated from the
124 # version number specified in the config file.
125 #
126
127 pack: envdir
128 @echo packing distribution...
129 @rm -rf $(_builddir)/$(_prodname)
130 @rm -f $(_sourcedir)/$(_prodtar)
131 @mkdir -p $(_builddir)/$(_prodname)
132 @find . -path '*CVS*' -prune -o -type f -print >files.tmp
133 @tar cfT - files.tmp |(cd $(_builddir)/$(_prodname) ; tar xf -)
134 @rm -f files.tmp
135 @[ ! -f specfile.spec -a -f specfile.cin ] \
136 && cp specfile.cin \
137 $(_builddir)/$(_prodname)/specfile.spec \
138 || : ;
139 @cp cl2rpm \
140 $(_builddir)/$(_prodname)/ > /dev/null 2>&1 \
141 || : ;
142 @cd $(_builddir)/$(_prodname) ; \
143 sed <config.mk >config.tmp \
144 -e 's%^RELEASE=\(.*\)%RELEASE=\1%' \
145 -e 's%^VERSION=.*%&$(BRANCH)%' ; \
146 mv config.tmp config.mk ; \
147 echo 'TARFILE=$(_prodtar)' >>config.mk ; \
148 echo 'PROD=\#' >>config.mk ; \
149 $(MAKE) config.sh ;\
150 $(MAKE) prep ;\
151 test -n "$(_test_dep)" && rm -f $(_test_dep) ;\
152 rm -f config.sh
153 @cd $(_builddir) ; tar czf $(_sourcedir)/$(_prodtar) $(_prodname)
154 @cp -p $(_sourcedir)/$(_prodtar) .
155
156 spec: pack
157 @echo generating specfile.spec ...
158 @cd $(_builddir)/$(_prodname) ; \
159 $(MAKE) config.sh ;\
160 ./config.sh <specfile.spec >$(_specdir)/$(_prodname).spec
161 @test -f ChangeLog && \
162 cl2rpm ChangeLog \
163 >>$(_specdir)/$(_prodname).spec 2>/dev/null || true
164
165 rpm: spec
166 @echo building rpm ...
167 @cd $(_specdir) ; $(_rpmbuild) -ba $(_specdir)/$(_prodname).spec
168 @if [ -f $(_srcrpmdir)/$(_prodname)-$(RELEASE).src.rpm ] ; then \
169 mv $(_srcrpmdir)/$(_prodname)-$(RELEASE).src.rpm . ; \
170 fi
171 @if [ -f $(_rpmdir)/i386/$(_prodname)-$(RELEASE).i386.rpm ] ; then \
172 mv $(_rpmdir)/i386/$(_prodname)-$(RELEASE).i386.rpm . ; \
173 fi
174 @if [ -f $(_rpmdir)/i686/$(_prodname)-$(RELEASE).i686.rpm ] ; then \
175 mv $(_rpmdir)/i686/$(_prodname)-$(RELEASE).i686.rpm . ; \
176 fi
177 @if [ -f $(_rpmdir)/x86_64/$(_prodname)-$(RELEASE).x86_64.rpm ] ; then \
178 mv $(_rpmdir)/x86_64/$(_prodname)-$(RELEASE).x86_64.rpm . ; \
179 fi
180 @if [ -f $(_rpmdir)/athlon/$(_prodname)-$(RELEASE).athlon.rpm ] ; then \
181 mv $(_rpmdir)/athlon/$(_prodname)-$(RELEASE).athlon.rpm . ; \
182 fi
183 @if [ -f $(_rpmdir)/ia64/$(_prodname)-$(RELEASE).ia64.rpm ] ; then \
184 mv $(_rpmdir)/ia64/$(_prodname)-$(RELEASE).ia64.rpm . ; \
185 fi
186 @if [ -f $(_rpmdir)/noarch/$(_prodname)-$(RELEASE).noarch.rpm ] ; then \
187 mv $(_rpmdir)/noarch/$(_prodname)-$(RELEASE).noarch.rpm . ; \
188 fi
189
190 pkg: spec
191 @echo building pkg ...
192 @cd $(_specdir) ; $(_pkgbuild) -f $(_specdir)/$(_prodname).spec
193
194 prep::
195
196 #####################################################################
197 # Create substitution script
198 ####################################################################
199 #
200 # This target reads the config file and creates a shell script which
201 # can substitute variables of the form @VAR@ for all config
202 # variables VAR. The messing around with the temporary makefile is
203 # to ensure that any recursive or external references in the
204 # variable values are evaluated by "make" in the same context as
205 # when the config file is included in the makefile.
206
207 config.sh: Makefile $(_test_dep)
208 @cp /dev/null makefile.tmp
209 @echo include config.mk >>makefile.tmp
210 @echo dumpvars: >>makefile.tmp
211 @cat config.mk | \
212 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"; '
213 @echo '#!/bin/sh' >config.sh
214 @echo 'sed \' >>config.sh
215 @$(MAKE) -f makefile.tmp dumpvars >/dev/null
216 @echo ' -e "s/\@MSG\@/ ** Generated file : do not edit **/"'>>config.sh
217 @chmod oug+x config.sh
218 @rm makefile.tmp
219
220 ####################################################################
221 # Configure
222 ####################################################################
223
224 %:: %.cin config.sh
225 @echo configuring $@ ...
226 @rm -f $@ ; cp $< $@
227 @./config.sh <$< >$@ ; chmod oug-w $@
228
229 %.$(MANSECT):: %.$(MANSECT).man.cin
230 @echo creating $@ ...
231 @./config.sh <$< >$@ ; chmod oug-w $@
232
233 configure: $(shell find . -name \*\.cin 2>/dev/null | sed -e 's/.cin//' || echo)
234
235 default-install:
236 @[ -f MAINTAINER ] && install -D -m 0644 MAINTAINER $(PREFIX)$(DOCDIR)/MAINTAINER || :
237 @[ -f CHANGES ] && install -D -m 0644 CHANGES $(PREFIX)$(DOCDIR)/CHANGES || :
238 @[ -f ChangeLog ] && install -D -m 0644 ChangeLog $(PREFIX)$(DOCDIR)/ChangeLog || :
239 @[ -f README ] && install -D -m 0644 README $(PREFIX)$(DOCDIR)/README || :
240 @[ -f INSTALL ] && install -D -m 0644 INSTALL $(PREFIX)$(DOCDIR)/INSTALL || :
241 @[ -f LICENSE ] && install -D -m 0644 LICENSE $(PREFIX)$(DOCDIR)/LICENSE || :
242 @[ -d doc ] && cd doc && for i in * ; do \
243 test `expr match $$i .\*\.cin\$$` -eq 0 && install -m 0444 $$i $(PREFIX)/$(DOCDIR)/$$i ; \
244 done || :
245
246
247 ####################################################################
248 # Install
249 ####################################################################
250
251 install: configure default-install
252 @echo installing in $(PREFIX) ...
253 #
254 # MODIFY location of installed scripts/binaries here
255 #
256 @mkdir -p $(PREFIX)/$(ETCDIR)/
257 install -m 0644 globus-info-gip-gram5-glue2.conf $(PREFIX)/$(CONFIG)
258 @mkdir -p $(PREFIX)/$(SYSDIR)/bin
259 for i in \
260 globus-info-gip-gram5-glue2-computingservice-static \
261 globus-info-gip-gram5-glue2-endpoint-dynamic \
262 globus-info-gip-gram5-glue2-endpoint-static \
263 globus-info-gip-gram5-glue2-manager-static \
264 globus-info-gip-gram5-glue2-tostorageservice-static \
265 globus-info-gip-gram5-glue2-share-static ; \
266 do \
267 install -m 0755 $$i $(PREFIX)/$(SYSDIR)/bin/$$i ; \
268 done
269
270 ####################################################################
271
272 filelist: install
273 @find $(PREFIX) -type d | sed -e 's^$(PREFIX)g' -e 's/^/%dir /' >> $(FILELIST)
274 @find $(PREFIX) ! -type d -a ! -name ".filelist" | sed -e 's^$(PREFIX)g' >> $(FILELIST)
275 @echo Files found in distribution listing $(FILELIST)
276 @cat $(FILELIST)
277
278
279 clean::
280 @echo cleaning common files ...
281 @rm -f config.sh config.tex
282 @rm -f `find . -name '*~'`
283 @rm -f `find . -name '*#'`
284 @rm -f `find . -name '*.tmp'`
285 @rm -f $(_prodtar)
286 @rm -f `find . -name '$(_prodname)-$(RELEASE).*.rpm'`
287
288 dist: pack
289
290
291

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