34 |
|
# |
35 |
|
#--------------------------------------------------------------------------- |
36 |
|
IS_UNIX=1 |
37 |
< |
#packages to be made |
38 |
< |
Packages = \ |
37 |
> |
|
38 |
> |
#packages containing libraries |
39 |
> |
PackageLibs = \ |
40 |
|
utils \ |
41 |
|
math \ |
42 |
|
types \ |
51 |
|
constraints \ |
52 |
|
profiling \ |
53 |
|
restraints \ |
54 |
+ |
|
55 |
+ |
#packages containing applications |
56 |
+ |
Applications = \ |
57 |
|
applications/oopse \ |
58 |
|
applications/dump2Xyz \ |
59 |
< |
applications/simpleBuilder \ |
59 |
> |
applications/simpleBuilder |
60 |
|
|
61 |
< |
#packages contain libraries |
62 |
< |
PackageLibs = \ |
63 |
< |
utils \ |
64 |
< |
math \ |
65 |
< |
types \ |
66 |
< |
primitives \ |
67 |
< |
visitors \ |
68 |
< |
UseTheForce/DarkSide \ |
69 |
< |
UseTheForce \ |
70 |
< |
brains \ |
71 |
< |
io \ |
72 |
< |
integrators \ |
73 |
< |
minimizers \ |
70 |
< |
constraints \ |
71 |
< |
profiling \ |
72 |
< |
restraints \ |
61 |
> |
Samples = \ |
62 |
> |
samples/argon \ |
63 |
> |
samples/water/dimer \ |
64 |
> |
samples/water/spce \ |
65 |
> |
samples/water/ssd \ |
66 |
> |
samples/water/ssde \ |
67 |
> |
samples/water/tip3p_ice \ |
68 |
> |
samples/water/tip4p \ |
69 |
> |
samples/lipid \ |
70 |
> |
samples/alkane \ |
71 |
> |
samples/minimizer \ |
72 |
> |
samples/metals \ |
73 |
> |
samples/zcons \ |
74 |
|
|
75 |
|
IncludeDirs = \ |
76 |
|
@SPRNG_INC_DIR@ \ |
89 |
|
ForceParamDir = @OOPSE_HOME@/share/forceFields/ |
90 |
|
SampleSimDir = @OOPSE_HOME@/share/samples/ |
91 |
|
FrcDeclare = -DFRC_PATH="$(ForceParamDir)" |
92 |
+ |
F90Declare = -D__FORTRAN90 |
93 |
|
ParallelDeclare = -DIS_MPI |
94 |
|
UseMPI = @USE_MPI@ |
95 |
+ |
ModuleCase = @F90_MODULE_NAMES@ |
96 |
+ |
ModSuffix = @MOD@ |
97 |
+ |
LinkOptions = \ |
98 |
+ |
@F90LIBS@ |
99 |
|
|
100 |
+ |
ParallelLinkOptions = \ |
101 |
+ |
@F90LIBS@ |
102 |
+ |
|
103 |
+ |
|
104 |
|
#--------------------------------------------------------------------------- |
105 |
|
# |
106 |
|
# Directories |
111 |
|
TargetDir = $(DEV_ROOT)/obj |
112 |
|
ParallelTargetDir = $(DEV_ROOT)/MPIobj |
113 |
|
LibDir = $(DEV_ROOT)/lib |
104 |
– |
ParallelLibDir = $(DEV_ROOT)/MPIlib |
114 |
|
MakeDir = $(DEV_ROOT)/make |
115 |
|
BinDir = $(DEV_ROOT)/bin |
116 |
|
DocsDir = $(DEV_ROOT)/docs |
117 |
|
CurrentDir = $(CURDIR) |
118 |
< |
RPath = $(shell cd $(DEV_ROOT); pwd)/lib:$(OopseHome)/lib |
119 |
< |
ParallelRPath = $(shell cd $(DEV_ROOT); pwd)/MPIlib:$(OopseHome)/MPIlib |
111 |
< |
LinkOptions = \ |
112 |
< |
@F90LIBS@ \ |
113 |
< |
-Wl,-R$(RPath) |
118 |
> |
CombinedStaticLib = $(LibDir)/libOOPSE.a |
119 |
> |
CombinedParallelStaticLib = $(LibDir)/libOOPSE_MPI.a |
120 |
|
|
115 |
– |
ParallelLinkOptions = \ |
116 |
– |
@F90LIBS@ \ |
117 |
– |
-Wl,-R$(ParallelRPath) |
118 |
– |
|
121 |
|
ifdef Source |
122 |
|
#get the relative path of current package to source directory |
123 |
|
# /home/maul/gezelter/src/code/src/UseTheForce/Darkside --> UseTheForce/Darkside |
131 |
|
PackageParallelTargetDir = $(ParallelTargetDir) |
132 |
|
JavaMainClass = $(subst /,.,$(Package)).$(Main) |
133 |
|
else |
134 |
< |
PackageList = $(Packages) $(JavaPackages) |
134 |
> |
PackageList = $(PackageLibs) $(JavaPackages) $(Applications) |
135 |
|
endif |
136 |
|
|
137 |
|
PackageListLoop = $(patsubst %,$(SourceDir)/%/.loop,$(PackageList)) |
217 |
|
Executable = $(BinDir)/$(Main) |
218 |
|
ParallelExecutable = $(BinDir)/$(Main)_MPI |
219 |
|
else |
220 |
< |
SharedLibrary = $(LibDir)/lib$(subst /,,$(patsubst %,oopse_%,$(Package))).so |
221 |
< |
StaticLibrary = $(LibDir)/lib$(subst /,,$(patsubst %,oopse_%,$(Package))).a |
222 |
< |
ParallelSharedLibrary = $(ParallelLibDir)/lib$(subst /,,$(patsubst %,oopse_%,$(Package))).so |
223 |
< |
ParallelStaticLibrary = $(ParallelLibDir)/lib$(subst /,,$(patsubst %,oopse_%,$(Package))).a |
220 |
> |
SharedLibrary = $(LibDir)/lib$(subst /,,$(patsubst %,oopse_%,$(Package)))_UP.so |
221 |
> |
StaticLibrary = $(LibDir)/lib$(subst /,,$(patsubst %,oopse_%,$(Package)))_UP.a |
222 |
> |
ParallelSharedLibrary = $(LibDir)/lib$(subst /,,$(patsubst %,oopse_%,$(Package)))_MPI.so |
223 |
> |
ParallelStaticLibrary = $(LibDir)/lib$(subst /,,$(patsubst %,oopse_%,$(Package)))_MPI.a |
224 |
|
endif |
225 |
|
endif |
226 |
|
# |
230 |
|
JavaPackageNames = $(subst /,.,$(JavaPackages)) |
231 |
|
IncludePath = -I$(SourceDir) $(IncludeDirs:%=-I%) |
232 |
|
LibDirs = -L$(LibDir) $(LibraryDirs:%=-L%) |
233 |
< |
ParallelLibDirs = -L$(ParallelLibDir) $(LibraryDirs:%=-L%) |
234 |
< |
LocalLibs = $(subst /,,$(patsubst %, oopse_%, $(PackageLibs))) |
233 |
< |
ParallelLocalLibs= $(subst /,,$(patsubst %, oopse_%, $(PackageLibs))) |
233 |
> |
LocalLibs = $(subst /,,$(patsubst %, oopse_%_UP, $(PackageLibs))) |
234 |
> |
ParallelLocalLibs= $(subst /,,$(patsubst %, oopse_%_MPI, $(PackageLibs))) |
235 |
|
LibList = $(LocalLibs:%=-l%) $(Libraries) |
236 |
+ |
LibNames = $(LocalLibs:%=$(LibDir)/lib%.a) |
237 |
|
ParallelLibList = $(ParallelLocalLibs:%=-l%) $(Libraries) |
238 |
+ |
ParallelLibNames = $(ParallelLocalLibs:%=$(LibDir)/lib%.a) |
239 |
|
|
240 |
|
|
241 |
|
#--------------------------------------------------------------------------- |
271 |
|
List = cat |
272 |
|
Yacc = @YACC@ |
273 |
|
Lex = @LEX@ |
274 |
+ |
Ranlib = @RANLIB@ |
275 |
|
|
276 |
|
|
277 |
|
MakeOptions = -k |
427 |
|
|
428 |
|
# .o -> .a |
429 |
|
|
430 |
< |
$(LibDir)/%.a : $(ObjectFiles) |
430 |
> |
$(LibDir)/%_UP.a : $(ObjectFiles) |
431 |
|
$(StaticArchiver) $(StaticArchiverOptions) $@ $(ObjectFiles) |
432 |
+ |
@touch $(LibDir)/.stamp_UP |
433 |
|
|
434 |
< |
$(ParallelLibDir)/%.a: $(ParallelObjectFiles) |
434 |
> |
$(LibDir)/%_MPI.a: $(ParallelObjectFiles) |
435 |
|
$(StaticArchiver) $(StaticArchiverOptions) $@ $(ParallelObjectFiles) |
436 |
< |
|
437 |
< |
ifeq "$(UseMPI)" "yes" |
438 |
< |
%.a : $(ObjectFiles) $(ParallelObjectFiles) |
436 |
> |
@touch $(LibDir)/.stamp_MPI |
437 |
> |
|
438 |
> |
%_UP.a : $(ObjectFiles) |
439 |
|
$(MAKE) $(MakeOptions) $(LibDir)/$@ |
440 |
< |
$(MAKE) $(MakeOptions) $(ParallelLibDir)/$@ |
441 |
< |
else |
437 |
< |
%.a : $(ObjectFiles) |
440 |
> |
|
441 |
> |
%_MPI.a : $(ParallelObjectFiles) |
442 |
|
$(MAKE) $(MakeOptions) $(LibDir)/$@ |
439 |
– |
endif |
443 |
|
|
444 |
|
# .o -> .so |
445 |
< |
$(LibDir)/%.so : $(ObjectFiles) |
445 |
> |
$(LibDir)/%_UP.so : $(ObjectFiles) |
446 |
|
$(DynamicArchiver) $(ObjectFiles) $(DynamicArchiverOptions) -o $@ |
447 |
|
|
448 |
< |
$(ParallelLibDir)/%.so : $(ParallelObjectFiles) |
448 |
> |
$(LibDir)/%_MPI.so : $(ParallelObjectFiles) |
449 |
|
$(DynamicArchiver) $(ParallelObjectFiles) $(DynamicArchiverOptions) -o $@ |
450 |
|
|
451 |
< |
ifeq "$(UseMPI)" "yes" |
449 |
< |
%.so : $(ObjectFiles) $(ParallelObjectFiles) |
451 |
> |
%_UP.so : $(ObjectFiles) |
452 |
|
$(MAKE) $(MakeOptions) $(LibDir)/$@ |
453 |
< |
$(MAKE) $(MakeOptions) $(ParallelLibDir)/$@ |
454 |
< |
else |
453 |
< |
%.so : $(ObjectFiles) |
453 |
> |
|
454 |
> |
%_MPI.so : $(ParallelObjectFiles) |
455 |
|
$(MAKE) $(MakeOptions) $(LibDir)/$@ |
455 |
– |
endif |
456 |
|
|
457 |
|
# .class -> .jar |
458 |
|
$(LibDir)/%.jar : $(JavaClassFiles) $(OtherTargetFiles) |
486 |
|
%_Skel.class : %.class |
487 |
|
$(MAKE) $(MakeOptions) $(PackageTargetDir)/$@ |
488 |
|
|
489 |
+ |
#GUN make funtions to merge the libraries |
490 |
+ |
find_objs = $(shell $(StaticArchiver) -t $(1)) |
491 |
+ |
extract_objs = $(shell $(StaticArchiver) -x $(1) $(call find_objs, $(1))) |
492 |
+ |
create_archive = $(shell $(StaticArchiver) $(StaticArchiverOptions) $(2) $(call find_objs, $(1))) |
493 |
+ |
remove_objs = $(shell $(Delete) $(call find_objs, $(1))) |
494 |
+ |
do_create = $(call extract_objs,$(1))$(call create_archive,$(1),$(2))$(call remove_objs,$(1)) |
495 |
+ |
|
496 |
+ |
$(CombinedStaticLib) : $(LibDir)/.stamp_UP |
497 |
+ |
$(Print) create $@ |
498 |
+ |
$(foreach thisLib,$(LibNames),$(call do_create,$(thisLib),$@)) |
499 |
+ |
$(Ranlib) $(CombinedStaticLib) |
500 |
+ |
|
501 |
+ |
$(CombinedParallelStaticLib) : $(LibDir)/.stamp_MPI |
502 |
+ |
$(Print) create $@ |
503 |
+ |
$(foreach thisLib,$(ParallelLibNames), $(call do_create, $(thisLib), $@)) |
504 |
+ |
$(Ranlib) $(CombinedParallelStaticLib) |
505 |
+ |
|
506 |
|
# Executable |
507 |
< |
$(Executable) : $(ObjectFiles) |
508 |
< |
$(Linker) $(ObjectFiles) $(LinkOptions) $(LibDirs) $(LibList) -o $@ |
507 |
> |
$(Executable) : $(CombinedStaticLib) $(ObjectFiles) |
508 |
> |
$(Linker) $(ObjectFiles) $(LinkOptions) $(LibDirs) $(CombinedStaticLib) $(Libraries) -o $@ |
509 |
|
|
510 |
< |
$(ParallelExecutable) : $(ParallelObjectFiles) |
511 |
< |
$(Linker) $(ParallelObjectFiles) $(ParallelLinkOptions) $(ParallelLibDirs) $(LibList) -o $@ |
510 |
> |
$(ParallelExecutable) : $(CombinedParallelStaticLib) $(ParallelObjectFiles) |
511 |
> |
$(Linker) $(ParallelObjectFiles) $(ParallelLinkOptions) $(LibDirs) $(CombinedParallelStaticLib) $(Libraries) -o $@ |
512 |
|
|
513 |
|
# Anything else is just copied from source to target |
514 |
|
$(PackageTargetDir)/% : $(PackageSourceDir)/% |
531 |
|
$(RmiStubFiles) \ |
532 |
|
$(RmiSkeletonFiles) \ |
533 |
|
$(OtherTargetFiles) \ |
517 |
– |
$(SharedLibrary) \ |
534 |
|
$(StaticLibrary) \ |
519 |
– |
$(ParallelSharedLibrary) \ |
535 |
|
$(ParallelStaticLibrary) \ |
536 |
|
$(JarFile) \ |
537 |
|
$(Executable) \ |
545 |
|
$(RmiStubFiles) \ |
546 |
|
$(RmiSkeletonFiles) \ |
547 |
|
$(OtherTargetFiles) \ |
533 |
– |
$(SharedLibrary) \ |
548 |
|
$(StaticLibrary) \ |
549 |
|
$(JarFile) \ |
550 |
|
$(Executable) |
585 |
|
$(Print) $@ |
586 |
|
@cd $(PackageSourceDir) |
587 |
|
|
574 |
– |
@touch Make.ctemp |
575 |
– |
@touch Make.ctemp |
576 |
– |
|
588 |
|
ifneq "$(words $(CppFiles))" "0" |
589 |
< |
$(CppCompiler) $(IncludePath) -MM $(CppFiles) > Make.cpptemp |
590 |
< |
cat Make.cpptemp | sed 's/^[a-zA-Z0-9]/$$\(DEV_ROOT\)\/obj\/&/g' >> $(DependencyFile) |
591 |
< |
cat Make.cpptemp | sed 's/^[a-zA-Z0-9]/$$\(DEV_ROOT\)\/MPIobj\/&/g' >> $(DependencyFile) |
589 |
> |
$(CppCompiler) $(CppOptions) $(IncludePath) -MM $(CppFiles) > Make.cpptemp |
590 |
> |
cat Make.cpptemp | sed 's/^[a-zA-Z0-9]/$$\(TargetDir\)\/&/g' >> $(DependencyFile) |
591 |
> |
$(Delete) Make.cpptemp |
592 |
> |
$(CppCompiler) $(CppParallelOptions) $(IncludePath) -MM $(CppFiles) > Make.cpptemp |
593 |
> |
cat Make.cpptemp | sed 's/^[a-zA-Z0-9]/$$\(ParallelTargetDir\)\/&/g' >> $(DependencyFile) |
594 |
> |
$(Delete) Make.cpptemp |
595 |
|
endif |
596 |
|
|
597 |
|
ifneq "$(words $(CFiles))" "0" |
598 |
< |
$(CCompiler) $(IncludePath) -MM $(CFiles) $(DerivedCFiles) > Make.ctemp |
599 |
< |
cat Make.ctemp | sed 's/^[a-zA-Z0-9]/$$\(DEV_ROOT\)\/obj\/&/g' >> $(DependencyFile) |
600 |
< |
cat Make.ctemp | sed 's/^[a-zA-Z0-9]/$$\(DEV_ROOT\)\/MPIobj\/&/g' >> $(DependencyFile) |
601 |
< |
|
598 |
> |
$(CCompiler) $(COptions) $(IncludePath) -MM $(CFiles) $(DerivedCFiles) > Make.ctemp |
599 |
> |
cat Make.ctemp | sed 's/^[a-zA-Z0-9]/$$\(TargetDir\)\/&/g' >> $(DependencyFile) |
600 |
> |
$(Delete) Make.ctemp |
601 |
> |
$(CCompiler) $(CParallelOptions) $(IncludePath) -MM $(CFiles) $(DerivedCFiles) > Make.ctemp |
602 |
> |
cat Make.ctemp | sed 's/^[a-zA-Z0-9]/$$\(ParallelTargetDir\)\/&/g' >> $(DependencyFile) |
603 |
> |
$(Delete) Make.ctemp |
604 |
|
endif |
605 |
|
|
606 |
|
ifneq "$(words $(F90Files))" "0" |
607 |
< |
$(DEV_ROOT)/scripts/filepp -I $(DEV_ROOT)/src -od '$$(DEV_ROOT)/obj/' -D__FORTRAN90 $(F90Files) > Make.ftemp |
608 |
< |
$(DEV_ROOT)/scripts/filepp -I $(DEV_ROOT)/src -od '$$(DEV_ROOT)/MPIobj/' -DIS_MPI -D__FORTRAN90 $(F90Files) >> Make.ftemp |
607 |
> |
$(DEV_ROOT)/scripts/filepp -I $(DEV_ROOT)/src -od '$$(TargetDir)/' $(F90Declare) $(F90Files) > Make.ftemp |
608 |
> |
$(DEV_ROOT)/scripts/filepp -I $(DEV_ROOT)/src -od '$$(ParallelTargetDir)/' $(ParallelDeclare) $(F90Declare) $(F90Files) >> Make.ftemp |
609 |
|
cat Make.ftemp >> $(DependencyFile) |
610 |
+ |
$(Delete) Make.ftemp |
611 |
|
endif |
595 |
– |
$(Delete) Make.cpptemp Make.ctemp Make.ftemp |
612 |
|
|
613 |
|
# make lib |
614 |
|
lib : $(PackageListLoop) |
623 |
|
|
624 |
|
# make statistics |
625 |
|
_statisticsall : |
626 |
< |
@$(Print) $(SourceFiles) >> $(DEV_ROOT)/files.tmp |
626 |
> |
@$(Print) $(patsubst %,$(CurrentDir)/%,$(SourceFiles)) >> $(DEV_ROOT)/files.tmp |
627 |
|
|
628 |
|
statistics : $(PackageListLoop) |
629 |
|
@$(List) $(DEV_ROOT)/files.tmp | xargs $(WordCount) $(WordCountOptions) |