source: CMT/v1r23/src/Makefile.header @ 615

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

See C.L. 432

  • Property svn:eol-style set to native
File size: 5.0 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#
33#ifndef QUICK
34#all :: check_config ;
35#else
36#all :: no_check_config ;
37#endif
38#all :: $(cmt_constituents_makefile)
39#       @$(MAKE) --no-print-directory -f $(cmt_constituents_makefile) $@
40default :: all ;
41
42check_config ::
43        @$(cmtexe) check configuration; retval=$$?; \
44        if test $${retval} -ne 0; then \
45          test -z "$(cmtmsg)" || \
46          echo "$(CMTMSGPREFIX)" "(Makefile.header) Configuration error(s). Please correct" >&2; \
47        fi; exit $${retval}
48
49#       @$(cmtexe) check configuration; retval=$$?; \
50#       if test $${retval} = 0; then \
51#         $(MAKE) --no-print-directory target="all" common_target; \
52#       else \
53#         test -z "$(cmtmsg)" || \
54#         echo "$(CMTMSGPREFIX)" "(Makefile.header) Configuration error(s). Please correct" >&2; \
55#       fi
56
57#no_check_config ::
58#       @$(MAKE) --no-print-directory target="all" common_target
59
60binclean ::
61        if test ! "$(bin)" = "./"; then \
62          if test -d $(bin) ; then \
63            test -z "$(cmtmsg)" || \
64            echo "$(CMTMSGPREFIX)" "(Makefile.header) Removing binary directory $(bin)"; \
65            \rm -rf $(bin) ; \
66          fi ; \
67        fi
68
69#clean uninstall :: check_config
70#       @$(MAKE) --no-print-directory -f $(cmt_constituents_makefile) $@
71#       @$(cmtexe) check configuration
72#       @$(MAKE) --no-print-directory target="$@" common_target
73
74.DEFAULT ::
75        @$(MAKE) $(cmt_constituents_makefile)
76        @$(MAKE) --no-print-directory -f $(cmt_constituents_makefile) $@
77
78#       @$(cmtexe) check configuration
79#       @$(MAKE) --no-print-directory target="$@" common_target
80#       @$(MAKE) --no-print-directory target="config $@" common_target
81
82#
83#  Capture all possible targets
84#
85#common_target : $(cmt_constituents_makefile)
86#       @$(MAKE) --no-print-directory -f $(cmt_constituents_makefile) $(target)
87
88#$(cmt_constituents_makefile) : $(cmt_local_tagfile)
89
90ifndef QUICK
91$(cmt_constituents_makefile) : check_config
92else
93$(cmt_constituents_makefile) :
94endif
95        $(echo) "(Makefile.header) Rebuilding $@"; \
96          if test ! -d $(@D) ; then $(mkdir) -p $(@D); fi; \
97          $(cmtexe) -tag=$(tags) build constituents_config -out=$@; \
98          retval=$$?; \
99          if test $${retval} -ne 0; then \
100            test -z "$(cmtmsg)" || \
101            echo "$(CMTMSGPREFIX)" "(Makefile.header) Cannot generate $@" >&2; \
102            \rm -f $@; \
103          fi; \
104          exit $${retval}
105
106ifndef QUICK
107$(cmt_local_tagfile) ::
108else
109$(cmt_local_tagfile) :
110endif
111        $(echo) "(Makefile.header) Rebuilding $@"; \
112          if test -f $@; then rm -f $@; fi; \
113          if test ! -d $(@D); then $(mkdir) -p $(@D); fi; \
114          $(cmtexe) -tag=$(tags) build tag_makefile >$@
115        $(echo) "(Makefile.header) Rebuilding $(cmt_final_setup)"; \
116          test ! -f $(cmt_local_setup) || \rm -f $(cmt_local_setup); \
117          trap '\rm -f $(cmt_local_setup)' 0 1 2 15; \
118          $(cmtexe) -tag=$(tags) show setup >$(cmt_local_setup) && \
119          if [ -f $(cmt_final_setup) ] && \
120            \cmp -s $(cmt_final_setup) $(cmt_local_setup); then \
121            \rm $(cmt_local_setup); else \
122            \mv -f $(cmt_local_setup) $(cmt_final_setup); fi
123
124#
125#  Ancient mechanism for remote launchers (kept for backward compatibility)
126#
127$(gmake_hosts) ::
128        rsh $@ "sh -c '(cd `$(cmtexe) show pwd`; . setup.sh; gmake $(MAKEFLAGS) $(target))'"
129
130$(make_hosts) ::
131        rsh $@ "sh -c '(cd `$(cmtexe) show pwd`; . setup.sh; make $(MAKEFLAGS) $(target))'"
132
133
134everywhere :: $(everywhere)
135
136#
137#   Display all targets
138#
139help ::
140        @echo '--------------------------------------------------------------------------'
141        @echo 'You may select one of the following make targets :'
142        @echo ' '
143        @echo 'help        : this help'
144        @echo 'all         : rebuild all constituents according to the $$(constituents) macro'
145        @echo '              (this is the default target)'
146        @echo 'clean       : remove everything that can be rebuilt'
147        @echo 'binclean    : fast erase of the binary directory'
148        @echo 'uninstall   : remove everything installed in the installation area'
149        @echo ' '
150        @groups=`$(cmtexe) show groups -tag=$(tags)`; \
151          for g in $${groups}; do \
152            echo "$${g} : rebuild all constituents of group $${g}"; \
153          done
154        @echo "Constituents:"; \
155          for c in `$(cmtexe) show constituent_names -tag=$(tags)` ; do \
156            echo "  $${c}  $${c}clean  $${c}uninstall"; \
157          done
158        @echo ' '
159        @echo 'check :'
160        @echo '              run all applications defined with the -check option'
161        @echo ' '
162
163
164# explicit rule not to remake
165${CMTROOT}/src/Makefile.header : ;
166
167# for multiple command line goals,
168# avoid race conditions when (re)writing constituents.make
169.NOTPARALLEL :
Note: See TracBrowser for help on using the repository browser.