ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/OpenMD/branches/development/make/Makefile.in
Revision: 897
Committed: Wed Mar 15 15:50:11 2006 UTC (19 years, 4 months ago) by tim
Original Path: trunk/make/Makefile.in
File size: 27043 byte(s)
Log Message:
adding hydrodynamics module into build system

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