ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE-3.0/make/Makefile.in
Revision: 2580
Committed: Thu Feb 2 02:57:01 2006 UTC (18 years, 5 months ago) by gezelter
File size: 27013 byte(s)
Log Message:
added CXXFLAGS to the LinkOptions to allow compilation with icc9
(skipping the gcc-4 std c++ libraries).

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