ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/OpenMD/branches/devel_omp/make/Makefile.in
Revision: 1210
Committed: Wed Jan 23 03:45:33 2008 UTC (17 years, 6 months ago) by gezelter
Original Path: trunk/make/Makefile.in
File size: 28475 byte(s)
Log Message:
Removed older version of openbabel from our code.  We now have a
configure check to see if openbabel is installed and then we link to
the stuff we need.  Conversion to OOPSE's md format is handled by only
one application (atom2md), so most of the work went on there.
ElementsTable still needs some work to function in parallel.

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