ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE-2.0/make/Makefile.in
Revision: 2470
Committed: Fri Dec 2 15:38:25 2005 UTC (18 years, 7 months ago) by tim
File size: 26461 byte(s)
Log Message:
update Makefile

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