--- trunk/OOPSE-2.0/make/Makefile.in 2004/10/06 18:18:47 1529 +++ trunk/OOPSE-2.0/make/Makefile.in 2005/01/14 21:13:24 1951 @@ -38,26 +38,38 @@ PackageLibs = \ #packages containing libraries PackageLibs = \ utils \ + visitors \ math \ types \ primitives \ - visitors \ UseTheForce/DarkSide \ UseTheForce \ brains \ io \ - integrators \ - minimizers \ + integrators\ constraints \ - profiling \ - restraints \ + minimizers \ #packages containing applications Applications = \ applications/oopse \ applications/dump2Xyz \ - applications/simpleBuilder + applications/simpleBuilder\ +Samples = \ + samples/argon \ + samples/water/dimer \ + samples/water/spce \ + samples/water/ssd \ + samples/water/ssde \ + samples/water/tip3p_ice \ + samples/water/tip4p \ + samples/lipid \ + samples/alkane \ + samples/minimizer \ + samples/metals \ + samples/zcons \ + IncludeDirs = \ @SPRNG_INC_DIR@ \ @MPI_INC_DIR@ @@ -72,11 +84,16 @@ ForceParamDir = @OOPSE_HOME@/share/forceFields/ @MPI_F90_LIB@ OopseHome = @OOPSE_HOME@ -ForceParamDir = @OOPSE_HOME@/share/forceFields/ -SampleSimDir = @OOPSE_HOME@/share/samples/ +ForceParamDir = $(OopseHome)/share/forceFields +SampleSimDir = $(OopseHome)/share/samples +InstallBinDir = $(OopseHome)/bin +DocDir = $(OopseHome)/doc FrcDeclare = -DFRC_PATH="$(ForceParamDir)" +F90Declare = -D__FORTRAN90 ParallelDeclare = -DIS_MPI UseMPI = @USE_MPI@ +ModuleCase = @F90_MODULE_NAMES@ +ModSuffix = @MOD@ LinkOptions = \ @F90LIBS@ @@ -94,7 +111,6 @@ ParallelLibDir = $(DEV_ROOT)/MPIlib TargetDir = $(DEV_ROOT)/obj ParallelTargetDir = $(DEV_ROOT)/MPIobj LibDir = $(DEV_ROOT)/lib -ParallelLibDir = $(DEV_ROOT)/MPIlib MakeDir = $(DEV_ROOT)/make BinDir = $(DEV_ROOT)/bin DocsDir = $(DEV_ROOT)/docs @@ -107,7 +123,9 @@ Package = $(subst $(shell cd $(SourceDir); pw # /home/maul/gezelter/src/code/src/UseTheForce/Darkside --> UseTheForce/Darkside #Package = $(shell echo $(CurrentDir) | sed -e 's/^.*\/src\/\(.*\)/\1/g') #use shell script to get the absolute path and then rip it off from $(CurrentDir) -Package = $(subst $(shell cd $(SourceDir); pwd)/,,$(CurrentDir)) +#Package = $(subst $(shell cd $(SourceDir); pwd)/,,$(CurrentDir)) +# REMINDER: We are now using the Package line in each subdir makefile. +# This avoids the strange path problem and the subshell PackageList = $(Package) PackageSourceDir = $(SourceDir)/$(Package) @@ -207,6 +225,7 @@ endif ParallelStaticLibrary = $(LibDir)/lib$(subst /,,$(patsubst %,oopse_%,$(Package)))_MPI.a endif endif + # # Misc # @@ -228,16 +247,16 @@ Move = mv # #--------------------------------------------------------------------------- Print = @echo -Move = mv +Move = mv -f Copy = cp CCompiler = @CC@ CppCompiler = @CXX@ Linker = @CXX@ MakeDepend = makedepend -Install = @INSTALL@ +INSTALL = @INSTALL@ InstallProgram = @INSTALL_PROGRAM@ InstallData = @INSTALL_DATA@ -MakeDir = @MKINSTALLDIRS@ +MkDir = @MKINSTALLDIRS@ Delete = rm -fr StaticArchiver = @AR@ DynamicArchiver = @CC@ @@ -256,8 +275,8 @@ Ranlib = @RANLIB@ Yacc = @YACC@ Lex = @LEX@ Ranlib = @RANLIB@ +Doxygen = @DOXYGEN@ - MakeOptions = -k MakeDependOptions = StaticArchiverOptions = rc @@ -266,13 +285,13 @@ COptions = $(FrcDeclare) JniOptions = RmiOptions = -d $(TargetDir) -classpath $(ClassPath) \ -sourcepath $(SourceDir) -COptions = $(FrcDeclare) -CParallelOptions = $(FrcDeclare) $(ParallelDeclare) -CppOptions = $(FrcDeclare) -CppParallelOptions = $(FrcDeclare) $(ParallelDeclare) +COptions = $(FrcDeclare) @CFLAGS@ +CParallelOptions = $(FrcDeclare) $(ParallelDeclare) @CFLAGS@ +CppOptions = $(FrcDeclare) @CXXFLAGS@ @OOPSE_TEMPLATE_FLAGS@ +CppParallelOptions = $(FrcDeclare) $(ParallelDeclare) @CXXFLAGS@ @OOPSE_TEMPLATE_FLAGS@ FortranOptions = -F90Options = @PREPFLAG@ @F90FLAGS@ @MODDIRFLAG@$(SourceDir) -module $(TargetDir) -F90ParallelOptions = @PREPFLAG@ @F90FLAGS@ @MODDIRFLAG@$(SourceDir) -module $(ParallelTargetDir) @PREPDEFFLAG@$(ParallelDeclare) +F90Options = @PREPFLAG@ @F90FLAGS@ @MODDIRFLAG@$(SourceDir) @MODDIRFLAG@$(TargetDir) +F90ParallelOptions = @PREPFLAG@ @F90FLAGS@ @MODDIRFLAG@$(SourceDir) @MODDIRFLAG@$(ParallelTargetDir) @PREPDEFFLAG@$(ParallelDeclare) JavaCompilerOptions = -d $(TargetDir) -classpath $(ClassPath) \ -sourcepath $(SourceDir) -deprecation JavaRunOptions = -classpath $(ClassPath) @@ -298,6 +317,45 @@ Space = $(Empty) $(Empty) #--------------------------------------------------------------------------- # +# Install +# +#--------------------------------------------------------------------------- + +ifneq "$(words $(SampleFiles))" "0" + MySample = $(subst $(shell cd $(DEV_ROOT)/samples; pwd)/,,$(CurrentDir)) + MyInstallDir = $(SampleSimDir)/$(MySample) + InstallFiles = $(SampleFiles) + InstallCommand = $(InstallData) +endif + +ifneq "$(words $(Main))" "0" + MyInstallDir = $(InstallBinDir) + ifeq "$(UseMPI)" "yes" + InstallFiles = $(Executable) $(ParallelExecutable) + else + InstallFiles = $(Executable) + endif + InstallCommand = $(InstallProgram) +endif + +ifneq "$(words $(ForcefieldFiles))" "0" + MyInstallDir = $(ForceParamDir) + InstallFiles = $(ForcefieldFiles) + InstallCommand = $(InstallData) +endif + +ifneq "$(words $(InstallFiles))" "0" + InstallList = +else + InstallList = $(patsubst %,$(DEV_ROOT)/%,$(Samples)) $(DEV_ROOT)/forceFields $(patsubst %, $(SourceDir)/%,$(Applications)) +endif + +InstallListLoop = $(patsubst %,$(SourceDir)/%/.install,$(PackageList)) $(patsubst %,%/.install,$(InstallList)) + + + +#--------------------------------------------------------------------------- +# # Rules # #--------------------------------------------------------------------------- @@ -308,7 +366,10 @@ $(PackageTargetDir) : # Create target directory $(PackageTargetDir) : - $(MakeDir) $@ + $(MkDir) $@ + +$(BinDir) : + $(MkDir) $@ # .c -> .o $(PackageTargetDir)/%.o : %.c @@ -363,17 +424,34 @@ $(PackageTargetDir)/%.o : %.F90 # .F90 -> .o $(PackageTargetDir)/%.o : %.F90 $(F90Compiler) $(F90Options) $(IncludePath) -c $< -o $@ + if test -n "`ls *.$(ModSuffix)`"; then \ + $(Move) `ls *.$(ModSuffix)` $(PackageTargetDir);\ + fi $(PackageParallelTargetDir)/%.o : %.F90 $(F90Compiler) $(F90ParallelOptions) $(IncludePath) -c $< -o $@ + if test -n "`ls *.$(ModSuffix)`"; then \ + $(Move) "`ls *.$(ModSuffix)`" $(PackageParallelTargetDir);\ + fi ifeq "$(UseMPI)" "yes" %.o : %.F90 $(MAKE) $(MakeOptions) $(PackageTargetDir)/$@ + if test -n "`ls *.$(ModSuffix)`"; then\ + $(Move) "`ls *.$(ModSuffix)`" $(PackageTargetDir);\ + fi + $(MAKE) $(MakeOptions) $(PackageParallelTargetDir)/$@ + if test -n "`ls *.$(ModSuffix)`"; then\ + $(Move) "`ls *.$(ModSuffix)`" $(PackageTargetDir);\ + fi + else %.o : %.F90 $(MAKE) $(MakeOptions) $(PackageTargetDir)/$@ + if test -n "`ls *.$(ModSuffix)`"; then\ + $(Move) "`ls *.$(ModSuffix)`" $(PackageTargetDir);\ + fi endif @@ -413,11 +491,11 @@ $(LibDir)/%_UP.a : $(ObjectFiles) $(LibDir)/%_UP.a : $(ObjectFiles) $(StaticArchiver) $(StaticArchiverOptions) $@ $(ObjectFiles) - touch $(LibDir)/.stamp_UP + @touch $(LibDir)/.stamp_UP $(LibDir)/%_MPI.a: $(ParallelObjectFiles) $(StaticArchiver) $(StaticArchiverOptions) $@ $(ParallelObjectFiles) - touch $(LibDir)/.stamp_MPI + @touch $(LibDir)/.stamp_MPI %_UP.a : $(ObjectFiles) $(MAKE) $(MakeOptions) $(LibDir)/$@ @@ -470,6 +548,11 @@ $(PackageTargetDir)/%_Skel.class : $(PackageTargetDir) %_Skel.class : %.class $(MAKE) $(MakeOptions) $(PackageTargetDir)/$@ +document : + $(Print) Generate Documentation for OOPSE-2.0 + @cd $(DEV_ROOT)/src + $(Doxygen) $(DEV_ROOT)/make/Doxyfile + #GUN make funtions to merge the libraries find_objs = $(shell $(StaticArchiver) -t $(1)) extract_objs = $(shell $(StaticArchiver) -x $(1) $(call find_objs, $(1))) @@ -477,20 +560,22 @@ $(CombinedStaticLib) : $(LibDir)/.stamp_UP remove_objs = $(shell $(Delete) $(call find_objs, $(1))) do_create = $(call extract_objs,$(1))$(call create_archive,$(1),$(2))$(call remove_objs,$(1)) -$(CombinedStaticLib) : $(LibDir)/.stamp_UP +$(CombinedStaticLib) : $(LibDir)/.stamp_UP + $(Print) create $@ $(foreach thisLib,$(LibNames),$(call do_create,$(thisLib),$@)) $(Ranlib) $(CombinedStaticLib) $(CombinedParallelStaticLib) : $(LibDir)/.stamp_MPI + $(Print) create $@ $(foreach thisLib,$(ParallelLibNames), $(call do_create, $(thisLib), $@)) $(Ranlib) $(CombinedParallelStaticLib) # Executable -$(Executable) : $(CombinedStaticLib) $(ObjectFiles) - $(Linker) $(ObjectFiles) $(LinkOptions) $(LibDirs) $(CombinedStaticLib) $(Libraries) -o $@ +$(Executable) : $(CombinedStaticLib) $(ObjectFiles) $(BinDir) + $(Linker) $(ObjectFiles) $(CombinedStaticLib) $(LinkOptions) $(LibDirs) $(Libraries) -o $@ -$(ParallelExecutable) : $(CombinedParallelStaticLib) $(ParallelObjectFiles) - $(Linker) $(ParallelObjectFiles) $(ParallelLinkOptions) $(LibDirs) $(CombinedParallelStaticLib) $(Libraries) -o $@ +$(ParallelExecutable) : $(CombinedParallelStaticLib) $(ParallelObjectFiles) $(BinDir) + $(Linker) $(ParallelObjectFiles) $(CombinedParallelStaticLib) $(ParallelLinkOptions) $(LibDirs) $(Libraries) -o $@ # Anything else is just copied from source to target $(PackageTargetDir)/% : $(PackageSourceDir)/% @@ -503,6 +588,7 @@ ifeq "$(UseMPI)" "yes" _all : _buildall +_buildall : ifeq "$(UseMPI)" "yes" _buildall : \ $(DependencyFile) \ @@ -567,28 +653,44 @@ $(DependencyFile) : $(DerivedSource) $(Print) $@ @cd $(PackageSourceDir) - @touch Make.ctemp - @touch Make.ctemp - ifneq "$(words $(CppFiles))" "0" - $(CppCompiler) $(IncludePath) -MM $(CppFiles) > Make.cpptemp - cat Make.cpptemp | sed 's/^[a-zA-Z0-9]/$$\(DEV_ROOT\)\/obj\/&/g' >> $(DependencyFile) - cat Make.cpptemp | sed 's/^[a-zA-Z0-9]/$$\(DEV_ROOT\)\/MPIobj\/&/g' >> $(DependencyFile) + $(DEV_ROOT)/scripts/filepp -I $(DEV_ROOT)/src -od '$$(TargetDir)/' -MM $(CppFiles)>> Make.cpptemp + @cat Make.cpptemp >> $(DependencyFile) + $(Delete) Make.cpptemp + + ifeq "$(UseMPI)" "yes" + $(DEV_ROOT)/scripts/filepp -I $(DEV_ROOT)/src -od '$$(ParallelTargetDir)/' $(ParallelDeclare) -MM $(CppFiles)>> Make.cpptemp + @cat Make.cpptemp >> $(DependencyFile) + @$(Delete) Make.cpptemp + endif + endif ifneq "$(words $(CFiles))" "0" - $(CCompiler) $(IncludePath) -MM $(CFiles) $(DerivedCFiles) > Make.ctemp - cat Make.ctemp | sed 's/^[a-zA-Z0-9]/$$\(DEV_ROOT\)\/obj\/&/g' >> $(DependencyFile) - cat Make.ctemp | sed 's/^[a-zA-Z0-9]/$$\(DEV_ROOT\)\/MPIobj\/&/g' >> $(DependencyFile) + $(DEV_ROOT)/scripts/filepp -I $(DEV_ROOT)/src -od '$$(TargetDir)/' -MM $(CFiles) $(DerivedCFiles) >> Make.ctemp + @cat Make.ctemp >> $(DependencyFile) + $(Delete) Make.ctemp + ifeq "$(UseMPI)" "yes" + $(DEV_ROOT)/scripts/filepp -I $(DEV_ROOT)/src -od '$$(ParallelTargetDir)/' $(ParallelDeclare) -MM $(CFiles) $(DerivedCFiles) >> Make.ctemp + @cat Make.ctemp >> $(DependencyFile) + @$(Delete) Make.ctemp + endif + endif ifneq "$(words $(F90Files))" "0" - $(DEV_ROOT)/scripts/filepp -I $(DEV_ROOT)/src -od '$$(DEV_ROOT)/obj/' -D__FORTRAN90 $(F90Files) > Make.ftemp - $(DEV_ROOT)/scripts/filepp -I $(DEV_ROOT)/src -od '$$(DEV_ROOT)/MPIobj/' -DIS_MPI -D__FORTRAN90 $(F90Files) >> Make.ftemp - cat Make.ftemp >> $(DependencyFile) + $(DEV_ROOT)/scripts/filepp -I $(DEV_ROOT)/src -od '$$(TargetDir)/' $(F90Declare) -MM -mc $(ModuleCase) -ms $(ModSuffix) $(F90Files) > Make.ftemp + @cat Make.ftemp >> $(DependencyFile) + @$(Delete) Make.ftemp + + ifeq "$(UseMPI)" "yes" + $(DEV_ROOT)/scripts/filepp -I $(DEV_ROOT)/src -od '$$(ParallelTargetDir)/' $(ParallelDeclare) $(F90Declare) -MM -mc $(ModuleCase) -ms $(ModSuffix) $(F90Files) >> Make.ftemp + @cat Make.ftemp >> $(DependencyFile) + @$(Delete) Make.ftemp + endif + endif - $(Delete) Make.cpptemp Make.ctemp Make.ftemp # make lib lib : $(PackageListLoop) @@ -601,9 +703,27 @@ jarsign : $(JarFile) jarsign : $(JarFile) $(JarSigner) -keystore GeoSoftKeystore $(JarFile) myself +#make install +%.install : + @$(MAKE) $(MakeOptions) -C $(subst .install,,$@) _installall + +install : $(InstallListLoop) + $(Print) Done Install + +_installall : _buildall _installdata + +$(MyInstallDir) : + $(MkDir) $@ + +_installdata : $(MyInstallDir) + $(Print) $(InstallFiles) +ifneq "$(words $(InstallFiles))" "0" + $(InstallData) $(InstallFiles) $(MyInstallDir) +endif + # make statistics _statisticsall : - @$(Print) $(SourceFiles) >> $(DEV_ROOT)/files.tmp + @$(Print) $(patsubst %,$(CurrentDir)/%,$(SourceFiles)) >> $(DEV_ROOT)/files.tmp statistics : $(PackageListLoop) @$(List) $(DEV_ROOT)/files.tmp | xargs $(WordCount) $(WordCountOptions)