#----------------------------------------------------------- # Copyright Christian Arnault LAL-Orsay CNRS # arnault@lal.in2p3.fr # See the complete license in cmt_license.txt "http://www.cecill.info". #----------------------------------------------------------- include ${CMTROOT}/src/Makefile.core # # Basic tag management # ifdef tag CMTEXTRATAGS = $(tag) else tag = $(CMTCONFIG) endif tags = $(tag),$(CMTEXTRATAGS) cmt_local_tagfile = $(bin)$(tag).make cmt_constituents_makefile = $(bin)constituents.make cmt_local_setup = $(bin)setup$$$$.make #cmt_local_setup = $(bin)$(package)setup$$$$.make #cmt_final_setup = $(bin)${PACKAGE}setup.make cmt_final_setup = $(bin)setup.make #cmt_final_setup = $(bin)$(package)setup.make # # Generic entry points for all targets # #ifndef QUICK #all :: check_config ; #else #all :: no_check_config ; #endif #all :: $(cmt_constituents_makefile) # @$(MAKE) --no-print-directory -f $(cmt_constituents_makefile) $@ default :: all ; check_config :: @$(cmtexe) check configuration; retval=$$?; \ if test $${retval} -ne 0; then \ test -z "$(cmtmsg)" || \ echo "$(CMTMSGPREFIX)" "(Makefile.header) Configuration error(s). Please correct" >&2; \ fi; exit $${retval} # @$(cmtexe) check configuration; retval=$$?; \ # if test $${retval} = 0; then \ # $(MAKE) --no-print-directory target="all" common_target; \ # else \ # test -z "$(cmtmsg)" || \ # echo "$(CMTMSGPREFIX)" "(Makefile.header) Configuration error(s). Please correct" >&2; \ # fi #no_check_config :: # @$(MAKE) --no-print-directory target="all" common_target binclean :: if test ! "$(bin)" = "./"; then \ if test -d $(bin) ; then \ test -z "$(cmtmsg)" || \ echo "$(CMTMSGPREFIX)" "(Makefile.header) Removing binary directory $(bin)"; \ \rm -rf $(bin) ; \ fi ; \ fi #clean uninstall :: check_config # @$(MAKE) --no-print-directory -f $(cmt_constituents_makefile) $@ # @$(cmtexe) check configuration # @$(MAKE) --no-print-directory target="$@" common_target .DEFAULT :: @$(MAKE) $(cmt_constituents_makefile) @$(MAKE) --no-print-directory -f $(cmt_constituents_makefile) $@ # @$(cmtexe) check configuration # @$(MAKE) --no-print-directory target="$@" common_target # @$(MAKE) --no-print-directory target="config $@" common_target # # Capture all possible targets # #common_target : $(cmt_constituents_makefile) # @$(MAKE) --no-print-directory -f $(cmt_constituents_makefile) $(target) #$(cmt_constituents_makefile) : $(cmt_local_tagfile) ifndef QUICK $(cmt_constituents_makefile) : check_config else $(cmt_constituents_makefile) : endif $(echo) "(Makefile.header) Rebuilding $@"; \ if test ! -d $(@D) ; then $(mkdir) -p $(@D); fi; \ $(cmtexe) -tag=$(tags) build constituents_config -out=$@; \ retval=$$?; \ if test $${retval} -ne 0; then \ test -z "$(cmtmsg)" || \ echo "$(CMTMSGPREFIX)" "(Makefile.header) Cannot generate $@" >&2; \ \rm -f $@; \ fi; \ exit $${retval} ifndef QUICK $(cmt_local_tagfile) :: else $(cmt_local_tagfile) : endif $(echo) "(Makefile.header) Rebuilding $@"; \ if test -f $@; then rm -f $@; fi; \ if test ! -d $(@D); then $(mkdir) -p $(@D); fi; \ $(cmtexe) -tag=$(tags) build tag_makefile >$@ $(echo) "(Makefile.header) Rebuilding $(cmt_final_setup)"; \ test ! -f $(cmt_local_setup) || \rm -f $(cmt_local_setup); \ trap '\rm -f $(cmt_local_setup)' 0 1 2 15; \ $(cmtexe) -tag=$(tags) show setup >$(cmt_local_setup) && \ if [ -f $(cmt_final_setup) ] && \ \cmp -s $(cmt_final_setup) $(cmt_local_setup); then \ \rm $(cmt_local_setup); else \ \mv -f $(cmt_local_setup) $(cmt_final_setup); fi # # Ancient mechanism for remote launchers (kept for backward compatibility) # $(gmake_hosts) :: rsh $@ "sh -c '(cd `$(cmtexe) show pwd`; . setup.sh; gmake $(MAKEFLAGS) $(target))'" $(make_hosts) :: rsh $@ "sh -c '(cd `$(cmtexe) show pwd`; . setup.sh; make $(MAKEFLAGS) $(target))'" everywhere :: $(everywhere) # # Display all targets # help :: @echo '--------------------------------------------------------------------------' @echo 'You may select one of the following make targets :' @echo ' ' @echo 'help : this help' @echo 'all : rebuild all constituents according to the $$(constituents) macro' @echo ' (this is the default target)' @echo 'clean : remove everything that can be rebuilt' @echo 'binclean : fast erase of the binary directory' @echo 'uninstall : remove everything installed in the installation area' @echo ' ' @groups=`$(cmtexe) show groups -tag=$(tags)`; \ for g in $${groups}; do \ echo "$${g} : rebuild all constituents of group $${g}"; \ done @echo "Constituents:"; \ for c in `$(cmtexe) show constituent_names -tag=$(tags)` ; do \ echo " $${c} $${c}clean $${c}uninstall"; \ done @echo ' ' @echo 'check :' @echo ' run all applications defined with the -check option' @echo ' ' # explicit rule not to remake ${CMTROOT}/src/Makefile.header : ; # for multiple command line goals, # avoid race conditions when (re)writing constituents.make .NOTPARALLEL :