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@ \ |
86 |
|
@MPI_F90_LIB@ |
87 |
|
|
88 |
|
OopseHome = @OOPSE_HOME@ |
89 |
< |
ForceParamDir = @OOPSE_HOME@/share/forceFields/ |
90 |
< |
SampleSimDir = @OOPSE_HOME@/share/samples/ |
89 |
> |
ForceParamDir = @OOPSE_HOME@/share/forceFields |
90 |
> |
SampleSimDir = @OOPSE_HOME@/share/samples |
91 |
> |
InstallBinDir = @OOPSE_HOME@/bin |
92 |
> |
DocDir = @OOPSE_HOME@/doc |
93 |
|
FrcDeclare = -DFRC_PATH="$(ForceParamDir)" |
94 |
+ |
F90Declare = -D__FORTRAN90 |
95 |
|
ParallelDeclare = -DIS_MPI |
96 |
|
UseMPI = @USE_MPI@ |
97 |
+ |
ModuleCase = @F90_MODULE_NAMES@ |
98 |
+ |
ModSuffix = @MOD@ |
99 |
+ |
LinkOptions = \ |
100 |
+ |
@F90LIBS@ |
101 |
|
|
102 |
+ |
ParallelLinkOptions = \ |
103 |
+ |
@F90LIBS@ |
104 |
+ |
|
105 |
+ |
|
106 |
|
#--------------------------------------------------------------------------- |
107 |
|
# |
108 |
|
# Directories |
113 |
|
TargetDir = $(DEV_ROOT)/obj |
114 |
|
ParallelTargetDir = $(DEV_ROOT)/MPIobj |
115 |
|
LibDir = $(DEV_ROOT)/lib |
104 |
– |
ParallelLibDir = $(DEV_ROOT)/MPIlib |
116 |
|
MakeDir = $(DEV_ROOT)/make |
117 |
|
BinDir = $(DEV_ROOT)/bin |
118 |
|
DocsDir = $(DEV_ROOT)/docs |
119 |
|
CurrentDir = $(CURDIR) |
120 |
< |
RPath = $(shell cd $(DEV_ROOT); pwd)/lib:$(OopseHome)/lib |
121 |
< |
ParallelRPath = $(shell cd $(DEV_ROOT); pwd)/MPIlib:$(OopseHome)/MPIlib |
111 |
< |
LinkOptions = \ |
112 |
< |
@F90LIBS@ \ |
113 |
< |
-Wl,-R$(RPath) |
114 |
< |
|
115 |
< |
ParallelLinkOptions = \ |
116 |
< |
@F90LIBS@ \ |
117 |
< |
-Wl,-R$(ParallelRPath) |
120 |
> |
CombinedStaticLib = $(LibDir)/libOOPSE.a |
121 |
> |
CombinedParallelStaticLib = $(LibDir)/libOOPSE_MPI.a |
122 |
|
|
123 |
|
ifdef Source |
124 |
|
#get the relative path of current package to source directory |
133 |
|
PackageParallelTargetDir = $(ParallelTargetDir) |
134 |
|
JavaMainClass = $(subst /,.,$(Package)).$(Main) |
135 |
|
else |
136 |
< |
PackageList = $(Packages) $(JavaPackages) |
136 |
> |
PackageList = $(PackageLibs) $(JavaPackages) $(Applications) |
137 |
|
endif |
138 |
|
|
139 |
|
PackageListLoop = $(patsubst %,$(SourceDir)/%/.loop,$(PackageList)) |
219 |
|
Executable = $(BinDir)/$(Main) |
220 |
|
ParallelExecutable = $(BinDir)/$(Main)_MPI |
221 |
|
else |
222 |
< |
SharedLibrary = $(LibDir)/lib$(subst /,,$(patsubst %,oopse_%,$(Package))).so |
223 |
< |
StaticLibrary = $(LibDir)/lib$(subst /,,$(patsubst %,oopse_%,$(Package))).a |
224 |
< |
ParallelSharedLibrary = $(ParallelLibDir)/lib$(subst /,,$(patsubst %,oopse_%,$(Package))).so |
225 |
< |
ParallelStaticLibrary = $(ParallelLibDir)/lib$(subst /,,$(patsubst %,oopse_%,$(Package))).a |
222 |
> |
SharedLibrary = $(LibDir)/lib$(subst /,,$(patsubst %,oopse_%,$(Package)))_UP.so |
223 |
> |
StaticLibrary = $(LibDir)/lib$(subst /,,$(patsubst %,oopse_%,$(Package)))_UP.a |
224 |
> |
ParallelSharedLibrary = $(LibDir)/lib$(subst /,,$(patsubst %,oopse_%,$(Package)))_MPI.so |
225 |
> |
ParallelStaticLibrary = $(LibDir)/lib$(subst /,,$(patsubst %,oopse_%,$(Package)))_MPI.a |
226 |
|
endif |
227 |
|
endif |
228 |
+ |
|
229 |
|
# |
230 |
|
# Misc |
231 |
|
# |
233 |
|
JavaPackageNames = $(subst /,.,$(JavaPackages)) |
234 |
|
IncludePath = -I$(SourceDir) $(IncludeDirs:%=-I%) |
235 |
|
LibDirs = -L$(LibDir) $(LibraryDirs:%=-L%) |
236 |
< |
ParallelLibDirs = -L$(ParallelLibDir) $(LibraryDirs:%=-L%) |
237 |
< |
LocalLibs = $(subst /,,$(patsubst %, oopse_%, $(PackageLibs))) |
233 |
< |
ParallelLocalLibs= $(subst /,,$(patsubst %, oopse_%, $(PackageLibs))) |
236 |
> |
LocalLibs = $(subst /,,$(patsubst %, oopse_%_UP, $(PackageLibs))) |
237 |
> |
ParallelLocalLibs= $(subst /,,$(patsubst %, oopse_%_MPI, $(PackageLibs))) |
238 |
|
LibList = $(LocalLibs:%=-l%) $(Libraries) |
239 |
+ |
LibNames = $(LocalLibs:%=$(LibDir)/lib%.a) |
240 |
|
ParallelLibList = $(ParallelLocalLibs:%=-l%) $(Libraries) |
241 |
+ |
ParallelLibNames = $(ParallelLocalLibs:%=$(LibDir)/lib%.a) |
242 |
|
|
243 |
|
|
244 |
|
#--------------------------------------------------------------------------- |
256 |
|
Install = @INSTALL@ |
257 |
|
InstallProgram = @INSTALL_PROGRAM@ |
258 |
|
InstallData = @INSTALL_DATA@ |
259 |
< |
MakeDir = @MKINSTALLDIRS@ |
259 |
> |
MkDir = @MKINSTALLDIRS@ |
260 |
|
Delete = rm -fr |
261 |
|
StaticArchiver = @AR@ |
262 |
|
DynamicArchiver = @CC@ |
274 |
|
List = cat |
275 |
|
Yacc = @YACC@ |
276 |
|
Lex = @LEX@ |
277 |
+ |
Ranlib = @RANLIB@ |
278 |
+ |
Doxygen = @DOXYGEN@ |
279 |
|
|
272 |
– |
|
280 |
|
MakeOptions = -k |
281 |
|
MakeDependOptions = |
282 |
|
StaticArchiverOptions = rc |
313 |
|
|
314 |
|
Empty = |
315 |
|
Space = $(Empty) $(Empty) |
316 |
+ |
|
317 |
+ |
|
318 |
+ |
#--------------------------------------------------------------------------- |
319 |
+ |
# |
320 |
+ |
# Install |
321 |
+ |
# |
322 |
+ |
#--------------------------------------------------------------------------- |
323 |
+ |
|
324 |
+ |
ifneq "$(words $(SampleFiles))" "0" |
325 |
+ |
MySample = $(subst $(shell cd $(DEV_ROOT)/samples; pwd)/,,$(CurrentDir)) |
326 |
+ |
MyInstallDir = $(SampleSimDir)/$(MySample) |
327 |
+ |
InstallFiles = $(SampleFiles) |
328 |
+ |
InstallCommand = $(InstallData) |
329 |
+ |
endif |
330 |
+ |
|
331 |
+ |
ifneq "$(words $(Main))" "0" |
332 |
+ |
MyInstallDir = $(InstallBinDir) |
333 |
+ |
ifeq "$(UseMPI)" "yes" |
334 |
+ |
InstallFiles = $(Executable) $(ParallelExecutable) |
335 |
+ |
else |
336 |
+ |
InstallFiles = $(Executable) |
337 |
+ |
endif |
338 |
+ |
InstallCommand = $(InstallProgram) |
339 |
+ |
endif |
340 |
+ |
|
341 |
+ |
ifneq "$(words $(ForcefieldFiles))" "0" |
342 |
+ |
MyInstallDir = $(ForceParamDir) |
343 |
+ |
InstallFiles = $(ForcefieldFiles) |
344 |
+ |
InstallCommand = $(InstallData) |
345 |
+ |
endif |
346 |
+ |
|
347 |
+ |
ifneq "$(words $(InstallFiles))" "0" |
348 |
+ |
InstallList = |
349 |
+ |
else |
350 |
+ |
InstallList = $(patsubst %,$(DEV_ROOT)/%,$(Samples)) $(DEV_ROOT)/forceFields $(patsubst %, $(SourceDir)/%,$(Applications)) |
351 |
+ |
endif |
352 |
|
|
353 |
+ |
InstallListLoop = $(patsubst %,$(SourceDir)/%/.install,$(PackageList)) $(patsubst %,%/.install,$(InstallList)) |
354 |
|
|
355 |
+ |
|
356 |
+ |
|
357 |
|
#--------------------------------------------------------------------------- |
358 |
|
# |
359 |
|
# Rules |
469 |
|
|
470 |
|
# .o -> .a |
471 |
|
|
472 |
< |
$(LibDir)/%.a : $(ObjectFiles) |
472 |
> |
$(LibDir)/%_UP.a : $(ObjectFiles) |
473 |
|
$(StaticArchiver) $(StaticArchiverOptions) $@ $(ObjectFiles) |
474 |
+ |
@touch $(LibDir)/.stamp_UP |
475 |
|
|
476 |
< |
$(ParallelLibDir)/%.a: $(ParallelObjectFiles) |
476 |
> |
$(LibDir)/%_MPI.a: $(ParallelObjectFiles) |
477 |
|
$(StaticArchiver) $(StaticArchiverOptions) $@ $(ParallelObjectFiles) |
478 |
+ |
@touch $(LibDir)/.stamp_MPI |
479 |
|
|
480 |
< |
ifeq "$(UseMPI)" "yes" |
433 |
< |
%.a : $(ObjectFiles) $(ParallelObjectFiles) |
480 |
> |
%_UP.a : $(ObjectFiles) |
481 |
|
$(MAKE) $(MakeOptions) $(LibDir)/$@ |
482 |
< |
$(MAKE) $(MakeOptions) $(ParallelLibDir)/$@ |
483 |
< |
else |
437 |
< |
%.a : $(ObjectFiles) |
482 |
> |
|
483 |
> |
%_MPI.a : $(ParallelObjectFiles) |
484 |
|
$(MAKE) $(MakeOptions) $(LibDir)/$@ |
439 |
– |
endif |
485 |
|
|
486 |
|
# .o -> .so |
487 |
< |
$(LibDir)/%.so : $(ObjectFiles) |
487 |
> |
$(LibDir)/%_UP.so : $(ObjectFiles) |
488 |
|
$(DynamicArchiver) $(ObjectFiles) $(DynamicArchiverOptions) -o $@ |
489 |
|
|
490 |
< |
$(ParallelLibDir)/%.so : $(ParallelObjectFiles) |
490 |
> |
$(LibDir)/%_MPI.so : $(ParallelObjectFiles) |
491 |
|
$(DynamicArchiver) $(ParallelObjectFiles) $(DynamicArchiverOptions) -o $@ |
492 |
|
|
493 |
< |
ifeq "$(UseMPI)" "yes" |
449 |
< |
%.so : $(ObjectFiles) $(ParallelObjectFiles) |
493 |
> |
%_UP.so : $(ObjectFiles) |
494 |
|
$(MAKE) $(MakeOptions) $(LibDir)/$@ |
495 |
< |
$(MAKE) $(MakeOptions) $(ParallelLibDir)/$@ |
496 |
< |
else |
453 |
< |
%.so : $(ObjectFiles) |
495 |
> |
|
496 |
> |
%_MPI.so : $(ParallelObjectFiles) |
497 |
|
$(MAKE) $(MakeOptions) $(LibDir)/$@ |
455 |
– |
endif |
498 |
|
|
499 |
|
# .class -> .jar |
500 |
|
$(LibDir)/%.jar : $(JavaClassFiles) $(OtherTargetFiles) |
528 |
|
%_Skel.class : %.class |
529 |
|
$(MAKE) $(MakeOptions) $(PackageTargetDir)/$@ |
530 |
|
|
531 |
+ |
document : |
532 |
+ |
$(Print) Generate Documentation for OOPSE-2.0 |
533 |
+ |
@cd $(DEV_ROOT)/src |
534 |
+ |
$(Doxygen) $(DEV_ROOT)/make/Doxyfile |
535 |
+ |
|
536 |
+ |
#GUN make funtions to merge the libraries |
537 |
+ |
find_objs = $(shell $(StaticArchiver) -t $(1)) |
538 |
+ |
extract_objs = $(shell $(StaticArchiver) -x $(1) $(call find_objs, $(1))) |
539 |
+ |
create_archive = $(shell $(StaticArchiver) $(StaticArchiverOptions) $(2) $(call find_objs, $(1))) |
540 |
+ |
remove_objs = $(shell $(Delete) $(call find_objs, $(1))) |
541 |
+ |
do_create = $(call extract_objs,$(1))$(call create_archive,$(1),$(2))$(call remove_objs,$(1)) |
542 |
+ |
|
543 |
+ |
$(CombinedStaticLib) : $(LibDir)/.stamp_UP |
544 |
+ |
$(Print) create $@ |
545 |
+ |
$(foreach thisLib,$(LibNames),$(call do_create,$(thisLib),$@)) |
546 |
+ |
$(Ranlib) $(CombinedStaticLib) |
547 |
+ |
|
548 |
+ |
$(CombinedParallelStaticLib) : $(LibDir)/.stamp_MPI |
549 |
+ |
$(Print) create $@ |
550 |
+ |
$(foreach thisLib,$(ParallelLibNames), $(call do_create, $(thisLib), $@)) |
551 |
+ |
$(Ranlib) $(CombinedParallelStaticLib) |
552 |
+ |
|
553 |
|
# Executable |
554 |
< |
$(Executable) : $(ObjectFiles) |
555 |
< |
$(Linker) $(ObjectFiles) $(LinkOptions) $(LibDirs) $(LibList) -o $@ |
554 |
> |
$(Executable) : $(CombinedStaticLib) $(ObjectFiles) |
555 |
> |
$(Linker) $(ObjectFiles) $(LinkOptions) $(LibDirs) $(CombinedStaticLib) $(Libraries) -o $@ |
556 |
|
|
557 |
< |
$(ParallelExecutable) : $(ParallelObjectFiles) |
558 |
< |
$(Linker) $(ParallelObjectFiles) $(ParallelLinkOptions) $(ParallelLibDirs) $(LibList) -o $@ |
557 |
> |
$(ParallelExecutable) : $(CombinedParallelStaticLib) $(ParallelObjectFiles) |
558 |
> |
$(Linker) $(ParallelObjectFiles) $(ParallelLinkOptions) $(LibDirs) $(CombinedParallelStaticLib) $(Libraries) -o $@ |
559 |
|
|
560 |
|
# Anything else is just copied from source to target |
561 |
|
$(PackageTargetDir)/% : $(PackageSourceDir)/% |
568 |
|
|
569 |
|
_all : _buildall |
570 |
|
|
571 |
+ |
_buildall : |
572 |
|
ifeq "$(UseMPI)" "yes" |
573 |
|
_buildall : \ |
574 |
|
$(DependencyFile) \ |
579 |
|
$(RmiStubFiles) \ |
580 |
|
$(RmiSkeletonFiles) \ |
581 |
|
$(OtherTargetFiles) \ |
517 |
– |
$(SharedLibrary) \ |
582 |
|
$(StaticLibrary) \ |
519 |
– |
$(ParallelSharedLibrary) \ |
583 |
|
$(ParallelStaticLibrary) \ |
584 |
|
$(JarFile) \ |
585 |
|
$(Executable) \ |
593 |
|
$(RmiStubFiles) \ |
594 |
|
$(RmiSkeletonFiles) \ |
595 |
|
$(OtherTargetFiles) \ |
533 |
– |
$(SharedLibrary) \ |
596 |
|
$(StaticLibrary) \ |
597 |
|
$(JarFile) \ |
598 |
|
$(Executable) |
633 |
|
$(Print) $@ |
634 |
|
@cd $(PackageSourceDir) |
635 |
|
|
574 |
– |
@touch Make.ctemp |
575 |
– |
@touch Make.ctemp |
576 |
– |
|
636 |
|
ifneq "$(words $(CppFiles))" "0" |
637 |
< |
$(CppCompiler) $(IncludePath) -MM $(CppFiles) > Make.cpptemp |
638 |
< |
cat Make.cpptemp | sed 's/^[a-zA-Z0-9]/$$\(DEV_ROOT\)\/obj\/&/g' >> $(DependencyFile) |
639 |
< |
cat Make.cpptemp | sed 's/^[a-zA-Z0-9]/$$\(DEV_ROOT\)\/MPIobj\/&/g' >> $(DependencyFile) |
637 |
> |
$(CppCompiler) $(CppOptions) $(IncludePath) -MM $(CppFiles) > Make.cpptemp |
638 |
> |
@cat Make.cpptemp | sed 's/^[a-zA-Z0-9]/$$\(TargetDir\)\/&/g' >> $(DependencyFile) |
639 |
> |
$(Delete) Make.cpptemp |
640 |
> |
$(CppCompiler) $(CppParallelOptions) $(IncludePath) -MM $(CppFiles) > Make.cpptemp |
641 |
> |
@cat Make.cpptemp | sed 's/^[a-zA-Z0-9]/$$\(ParallelTargetDir\)\/&/g' >> $(DependencyFile) |
642 |
> |
@$(Delete) Make.cpptemp |
643 |
|
endif |
644 |
|
|
645 |
|
ifneq "$(words $(CFiles))" "0" |
646 |
< |
$(CCompiler) $(IncludePath) -MM $(CFiles) $(DerivedCFiles) > Make.ctemp |
647 |
< |
cat Make.ctemp | sed 's/^[a-zA-Z0-9]/$$\(DEV_ROOT\)\/obj\/&/g' >> $(DependencyFile) |
648 |
< |
cat Make.ctemp | sed 's/^[a-zA-Z0-9]/$$\(DEV_ROOT\)\/MPIobj\/&/g' >> $(DependencyFile) |
649 |
< |
|
646 |
> |
$(CCompiler) $(COptions) $(IncludePath) -MM $(CFiles) $(DerivedCFiles) > Make.ctemp |
647 |
> |
@cat Make.ctemp | sed 's/^[a-zA-Z0-9]/$$\(TargetDir\)\/&/g' >> $(DependencyFile) |
648 |
> |
$(Delete) Make.ctemp |
649 |
> |
$(CCompiler) $(CParallelOptions) $(IncludePath) -MM $(CFiles) $(DerivedCFiles) > Make.ctemp |
650 |
> |
@cat Make.ctemp | sed 's/^[a-zA-Z0-9]/$$\(ParallelTargetDir\)\/&/g' >> $(DependencyFile) |
651 |
> |
@$(Delete) Make.ctemp |
652 |
|
endif |
653 |
|
|
654 |
|
ifneq "$(words $(F90Files))" "0" |
655 |
< |
$(DEV_ROOT)/scripts/filepp -I $(DEV_ROOT)/src -od '$$(DEV_ROOT)/obj/' -D__FORTRAN90 $(F90Files) > Make.ftemp |
656 |
< |
$(DEV_ROOT)/scripts/filepp -I $(DEV_ROOT)/src -od '$$(DEV_ROOT)/MPIobj/' -DIS_MPI -D__FORTRAN90 $(F90Files) >> Make.ftemp |
657 |
< |
cat Make.ftemp >> $(DependencyFile) |
655 |
> |
$(DEV_ROOT)/scripts/filepp -I $(DEV_ROOT)/src -od '$$(TargetDir)/' $(F90Declare) -mc $(ModuleCase) -ms $(ModSuffix) $(F90Files) > Make.ftemp |
656 |
> |
$(DEV_ROOT)/scripts/filepp -I $(DEV_ROOT)/src -od '$$(ParallelTargetDir)/' $(ParallelDeclare) $(F90Declare) -mc $(ModuleCase) -ms $(ModSuffix) $(F90Files) >> Make.ftemp |
657 |
> |
@cat Make.ftemp >> $(DependencyFile) |
658 |
> |
@$(Delete) Make.ftemp |
659 |
|
endif |
595 |
– |
$(Delete) Make.cpptemp Make.ctemp Make.ftemp |
660 |
|
|
661 |
|
# make lib |
662 |
|
lib : $(PackageListLoop) |
669 |
|
jarsign : $(JarFile) |
670 |
|
$(JarSigner) -keystore GeoSoftKeystore $(JarFile) myself |
671 |
|
|
672 |
+ |
#make install |
673 |
+ |
%.install : |
674 |
+ |
@$(MAKE) $(MakeOptions) -C $(subst .install,,$@) _installall |
675 |
+ |
|
676 |
+ |
install : $(InstallListLoop) |
677 |
+ |
$(Print) Done Install |
678 |
+ |
|
679 |
+ |
_installall : _buildall _installdata |
680 |
+ |
|
681 |
+ |
$(MyInstallDir) : |
682 |
+ |
$(MkDir) $@ |
683 |
+ |
|
684 |
+ |
_installdata : $(MyInstallDir) |
685 |
+ |
$(Print) $(InstallFiles) |
686 |
+ |
ifneq "$(words $(InstallFiles))" "0" |
687 |
+ |
$(InstallData) $(InstallFiles) $(MyInstallDir) |
688 |
+ |
endif |
689 |
+ |
|
690 |
|
# make statistics |
691 |
|
_statisticsall : |
692 |
< |
@$(Print) $(SourceFiles) >> $(DEV_ROOT)/files.tmp |
692 |
> |
@$(Print) $(patsubst %,$(CurrentDir)/%,$(SourceFiles)) >> $(DEV_ROOT)/files.tmp |
693 |
|
|
694 |
|
statistics : $(PackageListLoop) |
695 |
|
@$(List) $(DEV_ROOT)/files.tmp | xargs $(WordCount) $(WordCountOptions) |