ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/OpenMD/branches/development/make/Makefile.in
Revision: 1468
Committed: Sat Jul 17 15:33:45 2010 UTC (15 years ago) by gezelter
File size: 28776 byte(s)
Log Message:
added nonbonded directory

File Contents

# Content
1 #---------------------------------------------------------------------------
2 # (C) 1999 - 2002 Jacob Dreyer - Geotechnical Software Services
3 # jacob.dreyer@geosoft.no - http://geosoft.no
4 #
5 # This program is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU General Public License
7 # as published by the Free Software Foundation; either version 2
8 # of the License, or (at your option) any later version.
9 #
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 59 Temple Place - Suite 330, Boston,
18 # MA 02111-1307, USA.
19 #---------------------------------------------------------------------------
20 #---------------------------------------------------------------------------
21 #
22 # GnuMake crash course:
23 #
24 # target : depends
25 # rule
26 #
27 # target - the parameter given to make. I.e. what to build
28 # depends - file or other targets target depends on
29 # rule - how to create target (note that rule is preceeded by a TAB char)
30 # $(VAR) - environment variable or variable defined above
31 # $@ - Current target
32 # $* - Current target without extension
33 # $< - Current dependency
34 #
35 #---------------------------------------------------------------------------
36 IS_UNIX=1
37
38 #packages containing libraries
39 PackageLibs = \
40 utils \
41 visitors \
42 math \
43 types \
44 primitives \
45 nonbonded \
46 UseTheForce/DarkSide \
47 UseTheForce \
48 brains \
49 io \
50 integrators \
51 constraints \
52 minimizers \
53 selection \
54 restraints \
55 lattice \
56 hydrodynamics \
57 antlr \
58 mdParser
59
60 #packages containing applications
61 Applications = \
62 applications/openmd \
63 applications/dump2Xyz \
64 applications/staticProps \
65 applications/dynamicProps \
66 applications/simpleBuilder \
67 applications/randomBuilder \
68 applications/nanoparticleBuilder \
69 applications/thermalizer \
70 applications/atom2md \
71 applications/hydrodynamics \
72 applications/utilities
73
74 Samples = \
75 samples/builders \
76 samples/alkane \
77 samples/argon \
78 samples/cutoff \
79 samples/dipole \
80 samples/gbljtest \
81 samples/lipid \
82 samples/metals/EAM \
83 samples/metals/EAM/nanoparticle \
84 samples/metals/EAM/nanorod \
85 samples/metals/Sutton-Chen \
86 samples/metals/surfaces \
87 samples/metals/minimizer \
88 samples/minimizer \
89 samples/thermoIntegration/liquid \
90 samples/thermoIntegration/solid \
91 samples/water/dimer \
92 samples/water/spce \
93 samples/water/ssd \
94 samples/water/ssde \
95 samples/water/ssdrf \
96 samples/water/ssd-ion \
97 samples/water/tip3p_ice \
98 samples/water/tip4p \
99 samples/zcons \
100 samples/bond-order \
101 samples/Madelung \
102 samples/RNEMD \
103 samples/SMIPD \
104 samples/zeolite
105
106
107 IncludeDirs = \
108 @FFTW_INC_DIR@ \
109 @QHULL_INC_DIR@ \
110 @OPENBABEL_INC_DIR@ \
111 @ZLIB_INC_DIR@
112
113 LibraryDirs = \
114 @FFTW_LIB_DIR@ \
115 @QHULL_LIB_DIR@ \
116 @OPENBABEL_LIB_DIR@ \
117 @ZLIB_LIB_DIR@
118
119 Libraries = \
120 @LIBS@ \
121 @FFTW_LIBS@ \
122 @QHULL@ \
123 @OPENBABEL_LIB@ \
124 @ZLIB@
125
126 OpenMDHome = @OPENMD_HOME@
127 ForceParamDir = $(OpenMDHome)/forceFields
128 SampleSimDir = $(OpenMDHome)/samples
129 InstallBinDir = $(OpenMDHome)/bin
130 InstallDocDir = $(OpenMDHome)/doc
131 SvnDeclare :=-DSVN_REV="$(shell svnversion -n . | sed -e "s/.*://" -e "s/\([0-9]*\).*/\1/" | grep "[0-9]")"
132 FrcDeclare = -DFRC_PATH="$(ForceParamDir)"
133 F90Declare = -D__FORTRAN90
134 UseSingle = @USE_SINGLE_PRECISION@
135 ifeq "$(UseSingle)" "yes"
136 SingleDeclare = -DSINGLE_PRECISION
137 else
138 SingleDeclare =
139 endif
140 ParallelDeclare = -DIS_MPI
141 SinglePrecision = -DSINGLE_PRECISION
142 UseMPI = @USE_MPI@
143 ModuleCase = @F90_MODULE_NAMES@
144 ModSuffix = @MOD@
145 LinkOptions = \
146 @LDFLAGS@ \
147 @FCLIBS@ \
148 @CXXFLAGS@
149
150
151
152 ParallelLinkOptions = \
153 @LDFLAGS@ \
154 @FCLIBS@ \
155 @CXXFLAGS@
156
157 #---------------------------------------------------------------------------
158 #
159 # Directories
160 #
161 #---------------------------------------------------------------------------
162
163 SourceDir = $(DEV_ROOT)/src
164 TargetDir = $(DEV_ROOT)/obj
165 ParallelTargetDir = $(DEV_ROOT)/MPIobj
166 LibDir = $(DEV_ROOT)/lib
167 MakeDir = $(DEV_ROOT)/make
168 MainMakefile = $(MakeDir)/Makefile
169 BinDir = $(DEV_ROOT)/bin
170 DocDir = $(DEV_ROOT)/doc
171 CurrentDir = $(CURDIR)
172 CombinedStaticLib = $(LibDir)/libopenmd.a
173 CombinedParallelStaticLib = $(LibDir)/libopenmd_MPI.a
174
175 ifdef Source
176 #get the relative path of current package to source directory
177 # /home/maul/gezelter/src/code/src/UseTheForce/Darkside --> UseTheForce/Darkside
178 #Package = $(shell echo $(CurrentDir) | sed -e 's/^.*\/src\/\(.*\)/\1/g')
179 #use shell script to get the absolute path and then rip it off from $(CurrentDir)
180 #Package = $(subst $(shell cd $(SourceDir); pwd)/,,$(CurrentDir))
181 # REMINDER: We are now using the Package line in each subdir makefile.
182 # This avoids the strange path problem and the subshell
183
184 PackageList = $(Package)
185 PackageSourceDir = $(SourceDir)/$(Package)
186 PackageTargetDir = $(TargetDir)
187 PackageParallelTargetDir = $(ParallelTargetDir)
188 JavaMainClass = $(subst /,.,$(Package)).$(Main)
189 else
190 PackageList = $(PackageLibs) $(JavaPackages) $(Applications)
191 endif
192
193 PackageListLoop = $(patsubst %,$(SourceDir)/%/.loop,$(PackageList))
194
195 JRE = $(JAVA_HOME)/jre/lib/rt.jar
196
197 ifdef IS_UNIX
198 X = :
199 else
200 X = \;
201 endif
202
203 #---------------------------------------------------------------------------
204 #
205 # Classification of files
206 #
207 #---------------------------------------------------------------------------
208
209 # Source
210 JavaFiles = $(filter %.java, $(Source))
211 CppFiles = $(filter %.cpp, $(Source))
212 CFiles = $(filter %.c, $(Source))
213 FortranFiles = $(filter %.f, $(Source))
214 F90Files = $(filter %.F90, $(Source))
215 CorbaFiles = $(filter %.idl, $(Source))
216 LexFiles = $(filter %.l, $(Source))
217 YaccFiles = $(filter %.y, $(Source))
218 OtherSourceFiles = $(filter-out $(JavaFiles) $(CppFiles) $(CFiles) \
219 $(FortranFiles) $(F90Files) $(LexFiles) \
220 $(YaccFiles) $(CorbaFiles), \
221 $(Source))
222 ManifestFile = $(PackageSourceDir)/Manifest
223
224 SourceFiles = $(JavaFiles)\
225 $(CppFiles)\
226 $(CFiles)\
227 $(FortranFiles)\
228 $(F90Files)\
229 $(LexFiles)\
230 $(YaccFiles)
231
232 # Target
233 JavaClassFiles = $(JavaFiles:%.java= $(PackageTargetDir)/%.class)
234 JavaClassFilesRel = $(JavaFiles:%.java= $(Package)/%.class)
235 RmiStubFiles = $(RmiSource:%.java= $(PackageTargetDir)/%_Stub.class)
236 RmiSkeletonFiles = $(RmiSource:%.java= $(PackageTargetDir)/%_Skel.class)
237 JniClassFiles = $(JniSource:%.java= $(PackageTargetDir)/%.class)
238 JniHeaders = $(JniSource:%.java= $(PackageSourceDir)/%.h)
239 ObjectFiles = $(CFiles:%.c= $(PackageTargetDir)/%.o)\
240 $(CppFiles:%.cpp= $(PackageTargetDir)/%.o)\
241 $(FortranFiles:%.f= $(PackageTargetDir)/%.o)\
242 $(F90Files:%.F90= $(PackageTargetDir)/%.o)\
243 $(LexFiles:%.l= $(PackageTargetDir)/%.o)\
244 $(YaccFiles:%.y= $(PackageTargetDir)/%.o)
245 ParallelObjectFiles = $(CFiles:%.c= $(PackageParallelTargetDir)/%.o)\
246 $(CppFiles:%.cpp= $(PackageParallelTargetDir)/%.o)\
247 $(FortranFiles:%.f= $(PackageParallelTargetDir)/%.o)\
248 $(F90Files:%.F90= $(PackageParallelTargetDir)/%.o)\
249 $(LexFiles:%.l= $(PackageParallelTargetDir)/%.o)\
250 $(YaccFiles:%.y= $(PackageParallelTargetDir)/%.o)
251
252 DerivedSource = $(YaccFiles:%.y= %.h) \
253 $(YaccFiles:%.y= %.c) \
254 $(LexFiles:%.l= %.c)
255
256 DerivedCFiles = $(YaccFiles:%.y= %.c) \
257 $(LexFiles:%.l= %.c)
258
259 OtherTargetFiles = $(OtherSourceFiles:%=$(PackageTargetDir)/%)
260
261 ###########################################################################
262 #
263 # Figure out the names of the module files based on some work done by
264 # configure. The tr function below is from John Graham-Cumming
265 # (http://www.jgc.org).
266 #
267 # The tr function. Has three arguments:
268 #
269 # $1 The list of characters to translate from
270 # $2 The list of characters to translate to
271 # $3 The text to translate
272 #
273 # For example, $(call tr,A B C,1 2 3,CAPITAL) becomes 21PIT1L.
274
275 tr = $(eval __t := $3) \
276 $(foreach c, \
277 $(join $(addsuffix :,$1),$2), \
278 $(eval __t := \
279 $(subst $(word 1,$(subst :, ,$c)),$(word 2,$(subst :, ,$c)), \
280 $(__t))))$(__t)
281
282 # Common character classes for use with the tr function. Each of
283 # these is actually a variable declaration and must be wrapped with
284 # $() or ${} to be used.
285
286 [A-Z] := A B C D E F G H I J K L M N O P Q R S T U V W X Y Z #
287 [a-z] := a b c d e f g h i j k l m n o p q r s t u v w x y z #
288 [0-9] := 0 1 2 3 4 5 6 7 8 9 #
289 [A-F] := A B C D E F #
290
291 # Figure out whether we have $(eval) or not (GNU Make 3.80 and above)
292 # if we do not then we need to use the shell version of tr, and not the
293 # faster tr function above:
294
295 __have_eval := $(false)
296 __ignore := $(eval __have_eval := $(true))
297
298 ifndef __have_eval
299 uc = $(shell echo $1 | tr "a-z" "A-Z")
300 lc = $(shell echo $1 | tr "A-Z" "a-z")
301 else
302 uc = $(call tr,$([a-z]),$([A-Z]),$1)
303 lc = $(call tr,$([A-Z]),$([a-z]),$1)
304 endif
305
306 # OK, now we can actually use these functions to figure out the names
307 # of the module files:
308
309 ifneq "$(words $(Modules))" "0"
310 ifeq "$(ModuleCase)" "UPPER"
311 MODULES = $(call uc,$(Modules))
312 else
313 ifeq "$(ModuleCase)" "lower"
314 MODULES = $(call lc,$(Modules))
315 else
316 MODULES = $(Modules)
317 endif
318 endif
319 ModuleFiles = $(MODULES:%= $(PackageTargetDir)/%.$(ModSuffix))
320 ParallelModuleFiles = $(MODULES:%= $(PackageParallelTargetDir)/%.$(ModSuffix))
321 endif
322 #
323 ###########################################################################
324
325 ThirdPartyJarsTmp = $(patsubst %,$(LibDir)/%,$(JavaLibraries))
326 ThirdPartyJars = $(subst $(Space),$(X),$(ThirdPartyJarsTmp))
327
328 ifneq "$(words $(JavaFiles))" "0"
329 JavaPackageName = $(subst /,.,$(Package))
330 JarFile = $(LibDir)/$(subst /,,$(Package)).jar
331 endif
332
333 #if Main is defined, do not build library. It may not be true sometimes
334 ifneq "$(words $(ObjectFiles) $(ParallelObjectFiles))" "0"
335 DependencyFile = $(PackageSourceDir)/Makedepend
336 ifneq "$(words $(Main))" "0"
337 Executable = $(BinDir)/$(Main)
338 ifeq "$(BuiltParallelExe)" "1"
339 ParallelExecutable = $(BinDir)/$(Main)_MPI
340 endif
341 else
342 SharedLibrary = $(LibDir)/lib$(subst /,,$(patsubst %,openmd_%,$(Package)))_UP.so
343 StaticLibrary = $(LibDir)/lib$(subst /,,$(patsubst %,openmd_%,$(Package)))_UP.a
344 ParallelSharedLibrary = $(LibDir)/lib$(subst /,,$(patsubst %,openmd_%,$(Package)))_MPI.so
345 ParallelStaticLibrary = $(LibDir)/lib$(subst /,,$(patsubst %,openmd_%,$(Package)))_MPI.a
346 endif
347 endif
348
349 #
350 # Misc
351 #
352 ClassPath = $(JRE)$(X)$(TargetDir)$(X)$(ThirdPartyJars)
353 JavaPackageNames = $(subst /,.,$(JavaPackages))
354 IncludePath = -I$(SourceDir) $(IncludeDirs:%=-I%)
355 LibDirs = -L$(LibDir) $(LibraryDirs:%=-L%)
356 LocalLibs = $(subst /,,$(patsubst %, openmd_%_UP, $(PackageLibs)))
357 ParallelLocalLibs= $(subst /,,$(patsubst %, openmd_%_MPI, $(PackageLibs)))
358 LibList = $(LocalLibs:%=-l%) $(Libraries)
359 LibNames = $(LocalLibs:%=$(LibDir)/lib%.a)
360 ParallelLibList = $(ParallelLocalLibs:%=-l%) $(Libraries)
361 ParallelLibNames = $(ParallelLocalLibs:%=$(LibDir)/lib%.a)
362
363
364 #---------------------------------------------------------------------------
365 #
366 # Tools & Options
367 #
368 #---------------------------------------------------------------------------
369 Print = @echo
370 Move = mv -f
371 Copy = cp
372 CCompiler = @CC@
373 CppCompiler = @CXX@
374 Linker = @CXX@
375 MakeDepend = makedepend
376 LN_S = @LN_S@
377 INSTALL = @INSTALL@
378 EGREP = @EGREP@
379 InstallProgram = @INSTALL_PROGRAM@
380 InstallScript = @INSTALL_SCRIPT@
381 InstallData = @INSTALL_DATA@
382 MkDir = @MKINSTALLDIRS@
383 Delete = rm -f
384 StaticArchiver = @AR@
385 DynamicArchiver = @CC@
386 FortranCompiler = @FC@
387 JavaCompiler = $(JAVA_HOME)/bin/javac
388 JavaArchiver = $(JAVA_HOME)/bin/jar
389 JarSigner = $(JAVA_HOME)/bin/jarsigner
390 JavadocGenerator = $(JAVA_HOME)/bin/javadoc
391 JniCompiler = $(JAVA_HOME)/bin/javah
392 RmiCompiler = $(JAVA_HOME)/bin/rmic
393 JavaExecute = $(JAVA_HOME)/bin/java
394 Purify = purify
395 WordCount = wc
396 List = cat
397 Yacc = @YACC@
398 Lex = @LEX@
399 Ranlib = @RANLIB@
400 Doxygen = @DOXYGEN@
401
402 MakeOptions = -k
403 MakeDependOptions =
404 StaticArchiverOptions = rc
405 DynamicArchiverOptions = -shared
406 JavaArchiverOptions =
407 JniOptions =
408 RmiOptions = -d $(TargetDir) -classpath $(ClassPath) \
409 -sourcepath $(SourceDir)
410 COptions = $(SvnDeclare) $(FrcDeclare) $(SingleDeclare) @CFLAGS@
411 CParallelOptions = $(SvnDeclare) $(FrcDeclare) $(SingleDeclare) $(ParallelDeclare) @CFLAGS@
412 CppOptions = $(SvnDeclare) $(FrcDeclare) $(SingleDeclare) @CXXFLAGS@
413 CppParallelOptions = $(SvnDeclare) $(FrcDeclare) $(SingleDeclare) $(ParallelDeclare) @CXXFLAGS@
414 ifeq "$(UseSingle)" "yes"
415 FortranOptions = @FCFLAGS@ @MODDIRFLAG@$(SourceDir) @MODDIRFLAG@$(TargetDir) @PREPDEFFLAG@$(SingleDeclare) @FCFLAGS_SRCEXT@
416 FortranParallelOptions = @FCFLAGS@ @MODDIRFLAG@$(SourceDir) @MODDIRFLAG@$(ParallelTargetDir) @PREPDEFFLAG@$(SingleDeclare) @PREPDEFFLAG@$(ParallelDeclare) @FCFLAGS_SRCEXT@
417 else
418 FortranOptions = @FCFLAGS@ @MODDIRFLAG@$(SourceDir) @MODDIRFLAG@$(TargetDir) @FCFLAGS_SRCEXT@
419 FortranParallelOptions = @FCFLAGS@ @MODDIRFLAG@$(SourceDir) @MODDIRFLAG@$(ParallelTargetDir) @PREPDEFFLAG@$(ParallelDeclare) @FCFLAGS_SRCEXT@
420 endif
421 JavaCompilerOptions = -d $(TargetDir) -classpath $(ClassPath) \
422 -sourcepath $(SourceDir) -deprecation
423 JavaRunOptions = -classpath $(ClassPath)
424 PurifyOptions =
425 JavadocOptions = -d $(DocDir) \
426 -sourcepath $(SourceDir) \
427 -classpath $(ClassPath) \
428 -author \
429 -package \
430 -use \
431 -splitIndex \
432 -version \
433 -link file:$(JAVA_HOME)/docs/api \
434 -windowtitle $(JavadocWindowTitle) \
435 -doctitle $(JavadocDocTitle) \
436 -header $(JavadocHeader) \
437 -bottom $(JavadocFooter)
438 WordCountOptions = -l
439
440 Empty =
441 Space = $(Empty) $(Empty)
442
443
444 #---------------------------------------------------------------------------
445 #
446 # Install
447 #
448 #---------------------------------------------------------------------------
449
450 ifneq "$(words $(SampleFiles))" "0"
451 MySample = $(subst $(shell cd $(DEV_ROOT)/samples; pwd)/,,$(CurrentDir))
452 MyInstallDir = $(SampleSimDir)/$(MySample)
453 InstallFiles = $(SampleFiles)
454 InstallCommand = $(InstallData)
455 endif
456
457 ifneq "$(words $(ScriptFiles))" "0"
458 MyInstallDir = $(InstallBinDir)
459 InstallFiles = $(ScriptFiles)
460 InstallCommand = $(InstallProgram)
461 endif
462
463 ifneq "$(words $(DocFiles))" "0"
464 MyInstallDir = $(InstallDocDir)
465 InstallFiles = $(DocFiles)
466 InstallCommand = $(InstallData)
467 endif
468
469 ifneq "$(words $(RootFiles))" "0"
470 MyInstallDir = $(OpenMDHome)
471 InstallFiles = $(RootFiles)
472 InstallCommand = $(InstallData)
473 endif
474
475 ifneq "$(words $(Main))" "0"
476 MyInstallDir = $(InstallBinDir)
477 ifeq "$(UseMPI)" "yes"
478 InstallFiles = $(Executable) $(ParallelExecutable)
479 else
480 InstallFiles = $(Executable)
481 endif
482 InstallCommand = $(InstallProgram)
483 ifneq "$(words $(LinkTargets))" "0"
484 MyLinkSource = $(patsubst %, $(MyInstallDir)/%,$(Main))
485 MyLinkTargets = $(patsubst %, $(MyInstallDir)/%,$(LinkTargets))
486 endif
487 endif
488
489 ifneq "$(words $(ForcefieldFiles))" "0"
490 MyInstallDir = $(ForceParamDir)
491 InstallFiles = $(ForcefieldFiles)
492 InstallCommand = $(InstallData)
493 endif
494
495 ifeq "$(words $(InstallFiles))" "0"
496 InstallList =
497 else
498 InstallList = $(patsubst %,$(DEV_ROOT)/%,$(Samples)) $(DEV_ROOT)/forceFields $(DocDir) $(patsubst %, $(SourceDir)/%,$(Applications)) $(DEV_ROOT)
499 endif
500
501 InstallListLoop = $(patsubst %,$(SourceDir)/%/.install,$(PackageList)) $(patsubst %,%/.install,$(InstallList))
502
503
504
505 #---------------------------------------------------------------------------
506 #
507 # Rules
508 #
509 #---------------------------------------------------------------------------
510 default : build
511
512 %.loop :
513 @$(MAKE) $(MakeOptions) -C $(subst .loop,,$@) _$(MAKECMDGOALS)all
514
515 # Create target directory
516 $(PackageTargetDir) :
517 $(MkDir) $@
518
519 $(BinDir) :
520 $(MkDir) $@
521
522 # .c -> .o
523 $(PackageTargetDir)/%.o : %.c $(MainMakefile)
524 $(Print) $@
525 $(CCompiler) $(COptions) -c $(IncludePath) $< -o $@
526
527 $(PackageParallelTargetDir)/%.o : %.c $(MainMakefile)
528 $(Print) $@
529 $(CCompiler) $(CParallelOptions) -c $(IncludePath) $< -o $@
530
531 ifeq "$(UseMPI)" "yes"
532 %.o : %.c $(MainMakefile)
533 $(MAKE) $(MakeOptions) $(PackageTargetDir)/$@
534 $(MAKE) $(MakeOptions) $(PackageParallelTargetDir)/$@
535 else
536 %.o : %.c $(MainMakefile)
537 $(MAKE) $(MakeOptions) $(PackageTargetDir)/$@
538 endif
539
540 # .cpp -> .o
541 $(PackageTargetDir)/%.o : %.cpp $(MainMakefile)
542 $(CppCompiler) $(CppOptions) -c $(IncludePath) $< -o $@
543
544 $(PackageParallelTargetDir)/%.o : %.cpp $(MainMakefile)
545 $(CppCompiler) $(CppParallelOptions) -c $(IncludePath) $< -o $@
546
547 ifeq "$(UseMPI)" "yes"
548 %.o : %.cpp $(MainMakefile)
549 $(MAKE) $(MakeOptions) $(PackageTargetDir)/$@
550 $(MAKE) $(MakeOptions) $(PackageParallelTargetDir)/$@
551 else
552 %.o : %.cpp $(MainMakefile)
553 $(MAKE) $(MakeOptions) $(PackageTargetDir)/$@
554 endif
555
556 # .f -> .o
557 $(PackageTargetDir)/%.o : %.f $(MainMakefile)
558 $(FortranCompiler) $(FortranOptions) -c $< -o $@
559
560 $(PackageParallelTargetDir)/%.o : %.f $(MainMakefile)
561 $(FortranCompiler) $(FortranParallelOptions) -c $< -o $@
562
563 ifeq "$(UseMPI)" "yes"
564 %.o : %.f $(MainMakefile)
565 $(MAKE) $(MakeOptions) $(PackageTargetDir)/$@
566 $(MAKE) $(MakeOptions) $(PackageParallelTargetDir)/$@
567 else
568 %.o : %.f $(MainMakefile)
569 $(MAKE) $(MakeOptions) $(PackageTargetDir)/$@
570 endif
571
572 # .F90 -> .o
573 $(PackageTargetDir)/%.o : %.F90 $(MainMakefile)
574 $(FortranCompiler) $(FortranOptions) $(IncludePath) -c $< -o $@
575 if test -n "`ls *.$(ModSuffix)`"; then \
576 $(Move) `ls *.$(ModSuffix)` $(PackageTargetDir);\
577 fi
578
579 $(PackageParallelTargetDir)/%.o : %.F90 $(MainMakefile)
580 $(FortranCompiler) $(FortranParallelOptions) $(IncludePath) -c $< -o $@
581 if test -n "`ls *.$(ModSuffix)`"; then \
582 $(Move) "`ls *.$(ModSuffix)`" $(PackageParallelTargetDir);\
583 fi
584
585 ifeq "$(UseMPI)" "yes"
586 %.o : %.F90 $(MainMakefile)
587 $(MAKE) $(MakeOptions) $(PackageTargetDir)/$@
588 if test -n "`ls *.$(ModSuffix)`"; then\
589 $(Move) "`ls *.$(ModSuffix)`" $(PackageTargetDir);\
590 fi
591
592 $(MAKE) $(MakeOptions) $(PackageParallelTargetDir)/$@
593 if test -n "`ls *.$(ModSuffix)`"; then\
594 $(Move) "`ls *.$(ModSuffix)`" $(PackageTargetDir);\
595 fi
596
597 else
598 %.o : %.F90 $(MainMakefile)
599 $(MAKE) $(MakeOptions) $(PackageTargetDir)/$@
600 if test -n "`ls *.$(ModSuffix)`"; then\
601 $(Move) "`ls *.$(ModSuffix)`" $(PackageTargetDir);\
602 fi
603 endif
604
605
606 # .java -> .class
607 $(PackageTargetDir)/%.class : $(PackageSourceDir)/%.java
608 $(JavaCompiler) $(JavaCompilerOptions) $<
609
610 %.class : $(PackageSourceDir)/%.java
611 @$(MAKE) $(MakeOptions) $(PackageTargetDir)/$@
612
613 # .class -> .h
614 $(PackageSourceDir)/%.h : $(PackageTargetDir)/%.class
615 $(JniCompiler) $(JniOptions) $(JavaPackageName).$*
616
617 %.h : %.class
618 $(MAKE) $(MakeOptions) $(PackageSourceDir)/$@
619
620 #.y -> .h
621 %.h : %.y
622 $(Yacc) -d $?
623 @$(Move) y.tab.h $*.h
624 @$(Delete) y.tab.c
625
626 #.y -> .c
627 %.c : %.y
628 $(Yacc) -d $?
629 @$(Move) y.tab.c $*.c
630 @$(Delete) y.tab.h
631
632 # .l -> .c
633 %.c : %.l
634 $(Print) $@
635 $(Print) $(Lex) -o$@ $?
636 @$(Lex) -o$@ $?
637
638 # .o -> .a
639
640 $(LibDir)/%_UP.a : $(ObjectFiles)
641 $(StaticArchiver) $(StaticArchiverOptions) $@ $(ObjectFiles)
642 @touch $(LibDir)/.stamp_UP
643
644 $(LibDir)/%_MPI.a: $(ParallelObjectFiles)
645 $(StaticArchiver) $(StaticArchiverOptions) $@ $(ParallelObjectFiles)
646 @touch $(LibDir)/.stamp_MPI
647
648 %_UP.a : $(ObjectFiles)
649 $(MAKE) $(MakeOptions) $(LibDir)/$@
650
651 %_MPI.a : $(ParallelObjectFiles)
652 $(MAKE) $(MakeOptions) $(LibDir)/$@
653
654 # .o -> .so
655 $(LibDir)/%_UP.so : $(ObjectFiles)
656 $(DynamicArchiver) $(ObjectFiles) $(DynamicArchiverOptions) -o $@
657
658 $(LibDir)/%_MPI.so : $(ParallelObjectFiles)
659 $(DynamicArchiver) $(ParallelObjectFiles) $(DynamicArchiverOptions) -o $@
660
661 %_UP.so : $(ObjectFiles)
662 $(MAKE) $(MakeOptions) $(LibDir)/$@
663
664 %_MPI.so : $(ParallelObjectFiles)
665 $(MAKE) $(MakeOptions) $(LibDir)/$@
666
667 # .class -> .jar
668 $(LibDir)/%.jar : $(JavaClassFiles) $(OtherTargetFiles)
669 $(Print) $@
670 @cd $(TargetDir); $(JavaArchiver) -cf $@ \
671 $(JavaClassFilesRel) $(OtherTargetFiles)
672
673 %.jar : $(JavaClassFiles) $(OtherTargetFiles)
674 $(MAKE) $(MakeOptions) $(LibDir)/$@
675
676 # .class -> JavaDoc
677 javadoc :
678 $(Print) $(JavaPackageNames) > $(DEV_ROOT)/packages.tmp
679 $(JavadocGenerator) $(JavadocOptions) @$(DEV_ROOT)/packages.tmp
680 $(Delete) $(DEV_ROOT)/packages.tmp
681 $(Print) Done JavaDoc.
682
683 # .class -> _Stub.class
684 $(PackageTargetDir)/%_Stub.class : $(PackageTargetDir)/%.class
685 $(Print) $@
686 $(RmiCompiler) $(RmiOptions) $(JavaPackageName).$*
687
688 %_Stub.class : %.class
689 $(MAKE) $(MakeOptions) $(PackageTargetDir)/$@
690
691 # .class -> _Skel.class
692 $(PackageTargetDir)/%_Skel.class : $(PackageTargetDir)/%.class
693 $(Print) $@
694 $(RmiCompiler) $(RmiOptions) $(JavaPackageName).$*
695
696 %_Skel.class : %.class
697 $(MAKE) $(MakeOptions) $(PackageTargetDir)/$@
698
699 document :
700 $(Print) Generate Documentation for OpenMD
701 @cd $(DEV_ROOT)/src
702 $(Doxygen) $(DEV_ROOT)/make/Doxyfile
703
704 #GUN make funtions to merge the libraries
705 find_objs = $(shell $(StaticArchiver) -t $(1) | $(EGREP) -v "SYMDEF")
706 extract_objs = $(shell $(StaticArchiver) -x $(1) $(call find_objs, $(1)))
707 create_archive = $(shell $(StaticArchiver) $(StaticArchiverOptions) $(2) $(call find_objs, $(1)))
708 remove_objs = $(shell $(Delete) $(call find_objs, $(1)))
709 do_create = $(call extract_objs,$(1))$(call create_archive,$(1),$(2))$(call remove_objs,$(1))
710 do_link = $(shell umask 022; $(LN_S) $(1) $(2))
711 all_objs = $(foreach thisLib,$(LibNames), $(call find_objs, $(thisLib)))
712 all_parallel_objs = $(foreach thisLib,$(ParallelLibNames), $(call find_objs, $(thisLib)))
713 all_lib_objs = $(patsubst %,$(TargetDir)/%,$(call all_objs))
714 all_lib_parallel_objs = $(patsubst %,$(ParallelTargetDir)/%,$(call all_parallel_objs))
715
716 $(CombinedStaticLib) : $(LibDir)/.stamp_UP
717 $(Print) creating $@
718 $(StaticArchiver) $(StaticArchiverOptions) $@ $(call all_lib_objs)
719 $(Ranlib) $(CombinedStaticLib)
720
721 $(CombinedParallelStaticLib) : $(LibDir)/.stamp_MPI
722 $(Print) creating $@
723 $(StaticArchiver) $(StaticArchiverOptions) $@ $(call all_lib_parallel_objs)
724 $(Ranlib) $(CombinedParallelStaticLib)
725
726 # Executable
727 $(Executable) : $(CombinedStaticLib) $(ObjectFiles)
728 if test ! -d $(BinDir); then \
729 $(MkDir) $(BinDir) ;\
730 fi
731 $(Linker) $(ObjectFiles) $(CombinedStaticLib) $(LinkOptions) $(LibDirs) $(Libraries) -o $@
732
733 $(ParallelExecutable) : $(CombinedParallelStaticLib) $(ParallelObjectFiles)
734 if test ! -d $(BinDir); then \
735 $(MkDir) $(BinDir) ;\
736 fi
737 $(Linker) $(ParallelObjectFiles) $(CombinedParallelStaticLib) $(ParallelLinkOptions) $(LibDirs) $(Libraries) -o $@
738
739 # Anything else is just copied from source to target
740 $(PackageTargetDir)/% : $(PackageSourceDir)/%
741 $(Print) $@
742 $(Copy) $< $@
743
744 # make (or make build)
745 build : $(PackageListLoop)
746 $(Print) Done build.
747
748 _all : _buildall
749
750 _buildall :
751 ifeq "$(UseMPI)" "yes"
752 _buildall : \
753 $(DependencyFile) \
754 $(PackageTargetDir) \
755 $(ObjectFiles) \
756 $(ParallelObjectFiles) \
757 $(JavaClassFiles) \
758 $(RmiStubFiles) \
759 $(RmiSkeletonFiles) \
760 $(OtherTargetFiles) \
761 $(StaticLibrary) \
762 $(ParallelStaticLibrary) \
763 $(JarFile) \
764 $(Executable) \
765 $(ParallelExecutable)
766 else
767 _buildall : \
768 $(DependencyFile) \
769 $(PackageTargetDir) \
770 $(ObjectFiles) \
771 $(JavaClassFiles) \
772 $(RmiStubFiles) \
773 $(RmiSkeletonFiles) \
774 $(OtherTargetFiles) \
775 $(StaticLibrary) \
776 $(JarFile) \
777 $(Executable)
778 endif
779
780 echo : $(PackageListLoop)
781 $(Print) Done echo.
782
783 _echoall :
784 $(Print) $(Modules)
785
786 # make clean
787 clean : $(PackageListLoop)
788 $(Print) Done clean.
789
790 _cleanall :
791 $(Delete) \
792 $(ObjectFiles) \
793 $(ModuleFiles) \
794 $(ParallelObjectFiles) \
795 $(ParallelModuleFiles) \
796 $(JarFile) \
797 $(SharedLibrary) \
798 $(StaticLibrary) \
799 $(ParallelSharedLibrary) \
800 $(ParallelStaticLibrary) \
801 $(CombinedStaticLib) \
802 $(CombinedParallelStaticLib)
803
804 # make distclean
805 distclean : $(PackageListLoop)
806 $(Print) Done clean.
807
808 _distcleanall : _cleanall
809 $(Delete) $(Executable) \
810 $(ParallelExecutable) \
811 $(DependencyFile)
812
813 # make depend
814 depend : $(PackageListLoop)
815 $(Print) Done dependencies.
816
817 _dependall : $(DependencyFile)
818
819 $(DependencyFile) : $(DerivedSource)
820 $(Print) $@
821 @cd $(PackageSourceDir)
822
823 ifneq "$(words $(CppFiles))" "0"
824 $(DEV_ROOT)/scripts/filepp -I $(DEV_ROOT)/src -od '$$(TargetDir)/' -MM $(CppFiles)>> Make.cpptemp
825 @cat Make.cpptemp >> $(DependencyFile)
826 $(Delete) Make.cpptemp
827
828 ifeq "$(UseMPI)" "yes"
829 $(DEV_ROOT)/scripts/filepp -I $(DEV_ROOT)/src -od '$$(ParallelTargetDir)/' $(ParallelDeclare) -MM $(CppFiles)>> Make.cpptemp
830 @cat Make.cpptemp >> $(DependencyFile)
831 @$(Delete) Make.cpptemp
832 endif
833
834 endif
835
836 ifneq "$(words $(CFiles))" "0"
837 $(DEV_ROOT)/scripts/filepp -I $(DEV_ROOT)/src -od '$$(TargetDir)/' -MM $(CFiles) $(DerivedCFiles) >> Make.ctemp
838 @cat Make.ctemp >> $(DependencyFile)
839 $(Delete) Make.ctemp
840
841 ifeq "$(UseMPI)" "yes"
842 $(DEV_ROOT)/scripts/filepp -I $(DEV_ROOT)/src -od '$$(ParallelTargetDir)/' $(ParallelDeclare) -MM $(CFiles) $(DerivedCFiles) >> Make.ctemp
843 @cat Make.ctemp >> $(DependencyFile)
844 @$(Delete) Make.ctemp
845 endif
846
847 endif
848
849 ifneq "$(words $(F90Files))" "0"
850 $(DEV_ROOT)/scripts/filepp -I $(DEV_ROOT)/src -od '$$(TargetDir)/' $(F90Declare) -MM -mc $(ModuleCase) -ms $(ModSuffix) $(F90Files) > Make.ftemp
851 @cat Make.ftemp >> $(DependencyFile)
852 @$(Delete) Make.ftemp
853
854 ifeq "$(UseMPI)" "yes"
855 $(DEV_ROOT)/scripts/filepp -I $(DEV_ROOT)/src -od '$$(ParallelTargetDir)/' $(ParallelDeclare) $(F90Declare) -MM -mc $(ModuleCase) -ms $(ModSuffix) $(F90Files) >> Make.ftemp
856 @cat Make.ftemp >> $(DependencyFile)
857 @$(Delete) Make.ftemp
858 endif
859
860 endif
861
862 # make lib
863 lib : $(PackageListLoop)
864 $(Print) Libraries built.
865
866 _liball : $(JarFile) $(SharedLibrary) $(StaticLibrary)
867
868 jar : $(JarFile)
869
870 jarsign : $(JarFile)
871 $(JarSigner) -keystore GeoSoftKeystore $(JarFile) myself
872
873 #make install
874 %.install :
875 @$(MAKE) $(MakeOptions) -C $(subst .install,,$@) _installall
876
877 .install :
878 @$(MAKE) $(MakeOptions) _installall
879
880 install : $(InstallListLoop)
881 $(Print) Done Install
882
883 _installall : _buildall _installdata _installlinks
884
885 $(MyInstallDir) :
886 $(MkDir) $@
887
888 _installdata : $(MyInstallDir)
889 $(Print) $(InstallFiles)
890 ifneq "$(words $(InstallFiles))" "0"
891 $(InstallCommand) $(InstallFiles) $(MyInstallDir)
892 endif
893
894 _installlinks : $(MyInstallDir)
895 ifneq "$(words $(MyLinkTargets))" "0"
896 @cd $(MyInstallDir)
897 $(foreach thisLink,$(MyLinkTargets),$(call do_link,$(MyLinkSource),$(thisLink)))
898 endif
899
900 # make statistics
901 _statisticsall :
902 @$(Print) $(patsubst %,$(CurrentDir)/%,$(SourceFiles)) >> $(DEV_ROOT)/files.tmp
903
904 statistics : $(PackageListLoop)
905 @$(List) $(DEV_ROOT)/files.tmp | xargs $(WordCount) $(WordCountOptions)
906 @$(Delete) $(DEV_ROOT)/files.tmp
907 $(Print) Done statistics.
908
909 # make pure
910 #$(Executable).pure :
911 # $(Purify) $(PurifyOptions) $(CppCompiler) $(LinkOptions) $(LibDirs) \
912 # $(LibList) $(ObjectFiles) -o $@
913 #
914 #pure : $(Executable).pure
915
916 #make ChangeLog
917 ChangeLog:
918 $(DEV_ROOT)/scripts/svn2cl
919
920 # Execute
921 _runexe :
922 $(Executable) $(RunParameters)
923
924 _runjava :
925 $(JavaExecute) $(JavaRunOptions) $(JavaMainClass) $(RunParameters)
926
927 run : _runjava
928
929
930 ifdef $(DependencyFile)
931 -include $(DependencyFile)
932 endif