# standard.mk # #GNUmakefile fragment for use with the BaBar versioning system # # Architecture specific macros are defined in arch_spec.mk # Architecture specific code is handled here in standard.mk # # see also GNUmakefile.example in the SoftRelTools package # for an example of how to use this. # # Bob Jacobsen, December 1994 # # 11/12/95 T. Wenaus # - Modify rules to read dependency makefiles to not print complaints # about .d files not existing (-include) # - Add printout of what's going on for default 'quiet' case # - Add tests for file existence before attempting to use the file, # to eliminate error messages # - Protect ln -s against file existing already # # 19970911 kreymer@fnal.gov # - Added AIX use of FCPPFLAGS versus CPPFLAGS in .F.o # # 19971208 jonckheere@fnal.gov # - Added test target for testing of packages # # 19982607 rasmus@fnal.gov, ruth@fnal.gov # - Added library subdir's in the tmp area for KCC_3_3 only # # 19981012 amundson@fnal.gov # - Added support for making subpackages with distinct temp areas. # # 19981014 russo@fnal.gov # - Fixed above change so that the order specified in # SUBDIRS is respected for D0. # ############################################################# # # Variables used to define specific products: # # INC include file products (no rules yet) # LIB library products # LIBFFILES FORTRAN source to compile into library # LIBF90FILES FORTRAN-90 source to compile into library # LIBCFILES C source to compile into library # LIBCCFILES .cc C++ source to compile into library # LIBCXXFILES .cxx C++ source to compile into library # LIBCPPFILES .cpp C++ source to compile into library # # list of files from which we make .o rather than .a files # OBJCCFILES - .cc files # OBJCXXFILES - .cxx files # OBJCPPFILES - .cpp files # OBJCFILES - .c files # OBJFFILES - fortran files # It is usually a good idea to filter the files specified in the # above variabless out of source files that are to be compiled into # libraries, for example: # # LIBCPPFILES = $(filter-out $(OBJCPPFILES), $(wildcard *.cpp)) # # These are the Flag variables used: # # FCFLAGS Flags for the FORTRAN-77 compiler # F90CFLAGS Flags for the FORTRAN-90 compiler # Note: F-90 does _not_ use the FCFLAGS # FCPPFLAGS Fortran pre-processing flags # LDFLAGS loader flags (mostly -L directives) # ARFLAGS Flags for the archiver # CPPFLAGS The only strings this should contain are -D and -I # directives. It is used in all compilation and preprocessor # phases, and these are the only directives common to all. # CPPMFLAGS preprocessor (CPP) flags used only while making .d files # CXXFLAGS C++ compiler only flags, NOT used during .d generation # CXXCFLAGS C++ flags common to both .d generation and compilation # CCFLAGS C compiler only flags # FCFLAGS F77 compiler flags only # F90CFLAGS F90 compiler flags only # FCPPMFLAGS F77 compiler flags used only while making .d files # # Variables used for the various build utilities # # CXX Name of the c++ compiler # CC Name of the c compiler # CPP Name of the c or c++ compiler used to make .d files # FPP Name of the fortran preprocessor to use to make .d files # FC Name of the f77 compiler # F90C Name of the fortran 90 compiler # AR Name of the archive program # # DOCS, MANPAGES Files to copy to appropriate directories # BINS executable products # TBINS executable products used for testing # SUBDIRS directories which should do recursive MAKEs # # Variables used to define destinations (note lower case): # # includedir constructed include files # libdir .a products # bindir executable products # workdir .o and .d files # mandir man files # docdir documentation # # General purpose targets: # include create any include files needed # lib build libraries # bin build executables # tbin build executables used for testing # check do installation checks # (Note that by doing include for all packages, then lib for all packages, # then bin, you avoid worrying about dependency order.) # all include, lib, bin # .lib 'lib' request on the named subdirectory # .bin 'bin' request on the named subdirectory # .tbin 'tbin' request on the named subdirectory # clean remove *~, *.d, *.o, and everything the package installs. # man man pages. This is also included in the bin target # doc documentation. This is also included in the bin target # # ifdef DEBUG0 COMMAND := $(shell echo "<**newdir**> $(shell /bin/pwd) $(shell /bin/date)" >&2 ) endif ############################################################ # Architecture Specific Information ############################################################ include SoftRelTools/arch_spec.mk include SoftRelTools/config/arch_spec_site.mk ############################################################ # standard definitions ############################################################ # define standard directories: libdir bindir includedir # It is EXPECTED that these will be overridden in the command line. # Note that these are _destination_ directories - see below for # search path directories libdir := $(shell /bin/pwd)/ bindir := $(shell /bin/pwd)/ includedir := $(shell /bin/pwd)/ # workdir is the host-specific location for creating # object files (if needed) and include dependency (.d) files workdir := $(shell /bin/pwd)/ # mandir and workdir point at tmp to avoid overwriting files # is nothing has been specified mandir := /tmp/ docdir := /tmp/ # standard definitions for external symbols SHELL = /bin/sh ifeq ($(strip $(F90C)),) ifneq (,$(findstring AIX,$(BFARCH))) F90C = xlf90 else F90C = f90 endif endif curdir := $(shell /bin/pwd) moddir := $(libdir)$(F90C)/ ifeq ($(F90C),xlf90) IDLFLAGS = -Wb,xlf90 else IDLFLAGS = endif ifndef $(FIDLE) FIDLE := f90idl endif override F90CFLAGS += -I$(libdir)$(F90C) ifdef PackageLibs LOADLIBES += $(shell linklistSRT $(PackageLibs)) endif ############################################################ # standard targets ############################################################ .PHONY: all inc include idl lib bin tbin check test clean man doc debugmake installtmpdir # all references from here on to $(LIB) should get a fully qualified name ifdef LIB LIBNAME := $(subst .a,,$(LIB)) LIB := $(libdir)$(LIB) endif ifdef SHAREDLIB LIBNAME := $(basename $(SHAREDLIB)) SHAREDLIB := $(libdir)/$(LIBNAME)$(SHAREDEXT) endif ifneq (D0,$(EXPERIMENT)) # Checking all specified directories exist ifdef SUBDIRS ORIGINALSUBDIRS:=$(sort $(SUBDIRS)) AVAILABLEDIRS := $(shell ls -F | grep "/" | sed 's/\///') temp := $(filter $(AVAILABLEDIRS),$(ORIGINALSUBDIRS)) SUBDIRS := $(sort $(temp)) DIFFDIRS := $(filter-out $(SUBDIRS),$(ORIGINALSUBDIRS)) endif else ifdef SUBDIRS ORIGINALSUBDIRS := $(SUBDIRS) AVAILABLEDIRS := $(shell ls -F | grep "/" | sed 's/\///') SUBDIRS := $(filter $(AVAILABLEDIRS),$(SUBDIRS)) DIFFDIRS := $(filter-out $(SUBDIRS),$(ORIGINALSUBDIRS)) endif endif # The variable SUBPACKAGE is defined iff we are using subpackages. # If so, modify the temporary directory for .o and .d files. ifdef SUBPACKAGE override workdir := $(workdir)$(SUBPACKAGE)/ endif ifneq (D0,$(EXPERIMENT)) all: @echo "<**all**>" @$(MAKE) include @$(MAKE) lib @$(MAKE) bin @$(MAKE) check else all: @echo "<**all**> `date`" @echo "<**include**> `date`" @$(MAKE) include @echo "<**lib**> `date`" @$(MAKE) lib @echo "<**bin**> `date`" @$(MAKE) bin @echo "<**check**> `date`" @$(MAKE) check endif debugmake: @echo origdir = $(ORIGINALSUBDIRS) @echo avadir = $(AVAILABLEDIRS) @echo subdir = $(SUBDIRS) @echo SHAREDLIB = $(SHAREDLIB) @echo SHAREDEXT = $(SHAREDEXT) installtmpdir: $(foreach v,$(SUBDIRS),$v.installtmpdir) if [ ! -d $(workdir) ] ; then mkdir $(workdir); fi inc: $(INC) $(foreach v,$(SUBDIRS),$v.inc) #@echo inc stage done in $(curdir) include:$(foreach v,$(SUBDIRS),$v.include) #@echo ***inc stage done in $(curdir) idl: $(IDLFILES) $(foreach v,$(SUBDIRS),$v.idl) #@echo idl stage done in $(curdir) lib: $(LIB) $(foreach v,$(SUBDIRS),$v.lib) $(SHAREDLIB) $(foreach v,$(SUBDIRS),$v.lib) #@echo lib stage done in $(curdir) bin: $(foreach v,$(BINS),$(bindir)$v) $(foreach v,$(SUBDIRS),$v.bin) #@echo bin stage done in $(curdir) tbin: $(foreach v,$(TBINS),$(bindir)$v) $(foreach v,$(SUBDIRS),$v.tbin) #@echo tbin stage done in $(curdir) check: @if [ "$(DIFFDIRS)" != "" ]; then \ echo "Warning : Module(s) $(DIFFDIRS) not available" ; \ fi test: $(foreach v,$(SUBDIRS),$v.test) #@echo test stage done in $(curdir) clean: $(foreach v,$(SUBDIRS),$v.clean) rm -f *~ find $(workdir) -name "*.d" | xargs rm -f find $(workdir) -name "*.o" | xargs rm -f find $(workdir) -name "ti_files" | xargs rm -rf find $(workdir) -name "ii_files" | xargs rm -rf find . -name "ti_files" | xargs rm -rf find . -name "ii_files" | xargs rm -rf find $(bindir) -name "ti_files" | xargs rm -rf find $(bindir) -name "ii_files" | xargs rm -rf find $(libdir) -name "ti_files" | xargs rm -rf find $(libdir) -name "ii_files" | xargs rm -rf rm -f $(foreach v,$(BINS),$(bindir)$v) rm -f $(foreach v,$(TBINS),$(bindir)$v) rm -f $(LIB) rm -f $(SHAREDLIB) rm -f $(MANS_IN_DIRS) rm -f $(foreach v,$(DOCS),$(docdir)$v) MANS_IN_DIRS := $(foreach ext,1 2 3 4 5 6 7 8,\ $(addprefix $(mandir)man$(ext)/,$(filter %.$(ext),$(MANPAGES)))) man: $(MANS_IN_DIRS) doc: $(foreach v,$(DOCS),$(docdir)$v) ifeq (D0,$(EXPERIMENT)) # make it an error to override the doc phase endif # # Install all of the man pages # $(MANS_IN_DIRS) : $(MANPAGES) rm -f $@ if [ ! -d $(@D) ] ; then mkdir $(@D); fi cp $(@F) $@ chmod 444 $@ $(foreach v,$(DOCS),$(docdir)$v): $(DOCS) rm -f $@ if [ ! -d $(@D) ] ; then mkdir $(@D); fi cp $(@F) $@ chmod 444 $@ # add doc and man to bin # bin: doc man echo_%: @echo "$(subst echo_,,$@) = $($(subst echo_,,$@))" ############################################################ # search orders ############################################################ # Note that CPPFLAGS should already have the .c and .cc include search path # and LDFLAGS should have the library search path # Because $(LIB) is a fully qualified target (i.e. pathname), we can # allow searching for .a and .so - otherwise, if $(libdir)$(LIB) had # not already existed, we'd have found (and used as a dependency) # the one referenced via $BFCURRENT # vpath %.a $(patsubst -L%,%,$(filter -L%,$(LDFLAGS))) vpath %.so $(patsubst -L%,%,$(filter -L%,$(LDFLAGS))) # Make knows that -lfoo can mean libfoo.a, but it doesn't know that # it can mean libfoo.so. This fixes that. -l%: lib%.so vpath %.o $(workdir) vpath %.mod $(moddir) # the following are for finding .h, .hpp, .ipp , .inc and .mod files in # .d lists make by awk, which does not put in full pathnames vpath %.h $(patsubst -I%,%,$(filter -I%,$(CPPFLAGS))) vpath %.hpp $(patsubst -I%,%,$(filter -I%,$(CPPFLAGS))) vpath %.ipp $(patsubst -I%,%,$(filter -I%,$(CPPFLAGS))) vpath %.inc $(patsubst -I%,%,$(filter -I%,$(CPPFLAGS))) vpath %.mod $(patsubst -I%,%,$(filter -I%,$(F90CFLAGS))) ############################################################ # rule for the creation of libraries from *.o files ############################################################ # note that we _don't_ search for .o and .d files - the rules are written # to explicitly look for and create them in workdir # create the list of modules in the library workdir_o = $(workdir)$(LIBNAME)/ LIBCCOFILES := $(foreach V,$(LIBCCFILES),$(workdir_o)$(V:.cc=.o)) LIBCXXOFILES := $(foreach V,$(LIBCXXFILES),$(workdir_o)$(V:.cxx=.o)) LIBCPPOFILES := $(foreach V,$(LIBCPPFILES),$(workdir_o)$(V:.cpp=.o)) LIBCOFILES := $(foreach V,$(LIBCFILES),$(workdir_o)$(V:.c=.o)) LIBFOFILES := $(foreach V,$(filter %.f,$(LIBFFILES)),$(workdir_o)$(V:.f=.o)) LIBF90OFILES := $(foreach V,$(filter %.f90,$(LIBF90FILES)),$(workdir_o)$(V:.f90=.o)) LIBFFOFILES := $(foreach V,$(filter %.F,$(LIBFFILES)),$(workdir_o)$(V:.F=.o)) LIBOFILES := $(LIBCCOFILES) $(LIBCXXOFILES) $(LIBCPPOFILES) \ $(LIBCOFILES) $(LIBFOFILES) $(LIBF90FILES) \ $(LIBFFOFILES) $(LIBOFILES) LIBOFILES_NODIR := $(patsubst $(workdir)%,%,$(LIBOFILES)) # Move any -l and -L switches in ARFLAGS to the end of the command. XARFLAGS = $(filter-out -l% -L%,$(ARFLAGS)) XARTAIL = $(filter -L%,$(ARFLAGS)) $(filter -l%,$(ARFLAGS)) XSHAREDARFLAGS = $(filter-out -l% -L%,$(SHAREDARFLAGS)) XSHAREDARTAIL = $(filter -L%,$(SHAREDARFLAGS)) $(filter -l%,$(SHAREDARFLAGS)) # If building shared libraries, add pic option to compiler line ifdef SHAREDLIB override CXXFLAGS += $(PICFLAG) override FCFLAGS += $(FCPICFLAG) endif #AMJ/P.Russo 10/9/98: Only create .a file if there are .o files to insert. # Prevents creation of corrupted .a # Remove .a and exit make if anything goes wrong. #AMJ/P.Russo 10/9/98: $(LIB): $(LIBOFILES) @echo "<**building library**> $(LIBNAME)" if [ -f $(LIB) ] ; then rm $(LIB) ; fi if [ ! -d $(workdir_o) ] ; then mkdir $(workdir_o) ; fi if [ "`find $(workdir_o) -name \*.o -print | head -1`" ] ; \ then { cd $(workdir_o) ; \ $(AR) $(XARFLAGS) $(LIB) *.o $(XARTAIL) || { rm -f $(LIB); exit 1 ;} ; \ if [ "$(RANLIB)" ] ; then { $(RANLIB) $(LIB) || { rm -f $(LIB); exit 1 ;} ;} ; fi \ ;} ; \ else echo "Warning: no files to insert in library $(@F), library not created." ; \ fi $(SHAREDLIB): $(LIBOFILES) @echo "<**building library**> $(LIBNAME)" if [ -f $(SHAREDLIB) ] ; then rm $(SHAREDLIB) ; fi if [ ! -d $(workdir_o) ] ; then mkdir $(workdir_o) ; fi if [ "`find $(workdir_o) -name \*.o -print | head -1`" ] ; \ then { cd $(workdir_o) ; \ $(SHAREDAR) $(XSHAREDARFLAGS) $(SHAREDLIB) *.o $(XSHAREDARTAIL) || { rm -f $(SHAREDLIB); exit 1 ;} ; \ if [ "$(RANLIB)" ] ; then { $(RANLIB) $(SHAREDLIB) || { rm -f $(SHAREDLIB); exit 1 ;} ;} ; fi \ ;} ; \ else echo "Warning: no files to insert in library $(@F), library not created." ; \ fi ############################################################ # standard library source --> .o rules ############################################################ .SUFFIXES: .SUFFIXES: .a .o .cc .cxx .cpp .c .f .F .mod .f90 .idl .lex .d .PRECIOUS: $(IDLFILES:.idl=.f90stub.f90) $(IDLFILES:.idl=.ccstub.cc) # The following two are kludges because the source directory gets # write protected for official versions. Ideally the .f90 and .cc files # should get created somewhere else (e.g. in tmp), but that severely # complicates other rules. %.f90stub.f90: %.idl prot=0; \ if [ ! -w $(curdir) ]; then chmod u+w $(curdir); prot=1; fi; \ $(FIDLE) $(IDLFLAGS) $<; \ if [ $$prot ]; then chmod u-w $(curdir); fi %.ccstub.cc: %.idl prot=0; \ if [ ! -w $(curdir) ]; then chmod u+w $(curdir); prot=1; fi; \ $(FIDLE) $(IDLFLAGS) $<; \ if [ $$prot ]; then chmod u-w $(curdir); fi ############################################################ # standard source -> binary rules ############################################################ # The next pattern rule is needed because the bindir prefix will not # automatically match to local (no prefix) source and I didn't want # to use vpath (it's too indiscriminate if it has no suffix to match) $(bindir)%: %.cc ifneq (D0,$(EXPERIMENT)) @echo Building $(@F) else @echo "<**building**> $(@F)" endif $(CXX) $< $(CXXFLAGS) $(CXXCFLAGS) $(CPPFLAGS) $(LDFLAGS) \ -o $@ $(LOADLIBES) $(bindir)%: %.cxx ifneq (D0,$(EXPERIMENT)) @echo Building $(@F) else @echo "<**building**> $(@F)" endif $(CXX) $< $(CXXFLAGS) $(CXXCFLAGS) $(CPPFLAGS) $(LDFLAGS) \ -o $@ $(LOADLIBES) $(bindir)%: %.cpp ifneq (D0,$(EXPERIMENT)) @echo Building $(@F) else @echo "<**building**> $(@F)" endif $(CXX) $< $(CXXFLAGS) $(CXXCFLAGS) $(CPPFLAGS) $(LDFLAGS) \ -o $@ $(LOADLIBES) ############################################################ # standard pattern rules for library dependencies ############################################################ # .d file are placed in $workdir #FNAL-GC 10/14/97 # Test for 0-length .d files, and remove them if found # Otherwise gmake will mistakenly think the source file has no dependencies, # and will not recompile even if a dependency has changed #FNAL-END # jfa 10/98: # If we are making temporary directories, we want to avoid all of the # following rules. This is a terrible hack required for the current # implementation of the package/subpackage structure. ifndef MAKING_TMP_DIRECTORIES define make-cpp-depends if test -f $< ; then \ echo "<**depend**> $(@F)"; \ if [ ! -d $(workdir) ] ; then mkdir $(workdir); fi ; \ { $(CPP) $(CPPMFLAGS) $(CPPFLAGS) $(CXXCFLAGS) $< \ || { rm $@; exit 1 ;} ;} \ | sed 's?$*\.o?$(workdir_o)$*.o $@ ?g' > $@ ; \ fi if test -f $@ ; then if test ! -s $@ ; then echo "Warning: removing empty file $@"; rm $@; fi; fi endef define make-c-depends if test -f $< ; then \ echo "<**depend**> $(@F)"; \ if [ ! -d $(workdir) ] ; then mkdir $(workdir); fi ; \ { $(CPP) $(CPPMFLAGS) $(CPPFLAGS) $< \ || { rm $@; exit 1 ;} ;} \ | sed 's?$*\.o?$(workdir_o)$*.o $@ ?g' > $@ ; \ fi if test -f $@ ; then if test ! -s $@ ; then echo "Warning: removing empty file $@"; rm $@; fi; fi endef define make-f-depends if test -f $< ; then \ echo "<**depend**> $(@F)"; \ if [ ! -d $(workdir) ] ; then mkdir $(workdir); fi ; \ { $(FPP) -M $(FCPPMFLAGS) $(CPPFLAGS) $< \ || { rm $@; exit 1 ;} ;} \ | sed 's?$*\.o?$(workdir_o)$*.o $@ ?g' > $@ ; \ fi if test -f $@ ; then if test ! -s $@ ; then echo "Warning: removing empty file $@"; rm $@; fi; fi endef $(workdir)%.d: %.cc $(make-cpp-depends) $(workdir)%.d: %.cxx $(make-cpp-depends) $(workdir)%.d: %.cpp $(make-cpp-depends) $(workdir)%.d: %.c $(make-c-depends) # Note the following rule changes depending on whether LIB is defined. # The dependency has to be taught if its making a library member, and # assumes so if LIB is defined $(workdir)%.d: %.F $(make-f-depends) $(workdir)%.d: %.f90 if [ ! -d $(workdir) ] ; then mkdir $(workdir); fi ; tr A-Z a-z < $*.f90 | awk '$$1=="module" { print $$2 ".mod" }' > $@.1 echo $(LIB)\($*.o\) $@ " : " $*.f90 "\\" > $@.2 tr A-Z a-z < $*.f90 | awk '$$1=="use" { print $$2 ".mod \\" }' >> $@.2 echo >> $@.2 echo >> $@.2 grep -v -f $@.1 $@.2 > $@ awk '{ print $$1 " : $*.f90" }' $@.1 >> $@ echo >> $@ rm -f $@.1 $@.2 if [ ! -s $@ ]; then echo "Warning: removing empty file $@"; rm $@; fi ####################################################################### # rule for compiling f90 modules ####################################################################### %.mod: %.f90 if [ ! -d $(moddir) ] ; then mkdir $(moddir); fi ifeq ($(F90C),xlf90) cp $< $(workdir)$*.f cd $(moddir); $(F90C) $(F90CFLAGS) -c $(workdir)$*.f -o $(workdir)$*.o else cd $(moddir); $(F90C) $(F90CFLAGS) -c $(curdir)/$< -o $(workdir)$*.o endif ######################################################### # Read in library dependancy files ######################################################### # (Note problem if you have both foo.c and foo.cc) # (Note no .d files for .f, as no includes unless .F suffix used ifdef LIBCCFILES -include $(foreach var,$(LIBCCFILES:.cc=.d),$(workdir)$(var)) /dev/null endif ifdef LIBCXXFILES -include $(foreach var,$(LIBCXXFILES:.cxx=.d),$(workdir)$(var)) /dev/null endif ifdef LIBCPPFILES -include $(foreach var,$(LIBCPPFILES:.cpp=.d),$(workdir)$(var)) /dev/null endif ifdef LIBCFILES -include $(foreach var,$(LIBCFILES:.c=.d),$(workdir)$(var)) /dev/null endif ifdef LIBFFILES -include $(foreach var,$(LIBFFILES:.F=.d),$(workdir)$(var)) /dev/null -include $(foreach var,$(LIBFFILES:.f=.d),$(workdir)$(var)) /dev/null endif ifdef LIBF90FILES -include $(foreach var,$(LIBF90FILES:.f90=.d),$(workdir)$(var)) /dev/null endif ##################################################################### # Rules for compiling library source -> objects in a seperate workdir. ##################################################################### $(LIBCCOFILES): $(workdir_o)%.o: %.cc @echo "<**compiling**> $( $( $( $( $( $( $( $(workdir)$(*F).f $(FC) $(FCFLAGS) -c $(workdir)$(*F).f -o $(workdir_o)$*.o else @echo "<**compiling**> $( .o that will *not* be subsequently archived ##################################################################### # # Herb Greenlee: FNAL 4/20/98 # # rules for making, and keeping .o files rather than putting them into # archives # Construct a complete list of all object file targets. ccobjects := $(addprefix $(libdir),$(OBJCCFILES:.cc=.o)) cxxobjects := $(addprefix $(libdir),$(OBJCXXFILES:.cxx=.o)) cppobjects := $(addprefix $(libdir),$(OBJCPPFILES:.cpp=.o)) cobjects := $(addprefix $(libdir),$(OBJCFILES:.c=.o)) fobjects := $(addprefix $(libdir),$(foreach V,$(filter %.f,$(OBJFFILES)),$(V:.f=.o))) ffobjects := $(addprefix $(libdir),$(foreach V,$(filter %.F,$(OBJFFILES)),$(V:.F=.o))) # And dependency files ccdepends := $(addprefix $(workdir),$(notdir $(ccobjects:.o=.d))) cxxdepends := $(addprefix $(workdir),$(notdir $(cxxobjects:.o=.d))) cppdepends := $(addprefix $(workdir),$(notdir $(cppobjects:.o=.d))) cdepends := $(addprefix $(workdir),$(notdir $(cobjects:.o=.d))) fdepends := $(addprefix $(workdir),$(notdir $(fobjects:.o=.d))) ffdepends := $(addprefix $(workdir),$(notdir $(ffobjects:.o=.d))) # Object files are built during lib target. lib: $(ccobjects) $(cxxobjects) $(cppobjects) $(cobjects) $(fobjects) $(ffobjects) # # Compilation rules # (source->.o that will not be archived only.) # $(ccobjects): $(libdir)%.o: %.cc @echo "<**compiling object**> $( $( $( $( $( $( $(workdir)$(*F).f $(FC) $(FCFLAGS) -c $(workdir)$(*F).f -o $@ else @echo "<**compiling object**> $(.o that will not be archived only.) # define workdir-cpp-depends if test -f $< ; then \ echo "<**depend object**> $(@F)"; \ { $(CPP) $(CPPMFLAGS) $(CPPFLAGS) $(CXXCFLAGS) $< \ || { rm $@; exit 1 ;} ;} \ | sed 's?$*\.o?$(libdir)$*.o $@ ?g' > $@ ; \ fi if test -f $@ ; then if test ! -s $@ ; then echo "Warning: removing empty file $@"; rm $@; fi; fi endef define workdir-c-depends if test -f $< ; then \ echo "<**depend object**> $(@F)"; \ { $(CPP) $(CPPMFLAGS) $(CPPFLAGS) $< \ || { rm $@; exit 1 ;} ;} \ | sed 's?$*\.o?$(libdir)$*.o $@ ?g' > $@ ; \ fi if test -f $@ ; then if test ! -s $@ ; then echo "Warning: removing empty file $@"; rm $@; fi; fi endef define workdir-f-depends if test -f $< ; then \ echo "<**depend object**> $(@F)"; \ { $(FPP) -M $(FCPPMFLAGS) $(CPPFLAGS) $< \ || { rm $@; exit 1 ;} ;} \ | sed 's?$*\.o?$(libdir)$*.o $@ ?g' > $@ ; \ fi if test -f $@ ; then if test ! -s $@ ; then echo "Warning: removing empty file $@"; rm $@; fi; fi endef $(ccdepends): $(workdir)%.d: %.cc $(workdir-cpp-depends) $(cxxdepends): $(workdir)%.d: %.cxx $(workdir-cpp-depends) $(cppdepends): $(workdir)%.d: %.cpp $(workdir-cpp-depends) $(cdepends): $(workdir)%.d: %.c $(workdir-c-depends) $(ffdepends): $(workdir)%.d: %.F $(workdir-f-depends) # # include dependency files # (source->.o that will not be archived only.) # -include $(ccdepends) $(cxxdepends) $(cppdepends) $(cdepends) $(ffdepends) endif # End of ifndef MAKING_TMP_DIRECTORIES ####################################################################### # pattern rule to process subdirectories ####################################################################### # # amj 5/29/98 add echo's for error reporter to . # rmh 6/4/98 the echo's break the error reporter for packages that contain # sub-directoreis: the sub-directory name gets echoed and the # error reporter send mail to the mailing list for the # sub-directory, which does not exist. I backed out echos. # jfa 10/98 # SUBPACKAGE_OVERRIDES is needed to convey information to subdirectories # for package/subpackage setups. SUBPACKAGE_OVERRIDES= SUBPACKAGE=$(SUBPACKAGE) %.include: ifeq (D0,$(EXPERIMENT)) @echo "<**include**> $(CURPKG) `date` ($(PNAME)/$(@:.include=))" endif @$(MAKE) -C $(@:.include=) $(SUBPACKAGE_OVERRIDES) PNAME="$(PNAME)/$(@:.include=)" include %.lib: ifeq (D0,$(EXPERIMENT)) @echo "<**lib**> $(CURPKG) `date` ($(PNAME)/$(@:.lib=))" endif @$(MAKE) -C $(@:.lib=) $(SUBPACKAGE_OVERRIDES) PNAME="$(PNAME)/$(@:.lib=)" lib %.bin: ifeq (D0,$(EXPERIMENT)) @echo "<**bin**> $(CURPKG) `date` ($(PNAME)/$(@:.bin=))" endif @$(MAKE) -C $(@:.bin=) $(SUBPACKAGE_OVERRIDES) PNAME="$(PNAME)/$(@:.bin=)" bin %.tbin: ifeq (D0,$(EXPERIMENT)) @echo "<**tbin**> $(CURPKG) `date` ($(PNAME)/$(@:.tbin=))" endif @$(MAKE) -C $(@:.tbin=) $(SUBPACKAGE_OVERRIDES) PNAME="$(PNAME)/$(@:.tbin=)" tbin %.test: ifeq (D0,$(EXPERIMENT)) @echo "<**test**> $(CURPKG) `date` ($(PNAME)/$(@:.test=))" endif @$(MAKE) -C $(@:.test=) $(SUBPACKAGE_OVERRIDES) PNAME="$(PNAME)/$(@:.test=)" test %.clean: ifeq (D0,$(EXPERIMENT)) @echo "<**clean**> $(CURPKG) `date` ($(PNAME)/$(@:.clean=))" endif @$(MAKE) -C $(@:.clean=) $(SUBPACKAGE_OVERRIDES) PNAME="$(PNAME)/$(@:.clean=)" MAKING_TMP_DIRECTORIES=true clean # jfa 10/98: # installtmpdir is needed for subpackages. Other temporary directories # are created by the top-level makefile. Subpackage temporary # directories cannot be created until the subpackages have been # defined, i.e., below the top level. %.installtmpdir: ifeq (D0,$(EXPERIMENT)) @echo "<**installtmpdir**> $(CURPKG) `date` ($(PNAME)/$(@:.installtmpdir=))" endif if [ -r $(@:.installtmpdir=)/GNUmakefile ] ; then \ $(MAKE) -C $(@:.installtmpdir=) $(SUBPACKAGE_OVERRIDES) PNAME="$(PNAME)/$(@:.installtmpdir=)" MAKING_TMP_DIRECTORIES=true installtmpdir ;\ fi