ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE-2.0/make/Makefile.in
Revision: 2217
Committed: Fri Apr 29 19:16:27 2005 UTC (19 years, 2 months ago) by gezelter
File size: 25935 byte(s)
Log Message:
*** empty log message ***

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