ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/OpenMD/branches/development/make/Makefile.in
Revision: 1465
Committed: Fri Jul 9 23:08:25 2010 UTC (15 years ago) by chuckv
File size: 28761 byte(s)
Log Message:
Creating busticated version of OpenMD

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