ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/OpenMD/branches/development/make/Makefile.in
Revision: 958
Committed: Wed May 17 03:03:03 2006 UTC (19 years, 2 months ago) by gezelter
Original Path: trunk/make/Makefile.in
File size: 27299 byte(s)
Log Message:
zlib fixes

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