[1] | 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 | |
---|
| 7 | include ${CMTROOT}/src/Makefile.core |
---|
| 8 | |
---|
| 9 | # |
---|
| 10 | # Basic tag management |
---|
| 11 | # |
---|
| 12 | ifdef tag |
---|
| 13 | CMTEXTRATAGS = $(tag) |
---|
| 14 | else |
---|
| 15 | tag = $(CMTCONFIG) |
---|
| 16 | endif |
---|
| 17 | |
---|
| 18 | tags = $(tag),$(CMTEXTRATAGS) |
---|
| 19 | |
---|
| 20 | ifdef READONLY |
---|
| 21 | cmt_local_tagfile = /tmp/CMT_$(tag).make$$$$ |
---|
| 22 | else |
---|
| 23 | cmt_local_tagfile = $(tag).make |
---|
| 24 | endif |
---|
| 25 | |
---|
| 26 | # |
---|
| 27 | # Generic entry points for all targets |
---|
| 28 | # |
---|
| 29 | all :: |
---|
| 30 | @$(cmtexe) check configuration; status=$$?; \ |
---|
| 31 | if test $${status} = 0; then \ |
---|
| 32 | /bin/rm -f $(cmt_local_tagfile); \ |
---|
| 33 | $(MAKE) --no-print-directory $(MAKEFLAGS) target="first config all" common_target; \ |
---|
| 34 | else \ |
---|
| 35 | echo "#CMT> There are configuration errors. Please correct them before running gmake"; \ |
---|
| 36 | fi |
---|
| 37 | |
---|
| 38 | binclean :: |
---|
| 39 | @if test ! "$(bin)" = "./"; then \ |
---|
| 40 | if test -d $(bin) ; then \ |
---|
| 41 | echo "------> (Makefile.header) Cleaning all from $(bin)"; \ |
---|
| 42 | /bin/rm -rf $(bin) ; \ |
---|
| 43 | fi ; \ |
---|
| 44 | fi |
---|
| 45 | |
---|
| 46 | clean :: |
---|
| 47 | @$(cmtexe) check configuration |
---|
| 48 | @$(MAKE) --no-print-directory target="$@" common_target |
---|
| 49 | |
---|
| 50 | .DEFAULT :: |
---|
| 51 | @$(cmtexe) check configuration |
---|
| 52 | @$(MAKE) --no-print-directory target="config $@" common_target |
---|
| 53 | |
---|
| 54 | # |
---|
| 55 | # Capture all possible targets |
---|
| 56 | # |
---|
| 57 | common_target :: |
---|
| 58 | @tmpdir=/tmp; \ |
---|
| 59 | if test ! "${TMPDIR}" = ""; then tmpdir=${TMPDIR}; fi; \ |
---|
| 60 | cmt_lock_pid=`mktemp $${tmpdir}/CMT_XXXXXX | sed -e 's#'"$${tmpdir}"'/CMT_##'`; \ |
---|
| 61 | temp_marker=$${tmpdir}/CMT_$${cmt_lock_pid}; \ |
---|
| 62 | temp_lock=$${tmpdir}/CMT_lock$${cmt_lock_pid}.make; \ |
---|
| 63 | temp_constituents=$${tmpdir}/CMT_constituents$${cmt_lock_pid}; \ |
---|
| 64 | if test ! "${CMTMAKEDEBUG}" = 1; then\ |
---|
| 65 | trap '/bin/rm -f $${temp_lock} $${temp_constituents} $${temp_marker}; exit $${status}' 0 1 2 15; \ |
---|
| 66 | fi; \ |
---|
| 67 | /bin/rm -f $${temp_marker}; \ |
---|
| 68 | /bin/rm -f $${temp_lock}; \ |
---|
| 69 | echo "------> (Makefile.header) Rebuilding constituents.make"; \ |
---|
| 70 | $(cmtexe) -quiet -tag=$(tags) build constituents_makefile -out=$${temp_constituents}; status=$$?; \ |
---|
| 71 | if test $${status} = 0; then \ |
---|
| 72 | /bin/rm -f $(cmt_local_tagfile); \ |
---|
| 73 | $(MAKE) --no-print-directory -f $${temp_constituents} cmt_lock_pid=$${cmt_lock_pid} $(target); \ |
---|
| 74 | status=$$?; \ |
---|
| 75 | else \ |
---|
| 76 | echo "#CMT> Error generating constituents makefile"; \ |
---|
| 77 | fi; \ |
---|
| 78 | exit $${status} |
---|
| 79 | |
---|
| 80 | |
---|
| 81 | # |
---|
| 82 | # Ancient mechanism for remote launchers (kept for backward compatibility) |
---|
| 83 | # |
---|
| 84 | $(gmake_hosts) :: |
---|
| 85 | rsh $@ "sh -c '(cd `$(cmtexe) show pwd -quiet`; . setup.sh; gmake $(MAKEFLAGS) $(target))'" |
---|
| 86 | |
---|
| 87 | $(make_hosts) :: |
---|
| 88 | rsh $@ "sh -c '(cd `$(cmtexe) show pwd`; . setup.sh; make $(MAKEFLAGS) $(target))'" |
---|
| 89 | |
---|
| 90 | |
---|
| 91 | everywhere :: $(everywhere) |
---|
| 92 | |
---|
| 93 | # |
---|
| 94 | # Display all targets |
---|
| 95 | # |
---|
| 96 | help :: |
---|
| 97 | @echo '--------------------------------------------------------------------------' |
---|
| 98 | @echo 'You may select one of the following make targets :' |
---|
| 99 | @echo ' ' |
---|
| 100 | @echo 'help : this help' |
---|
| 101 | @echo 'all : rebuild all constituents according to the $$(constituents) macro' |
---|
| 102 | @echo ' (this is the default target)' |
---|
| 103 | @echo 'clean : remove everything that can be rebuilt' |
---|
| 104 | @echo 'binclean : fast erase of the binary directory' |
---|
| 105 | @echo ' ' |
---|
| 106 | @groups=`$(cmtexe) show groups -quiet -tag=$(tags)`; \ |
---|
| 107 | for g in $${groups}; do \ |
---|
| 108 | echo "$${g} : rebuild all constituents of group $${g}"; \ |
---|
| 109 | done |
---|
| 110 | @echo "Constituents:"; \ |
---|
| 111 | for c in `$(cmtexe) show constituent_names -quiet -tag=$(tags)` ; do \ |
---|
| 112 | echo " $${c} $${c}clean"; \ |
---|
| 113 | done |
---|
| 114 | @echo ' ' |
---|
| 115 | @echo 'check :' |
---|
| 116 | @echo ' run all applications defined with the -check option' |
---|
| 117 | @echo ' ' |
---|
| 118 | |
---|
| 119 | |
---|