source: CMT/HEAD/src/Makefile.header @ 487

Last change on this file since 487 was 487, checked in by rybkin, 15 years ago

See C.L. 382

  • Property svn:eol-style set to native
File size: 4.3 KB
Line 
1#-----------------------------------------------------------
2# Copyright Christian Arnault LAL-Orsay CNRS
3# arnault@lal.in2p3.fr
4# See the complete license in cmt_license.txt "http://www.cecill.info".
5#-----------------------------------------------------------
6
7include ${CMTROOT}/src/Makefile.core
8
9#
10#  Basic tag management
11#
12ifdef tag
13CMTEXTRATAGS = $(tag)
14else
15tag       = $(CMTCONFIG)
16endif
17
18tags      = $(tag),$(CMTEXTRATAGS)
19
20cmt_local_tagfile = $(bin)$(tag).make
21
22cmt_constituents_makefile = $(bin)constituents.make
23
24cmt_local_setup = $(bin)setup$$$$.make
25#cmt_local_setup = $(bin)$(package)setup$$$$.make
26#cmt_final_setup = $(bin)${PACKAGE}setup.make
27cmt_final_setup = $(bin)setup.make
28#cmt_final_setup = $(bin)$(package)setup.make
29
30#
31#  Generic entry points for all targets
32#
33ifndef QUICK
34all :: check_config ;
35else
36all :: no_check_config ;
37endif
38
39check_config ::
40        @$(cmtexe) check configuration; retval=$$?; \
41        if test $${retval} = 0; then \
42          $(MAKE) --no-print-directory target="all" common_target; \
43        else \
44          echo "#CMT> There are configuration errors. Please correct them before running gmake"; \
45        fi
46
47no_check_config ::
48        @$(MAKE) --no-print-directory target="all" common_target
49
50binclean ::
51        if test ! "$(bin)" = "./"; then \
52          if test -d $(bin) ; then \
53            test -z "$(cmtmsg)" || \
54            echo "$(CMTMSGPREFIX)" "(Makefile.header) Removing binary directory $(bin)"; \
55            /bin/rm -rf $(bin) ; \
56          fi ; \
57        fi
58
59clean ::
60        @$(cmtexe) check configuration
61        @$(MAKE) --no-print-directory target="$@" common_target
62
63.DEFAULT ::
64        @$(cmtexe) check configuration
65        @$(MAKE) --no-print-directory target="$@" common_target
66#       @$(MAKE) --no-print-directory target="config $@" common_target
67
68#
69#  Capture all possible targets
70#
71common_target : $(cmt_constituents_makefile)
72        @$(MAKE) --no-print-directory -f $(cmt_constituents_makefile) $(target)
73#       @$(MAKE) --no-print-directory -f $< cmt_lock_pid=$(cmt_lock_pid) $(target)
74
75$(cmt_constituents_makefile) : $(cmt_local_tagfile)
76        $(echo) "(Makefile.header) Rebuilding $@"; \
77          if test ! -d $(@D) ; then $(mkdir) -p $(@D); fi; \
78          $(cmtexe) -tag=$(tags) build constituents_makefile -out=$@; \
79          retval=$$?; \
80          if test $${retval} != 0; then \
81          echo "#CMT> Error: $@: Cannot generate" >&2; \
82          /bin/rm -f $@; fi; \
83          exit $${retval}
84
85ifndef QUICK
86$(cmt_local_tagfile) ::
87else
88$(cmt_local_tagfile) :
89endif
90        $(echo) "(Makefile.header) Rebuilding $@"; \
91          if test -f $@; then rm -f $@; fi; \
92          if test ! -d $(@D); then $(mkdir) -p $(@D); fi; \
93          $(cmtexe) -tag=$(tags) build tag_makefile >$@
94        $(echo) "(Makefile.header) Rebuilding $(cmt_final_setup)"; \
95          test ! -f $(cmt_local_setup) || \rm -f $(cmt_local_setup); \
96          trap '\rm -f $(cmt_local_setup)' 0 1 2 15; \
97          $(cmtexe) -tag=$(tags) show setup >$(cmt_local_setup) && \
98          if [ -f $(cmt_final_setup) ] && \
99            \cmp -s $(cmt_final_setup) $(cmt_local_setup); then \
100            \rm $(cmt_local_setup); else \
101            \mv -f $(cmt_local_setup) $(cmt_final_setup); fi
102
103#         && /bin/echo $@ ok   
104#       $(echo) CMTCONFIG=$(CMTCONFIG) ; \
105#
106
107#
108#  Ancient mechanism for remote launchers (kept for backward compatibility)
109#
110$(gmake_hosts) ::
111        rsh $@ "sh -c '(cd `$(cmtexe) show pwd`; . setup.sh; gmake $(MAKEFLAGS) $(target))'"
112
113$(make_hosts) ::
114        rsh $@ "sh -c '(cd `$(cmtexe) show pwd`; . setup.sh; make $(MAKEFLAGS) $(target))'"
115
116
117everywhere :: $(everywhere)
118
119#
120#   Display all targets
121#
122help ::
123        @echo '--------------------------------------------------------------------------'
124        @echo 'You may select one of the following make targets :'
125        @echo ' '
126        @echo 'help        : this help'
127        @echo 'all         : rebuild all constituents according to the $$(constituents) macro'
128        @echo '              (this is the default target)'
129        @echo 'clean       : remove everything that can be rebuilt'
130        @echo 'binclean    : fast erase of the binary directory'
131        @echo 'uninstall   : remove everything installed in the installation area'
132        @echo ' '
133        @groups=`$(cmtexe) show groups -tag=$(tags)`; \
134          for g in $${groups}; do \
135            echo "$${g} : rebuild all constituents of group $${g}"; \
136          done
137        @echo "Constituents:"; \
138          for c in `$(cmtexe) show constituent_names -tag=$(tags)` ; do \
139            echo "  $${c}  $${c}clean  $${c}uninstall"; \
140          done
141        @echo ' '
142        @echo 'check :'
143        @echo '              run all applications defined with the -check option'
144        @echo ' '
145
146
147# explicit rule not to remake
148${CMTROOT}/src/Makefile.header : ;
Note: See TracBrowser for help on using the repository browser.