ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/OpenMD/branches/development/make/Makefile.in
Revision: 1193
Committed: Thu Dec 6 19:51:02 2007 UTC (17 years, 7 months ago) by chuckv
Original Path: trunk/make/Makefile.in
File size: 28390 byte(s)
Log Message:
Fixed Makefile.in for cgal.

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