source: CMT/HEAD/mgr/GNUmakefile @ 559

Last change on this file since 559 was 559, checked in by rybkin, 14 years ago

See C.L. 442

File size: 14.1 KB
Line 
1#---------------------------------------------------------
2#-- start of constituents_header ------
3
4include ${CMTROOT}/src/Makefile.core
5#include ${CMTROOT}/mgr/Unix.make
6
7ifdef tag
8CMTEXTRATAGS = $(tag)
9else
10tag       = $(CMTCONFIG)
11endif
12
13tags      = $(tag),$(CMTEXTRATAGS)
14
15PACKAGE = CMT
16${PACKAGE}_tag = $(tag)
17
18cmt_local_tagfile = $(bin)$(${PACKAGE}_tag).make
19
20#-include $(cmt_local_tagfile)
21#include $(cmt_local_tagfile)
22include ${CMTROOT}/mgr/Unix.make
23
24#cmt_final_setup = $(bin)setup.make
25
26ifneq ($(wildcard $(cmtexe)),)
27all :: cmt
28        $(silent)\cd $(bin) && \rm -f cmt && ln -s cmt.exe cmt
29        $(echo) all ok
30else
31#---------------------------------------------------------
32#
33# Re-building CMT
34#
35#---------------------------------------------------------
36ifneq ($(cppdepflags),)
37all :: cmt
38else
39all :: cmt post_build done
40endif
41        $(silent)\cd $(bin) && \rm -f cmt && ln -s cmt.exe cmt
42        $(echo) all ok
43#@cd $(bin); /bin/rm -f cmt; cp cmt.exe cmt
44
45done : cmt post_build
46        @echo "CMT has been succesfully rebuilt."
47
48#---------------------------------------------------------
49#post_build :: cmt cmt_dependencies.make $(bin)/cmt_dependencies.make
50post_build :: cmt cmt_dependencies.make
51        @echo post_build done
52
53#cmt_dependencies.make $(bin)/cmt_dependencies.make : $(cmtexe)
54cmt_dependencies.make : $(cmtexe)
55        $(cmtexe) -quiet build dependencies cmt -all_sources -no_stamps -out=$(bin)/cmt_dependencies.make
56        cp $(bin)/cmt_dependencies.make ../mgr
57        $(cmtexe) -quiet build dependencies cmt -all_sources -out=$(bin)/cmt_dependencies.make
58#---------------------------------------------------------
59endif
60
61dirs :: requirements
62        @if test ! -d $(bin) ; then $(mkdir) -p $(bin) ; fi
63
64requirements :
65        @if test ! -r requirements ; then echo "No requirements file" ; fi
66
67#-- end of constituents_header ------
68
69#-- start of constituent ------
70CONSTITUENT = cmt
71#cmt_final_setup_${CONSTITUENT} = $(bin)setup.make
72cmt_final_setup_cmt = requirements
73cmt_local_${CONSTITUENT}_makefile = $(bin)${CONSTITUENT}.make
74#cmt_local_tagfile_${CONSTITUENT} = $(bin)$(${PACKAGE}_tag).make
75cmt_local_tagfile_${CONSTITUENT} = ${CMTROOT}/mgr/Unix.make
76
77ifdef STRUCTURED_OUTPUT
78${CONSTITUENT}dirs :
79        @if test ! -d $(bin)${CONSTITUENT}; then $(mkdir) -p $(bin)${CONSTITUENT}; fi
80        $(echo) "STRUCTURED_OUTPUT="$(bin)${CONSTITUENT}
81else
82${CONSTITUENT}dirs : ;
83endif
84
85ifneq ($(wildcard $(cmtexe)),)
86
87ifndef QUICK
88$(cmt_local_${CONSTITUENT}_makefile) :: $(${CONSTITUENT}_dependencies) dirs
89        $(echo) "(GNUmakefile) Building ${CONSTITUENT}.make"; \
90          $(cmtexe) -tag=$(tags) $(${CONSTITUENT}_extratags) build constituent_config -out=$(cmt_local_${CONSTITUENT}_makefile) ${CONSTITUENT}
91else
92$(cmt_local_${CONSTITUENT}_makefile) : $(${CONSTITUENT}_dependencies) dirs
93        if [ ! -f $@ ] || [ ! -f $(cmt_local_tagfile_${CONSTITUENT}) ] || \
94          [ ! -f $(cmt_final_setup_${CONSTITUENT}) ]; then \
95          test -z "$(cmtmsg)" || \
96          echo "$(CMTMSGPREFIX)" "(GNUmakefile) Building ${CONSTITUENT}.make"; \
97          $(cmtexe) -tag=$(tags) $(${CONSTITUENT}_extratags) build constituent_config -out=$(cmt_local_${CONSTITUENT}_makefile) ${CONSTITUENT}; \
98          fi
99endif
100
101else
102
103build_dependencies = test -f $(bin)CMT_setup.make || touch $(bin)CMT_setup.make ; echo
104#build_dependencies = test -d $(bin) || mkdir -p $(binshort); test -f $(cmtexe) || cp ../mgr/cmt_dependencies.make $(bin); test -f $(bin)CMT_setup.make || touch $(bin)CMT_setup.make ; echo
105
106${CONSTITUENT}_dependencies += $(bin)/cmt_dependencies.make
107
108$(bin)/cmt_dependencies.make : dirs
109        if [ ! -f $@ ]; then \
110          test -z "$(cmtmsg)" || \
111          echo "$(CMTMSGPREFIX)" "(GNUmakefile) Copying $(@F)"; \
112          \cp ${CMTROOT}/mgr/$(@F) $@; \
113          fi
114
115$(cmt_local_${CONSTITUENT}_makefile) :: $(${CONSTITUENT}_dependencies) dirs
116        if [ ! -f $@ ]; then \
117          test -z "$(cmtmsg)" || \
118          echo "$(CMTMSGPREFIX)" "(GNUmakefile) Copying $(@F)"; \
119          \cp ${CMTROOT}/mgr/$(@F) $@; \
120          fi
121
122endif
123
124${CONSTITUENT} :: $(${CONSTITUENT}_dependencies) $(cmt_local_${CONSTITUENT}_makefile) dirs ${CONSTITUENT}dirs
125        $(echo) "(GNUmakefile) Starting ${CONSTITUENT}"
126        @$(MAKE) -f $(cmt_local_${CONSTITUENT}_makefile) ${CONSTITUENT} cmt_local_tagfile_${CONSTITUENT}=${CMTROOT}/mgr/Unix.make cmt_final_setup_cmt=$(cmt_final_setup_cmt)
127        $(echo) "(GNUmakefile) ${CONSTITUENT} done"
128#-- end of constituent ------
129
130cmt_makefile = $(bin)cmt.make
131build_cmt_makefile : build_cmt_tagfile
132        @echo "Building $(cmt_local_${CONSTITUENT}_makefile)"; \
133          $(cmtexe) -tag=$(tags) $(${CONSTITUENT}_extratags) build constituent_makefile -out=$(cmt_local_${CONSTITUENT}_makefile) ${CONSTITUENT}
134
135build_cmt_tagfile : $(cmtexe)
136        @echo "Building $(cmt_local_tagfile)"; \
137          $(cmtexe) -tag=$(tags) build tag_makefile | grep -v '^CMTINSTALLAREA=' >$(cmt_local_tagfile)
138#---------------------------------------------------------
139
140#---------------------------------------------------------
141# This procedure installs a hook into the commitinfo management file.
142# then the
143#---------------------------------------------------------
144installcvs :
145        cd `echo ${CVSROOT} | cut -f4 -d':'`/CVSROOT;\
146        if [ "`grep cmt_buildcvsinfos loginfo`" = "" ] ; then \
147          echo "======== Configuring loginfo in `pwd`>>>>>> "; \
148          chmod u+w loginfo; \
149          echo '.cmtcvsinfos $${CVSROOT}/CVSROOT/cmt_buildcvsinfos2.sh' >> loginfo; \
150          chmod u-w loginfo; \
151        else \
152          echo "======== loginfo already configured in `pwd` >>>>>> "; \
153        fi; \
154        cp ${CMTROOT}/mgr/cmt_buildcvsinfos2.sh .; \
155        /bin/rm -rf ../.cmtcvsinfos/*
156
157#---------------------------------------------------------
158
159#---------------------------------------------------------
160###binaries = Linux OSF1 HP-UX VisualC
161##binaries = $(shell '/usr/bin/find ../ -name cmt.exe')
162
163
164#---------------------------------------------------------
165# Regenerates the Doxygen documentation of CMT
166# A priori as it is written it works at LAL only
167# The result is also transported to the Web site
168#---------------------------------------------------------
169doxygen ::
170        . /lal/Doxygen/Linux/setup.sh; cd ../doc; /bin/rm -Rf Doxygen; doxygen
171        ${CMTROOT}/mgr/cmt_export.sh CMT/ ${CMTROOT}/doc/Doxygen
172
173#---------------------------------------------------------
174# Converts CMTDoc.html CMTFAQ.html into pdf and ps
175#---------------------------------------------------------
176pdf ::
177        html2ps -nu -o ../doc/CMTDoc.ps ../doc/CMTDoc.html
178        ps2pdf ../doc/CMTDoc.ps ../doc/CMTDoc.pdf
179        html2ps -nu -o ../doc/CMTFAQ.ps ../doc/CMTFAQ.html
180        ps2pdf ../doc/CMTFAQ.ps ../doc/CMTFAQ.pdf
181
182#python = python
183python = /afs/cern.ch/sw/lcg/external/Python/2.3.4/rh73_gcc323/bin/python
184#python = /cygdrive/c/Arnault/Python23/python.exe
185
186#---------------------------------------------------------
187# Generates the html form of the doc from the XML form
188#---------------------------------------------------------
189gendoc ::
190        @cd ../doc; python gendoc.py CMTDoc.xml > CMTDoc.html
191        @echo "CMTDoc.html generated from CMTDoc.xml"
192
193
194#---------------------------------------------------------
195# Transfer the docs into the Web site.
196#---------------------------------------------------------
197docs ::
198        ${CMTROOT}/mgr/cmt_export.sh CMT/ ${CMTROOT}/doc/CMTDoc.html
199        ${CMTROOT}/mgr/cmt_export.sh CMT/ ${CMTROOT}/doc/CMTDoc.ps
200        ${CMTROOT}/mgr/cmt_export.sh CMT/ ${CMTROOT}/doc/CMTDoc.pdf
201        ${CMTROOT}/mgr/cmt_export.sh CMT/ ${CMTROOT}/doc/CMTFAQ.html
202        ${CMTROOT}/mgr/cmt_export.sh CMT/ ${CMTROOT}/doc/ReleaseNotes.html
203        ${CMTROOT}/mgr/cmt_export.sh CMT/ ${CMTROOT}/ChangeLog
204        ${CMTROOT}/mgr/cmt_export.sh CMT/ ${CMTROOT}/mgr/ChangeLog.php
205        ${CMTROOT}/mgr/cmt_export.sh CMT/ ${CMTROOT}/doc/CMTFAQ.ps
206        ${CMTROOT}/mgr/cmt_export.sh CMT/ ${CMTROOT}/doc/CMTFAQ.pdf
207
208#        echo '  <tr><td><a href="CMT-'$${version}'-1.i386.rpm">RPM for redhat 7.2</a></td></tr>' >>doc/CMTDownload.html;
209
210#---------------------------------------------------------
211# Construct the pacman file from the generic form
212#---------------------------------------------------------
213pacman ::
214        version=`cmt version`; \
215        sed -e 's#<version>#'"$${version}"'#g' CMT.pacman >CMT-$${version}.pacman
216
217#---------------------------------------------------------
218# Construct the tar balls for the binary kits for all
219# existing binaries available in ../*.cmt.exe
220# Binary kits are now autonomous (ie they don't require
221# the source kit)
222#---------------------------------------------------------
223bintar ::
224        cd ..; root=`pwd`; \
225        tag=`cmt version`; \
226        version=`basename $${root}`; \
227        tag=$${version} ; \
228        cat doc/CMTDownload1.html >| doc/CMTDownload.html; \
229        echo '  <tr><td><a href="CMT'$${version}'.tar.gz">Source kit</a> </td></tr>' >> doc/CMTDownload.html; \
230        binaries=`/usr/bin/find ./ -name cmt.exe | sed -e 's#[.]/##' -e 's#/.*##'`; \
231        for f in `echo $${binaries}`; do \
232          echo '  <tr><td><a href="CMT'$${version}$${f}'.tar.gz">'$${f}'</a> </td></tr>' >> doc/CMTDownload.html; \
233        done; \
234        cat doc/CMTDownload2.html >> doc/CMTDownload.html; \
235        ${CMTROOT}/mgr/cmt_export.sh CMT/ $${root}/doc/CMTDownload.html $${tag}; \
236        if test -d rpm; then \
237          ${CMTROOT}/mgr/cmt_export.sh CMT/ $${root}/rpm/CMT-$${version}-1.i386.rpm $${tag}; \
238        fi; \
239        cd ../../; \
240        for branch in `echo $${binaries}` ; \
241        do \
242          if test $${branch} = VisualC; then \
243            /bin/rm -rf CMT/$${version}/$${branch}/cmt ; \
244          else \
245            /bin/rm -rf CMT/$${version}/$${branch}/*.o ; \
246            ln -s cmt.exe CMT/$${version}/$${branch}/cmt ; \
247          fi ; \
248          echo $${branch} ; \
249          tarfile=CMT/CMT$${version}$${branch}.tar; \
250          tar cf $${tarfile} CMT/$${version}/mgr CMT/$${version}/src CMT/$${version}/$${branch} ; \
251          gzip $${tarfile}; \
252          ${CMTROOT}/mgr/cmt_export.sh CMT/ $${tarfile}.gz $${tag} ; \
253        done
254
255
256#----------------------------------------------------------
257#
258#  Building an RPM for CMT.
259#
260#   reinstallation is done by:
261#
262#  rpm -Uvh --relocate /CMT=/newdir/CMT CMT-${version}-1.i386.rpm
263#
264#----------------------------------------------------------
265rpm ::
266        version=`$(cmtexe) -quiet version`; \
267        tempdir=/tmp/CMT; \
268        rm -rf $${tempdir}; \
269        for f in BUILD RPMS SOURCES SPECS SRPMS ; do \
270          mkdir -p $${tempdir}/$${f}; \
271        done; \
272        (cd ../; tar cf $${tempdir}/SOURCES/CMT$${version}.tar --exclude mgr src source); \
273        gzip $${tempdir}/SOURCES/CMT$${version}.tar; \
274        if test ! -d ../rpm; then mkdir -p ../rpm; fi; \
275        rpmbuild -ba --define "_topdir $${tempdir}" --define "_version $${version}" CMT.spec; \
276        cp $${tempdir}/RPMS/i386/CMT-$${version}-1.i386.rpm ../rpm ; \
277        cp $${tempdir}/SRPMS/CMT-$${version}-1.src.rpm ../rpm ; \
278        rm -r $${tempdir}
279
280#
281#        cp CMT.spec $${tempdir}; \
282#        find ../fragments ../mgr ../src ! -path '*/CVS*' ! -name '*~' ! -type d | \
283#          sed -e 's#[.][.]#%{prefix}/%{version}#' >>$${tempdir}/CMT.spec ; \
284#
285
286
287#----------------------------------------------------------
288# Construct a source kit
289#----------------------------------------------------------
290srctar ::
291        ${CMTROOT}/mgr/cmt_tar_export.sh source mgr src Visual java doc
292
293
294#----------------------------------------------------------
295# Construct the kits
296#----------------------------------------------------------
297Export :: docs srctar bintar
298        @echo Export done
299
300democlean ::
301        /bin/rm -rf ../demo/*
302
303demo_location = ../demo
304demo_sequence = demo1
305
306#----------------------------------------------------------
307# Run the autotest sequence
308#----------------------------------------------------------
309demo :: democlean
310        @echo "------------------------------------------"
311        @echo "Starting general auto test sequence"
312        @echo "  Creating $(demo_location) work area..."
313        @mkdir -p $(demo_location)
314        @echo "  Creating all $(demo_sequence) packages..."
315        cd $(demo_location); \
316        version=`$(cmtexe) -quiet version`; \
317        ($(cmtexe) -quiet run_sequence ${CMTROOT}/src/demo/$(demo_sequence).cmt | \
318          sed -e "s#$${CMTROOT}#"'$${CMTROOT}'"#" \
319              -e "s#$${version}#"'$${version}'"#" \
320              -e "s#$${CMTCONFIG}#"'$${CMTCONFIG}'"#"; \
321          ) >$(demo_sequence).txt
322        @echo "  Comparing results with reference output (${CMTROOT}/src/demo/$(demo_sequence).out) ..."
323        @cd $(demo_location); \
324        diff $(demo_sequence).txt ${CMTROOT}/src/demo/$(demo_sequence).out; s=$$?; \
325        if test $${s} = 0; then \
326          echo "    => no differences"; \
327        else \
328          echo "    => errors?"; \
329          cp $(demo_sequence).txt ${CMTROOT}/src/demo/$(demo_sequence).out; \
330        fi
331
332#---------------------------------------------------------
333
334
335tprivate :: democlean
336        @echo "------------------------------------------"; \
337        sequence=tprivate; \
338        location=../demo; \
339        echo "Starting auto test sequence on private uses"; \
340        echo "  Creating $${location} work area..."; \
341        mkdir -p $${location}; \
342        cd $${location}; \
343        version=`$(cmtexe) -quiet version`; \
344        echo "  Creating all $${sequence} packages..."; \
345        ($(cmtexe) -quiet run_sequence ${CMTROOT}/src/demo/$${sequence}.cmt | \
346          sed -e "s#$${CMTROOT}#"'$${CMTROOT}'"#" \
347              -e "s#$${version}#"'$${version}'"#" \
348              -e "s#$${CMTCONFIG}#"'$${CMTCONFIG}'"#"; \
349          ) >$${sequence}.txt; \
350        echo "  Comparing results with reference output (${CMTROOT}/src/demo/$${sequence}.out) ..."; \
351        diff $${sequence}.txt ${CMTROOT}/src/demo/$${sequence}.out; s=$$?; \
352        if test $${s} = 0; then \
353          echo "    => no differences"; \
354        else \
355          echo "    => errors?"; \
356          cp $${sequence}.txt ${CMTROOT}/src/demo/$${sequence}.out; \
357        fi
358
359
360
361#---------------------------------------------------------
362
363help ::
364        @echo "------------------------------------------------------------"
365        @echo "  [all]      : Default target"
366        @echo "  "
367        @echo "  installcvs : "
368        @echo "  doxygen    : Documentation generation"
369        @echo "  docs       : Documentation production and installation"
370        @echo "  pdf        : Convert html docs into pdf and ps"
371        @echo "  gendoc     : Convert xml doc into html"
372        @echo "  srctar     : Production and installation of source tar-ball"
373        @echo "                (include Linux binary directory)"
374        @echo "  bintar     : Production and installation of binary tar-balls"
375        @echo "  rpm        : Production of the RPM"
376        @echo "  Export     : Installation in the web site"
377        @echo "  democlean  : Cleaning the demo area"
378        @echo "  demo       : Run the demo sequence on private uses"
379        @echo "      (Site-specific targets for building CMT)"
380        @echo "  LAL        : asc lx1 papou1-fe hp2 #virgo-control1"
381        @echo "  LHCB       : lxtest hpplus dxplus rsplus"
382        @echo "  Atlas      : atlinux atlas50"
383        @echo "  Virgo      : ax7 vmpc13a rio0a"
384        @echo "  CCIN2P3    : ccars ccahp ccali ccasn"
385        @echo "------------------------------------------------------------"
386
Note: See TracBrowser for help on using the repository browser.