ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/OpenMD/branches/development/make/Makefile.in
Revision: 964
Committed: Fri May 19 15:11:27 2006 UTC (19 years, 2 months ago) by tim
Original Path: trunk/make/Makefile.in
File size: 27838 byte(s)
Log Message:
change the order of include path and library path

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