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

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

See C.L. 422

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