ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE-3.0/make/Makefile.in
Revision: 2159
Committed: Mon Apr 11 19:49:43 2005 UTC (19 years, 2 months ago) by gezelter
File size: 25380 byte(s)
Log Message:
One more bug fix for GNU make versions < 3.80

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