source: CMT/HEAD/mgr/GNUmakefile @ 560

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

See C.L. 443

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