ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/OpenMD/branches/development/make/Makefile.in
Revision: 1079
Committed: Thu Oct 19 15:57:07 2006 UTC (18 years, 9 months ago) by gezelter
Original Path: trunk/make/Makefile.in
File size: 28072 byte(s)
Log Message:
Added velocitizer utility program, added samples of its use to the
builder samples.

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