ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE-3.0/make/Makefile.in
Revision: 2736
Committed: Tue Apr 25 22:30:26 2006 UTC (18 years, 2 months ago) by chuckv
File size: 27105 byte(s)
Log Message:
Added random builder

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