ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/OpenMD/branches/development/make/Makefile.in
Revision: 1251
Committed: Wed Jun 4 15:38:15 2008 UTC (17 years, 1 month ago) by chuckv
Original Path: trunk/make/Makefile.in
File size: 28466 byte(s)
Log Message:
Added minimizer sample for metal.

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