#----------------------------------------------------------- # 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 check_config :: @$(cmtexe) check configuration; retval=$$?; \ if test $${retval} = 0; then \ $(MAKE) --no-print-directory target="all" common_target; \ else \ echo "#CMT> There are configuration errors. Please correct them before running gmake"; \ 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)"; \ /bin/rm -rf $(bin) ; \ fi ; \ fi clean :: @$(cmtexe) check configuration @$(MAKE) --no-print-directory target="$@" common_target .DEFAULT :: @$(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) # @$(MAKE) --no-print-directory -f $< cmt_lock_pid=$(cmt_lock_pid) $(target) $(cmt_constituents_makefile) : $(cmt_local_tagfile) $(echo) "(Makefile.header) Rebuilding $@"; \ if test ! -d $(@D) ; then $(mkdir) -p $(@D); fi; \ $(cmtexe) -tag=$(tags) build constituents_makefile -out=$@; \ retval=$$?; \ if test $${retval} != 0; then \ echo "#CMT> Error: $@: Cannot generate" >&2; \ /bin/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 # && /bin/echo $@ ok # $(echo) CMTCONFIG=$(CMTCONFIG) ; \ # # # 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 : ;