ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/OpenMD/branches/development/make/Makefile.in
Revision: 1405
Committed: Tue Jan 19 22:33:57 2010 UTC (15 years, 6 months ago) by gezelter
Original Path: trunk/make/Makefile.in
File size: 28593 byte(s)
Log Message:
Fixing the build and install method for samples in Madelung, RNEMD,
zeolite, SMIPD

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