ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/OpenMD/branches/development/make/Makefile.in
Revision: 1137
Committed: Tue May 29 22:50:14 2007 UTC (18 years, 2 months ago) by chuckv
Original Path: trunk/make/Makefile.in
File size: 27998 byte(s)
Log Message:
Removed CGAL from OOPSE and replaced it with qhull.

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