ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE-2.0/make/Makefile.in
Revision: 1712
Committed: Thu Nov 4 20:55:01 2004 UTC (19 years, 8 months ago) by tim
File size: 22632 byte(s)
Log Message:
time to break SimSetup

File Contents

# User Rev Content
1 gezelter 1508 #---------------------------------------------------------------------------
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 tim 1514 IS_UNIX=1
37 tim 1529
38     #packages containing libraries
39     PackageLibs = \
40 tim 1514 utils \
41     math \
42     types \
43     primitives \
44     UseTheForce/DarkSide \
45     UseTheForce \
46     brains \
47     io \
48     constraints \
49     profiling \
50     restraints \
51 tim 1529
52     #packages containing applications
53     Applications = \
54 tim 1514 applications/oopse \
55     applications/dump2Xyz \
56 tim 1529 applications/simpleBuilder
57 gezelter 1508
58 gezelter 1535 Samples = \
59     samples/argon \
60     samples/water/dimer \
61     samples/water/spce \
62     samples/water/ssd \
63     samples/water/ssde \
64     samples/water/tip3p_ice \
65     samples/water/tip4p \
66     samples/lipid \
67     samples/alkane \
68     samples/minimizer \
69     samples/metals \
70     samples/zcons \
71    
72 tim 1514 IncludeDirs = \
73 gezelter 1521 @SPRNG_INC_DIR@ \
74     @MPI_INC_DIR@
75 tim 1514
76     LibraryDirs = \
77 gezelter 1521 @SPRNG_LIB_DIR@ \
78     @MPI_LIB_DIR@
79 tim 1514
80     Libraries = \
81 gezelter 1521 @SPRNG_LIB@ \
82 tim 1525 @MPI_LIB@ \
83     @MPI_F90_LIB@
84 tim 1514
85 gezelter 1521 OopseHome = @OOPSE_HOME@
86 gezelter 1552 ForceParamDir = $(OopseHome)/share/forceFields
87     SampleSimDir = $(OopseHome)/share/samples
88     InstallBinDir = $(OopseHome)/bin
89     DocDir = $(OopseHome)/doc
90 gezelter 1521 FrcDeclare = -DFRC_PATH="$(ForceParamDir)"
91 gezelter 1535 F90Declare = -D__FORTRAN90
92 gezelter 1521 ParallelDeclare = -DIS_MPI
93 tim 1525 UseMPI = @USE_MPI@
94 gezelter 1535 ModuleCase = @F90_MODULE_NAMES@
95     ModSuffix = @MOD@
96 tim 1529 LinkOptions = \
97     @F90LIBS@
98 gezelter 1521
99 tim 1529 ParallelLinkOptions = \
100     @F90LIBS@
101    
102    
103 gezelter 1508 #---------------------------------------------------------------------------
104     #
105     # Directories
106     #
107     #---------------------------------------------------------------------------
108    
109     SourceDir = $(DEV_ROOT)/src
110     TargetDir = $(DEV_ROOT)/obj
111     ParallelTargetDir = $(DEV_ROOT)/MPIobj
112     LibDir = $(DEV_ROOT)/lib
113     MakeDir = $(DEV_ROOT)/make
114     BinDir = $(DEV_ROOT)/bin
115     DocsDir = $(DEV_ROOT)/docs
116     CurrentDir = $(CURDIR)
117 tim 1529 CombinedStaticLib = $(LibDir)/libOOPSE.a
118     CombinedParallelStaticLib = $(LibDir)/libOOPSE_MPI.a
119 gezelter 1508
120     ifdef Source
121 tim 1512 #get the relative path of current package to source directory
122     # /home/maul/gezelter/src/code/src/UseTheForce/Darkside --> UseTheForce/Darkside
123     #Package = $(shell echo $(CurrentDir) | sed -e 's/^.*\/src\/\(.*\)/\1/g')
124     #use shell script to get the absolute path and then rip it off from $(CurrentDir)
125     Package = $(subst $(shell cd $(SourceDir); pwd)/,,$(CurrentDir))
126    
127 gezelter 1508 PackageList = $(Package)
128     PackageSourceDir = $(SourceDir)/$(Package)
129     PackageTargetDir = $(TargetDir)
130     PackageParallelTargetDir = $(ParallelTargetDir)
131     JavaMainClass = $(subst /,.,$(Package)).$(Main)
132     else
133 tim 1529 PackageList = $(PackageLibs) $(JavaPackages) $(Applications)
134 gezelter 1508 endif
135    
136 tim 1512 PackageListLoop = $(patsubst %,$(SourceDir)/%/.loop,$(PackageList))
137 gezelter 1508
138 tim 1512 JRE = $(JAVA_HOME)/jre/lib/rt.jar
139 gezelter 1508
140     ifdef IS_UNIX
141     X = :
142     else
143     X = \;
144     endif
145    
146     #---------------------------------------------------------------------------
147     #
148     # Classification of files
149     #
150     #---------------------------------------------------------------------------
151    
152     # Source
153     JavaFiles = $(filter %.java, $(Source))
154     CppFiles = $(filter %.cpp, $(Source))
155     CFiles = $(filter %.c, $(Source))
156     FortranFiles = $(filter %.f, $(Source))
157     F90Files = $(filter %.F90, $(Source))
158     CorbaFiles = $(filter %.idl, $(Source))
159     LexFiles = $(filter %.l, $(Source))
160     YaccFiles = $(filter %.y, $(Source))
161     OtherSourceFiles = $(filter-out $(JavaFiles) $(CppFiles) $(CFiles) \
162     $(FortranFiles) $(F90Files) $(LexFiles) \
163     $(YaccFiles) $(CorbaFiles), \
164     $(Source))
165     ManifestFile = $(PackageSourceDir)/Manifest
166    
167 tim 1512 SourceFiles = $(JavaFiles)\
168     $(CppFiles)\
169     $(CFiles)\
170     $(FortranFiles)\
171     $(F90Files)\
172     $(LexFiles)\
173     $(YaccFiles)
174 gezelter 1508
175     # Target
176     JavaClassFiles = $(JavaFiles:%.java= $(PackageTargetDir)/%.class)
177     JavaClassFilesRel = $(JavaFiles:%.java= $(Package)/%.class)
178     RmiStubFiles = $(RmiSource:%.java= $(PackageTargetDir)/%_Stub.class)
179     RmiSkeletonFiles = $(RmiSource:%.java= $(PackageTargetDir)/%_Skel.class)
180     JniClassFiles = $(JniSource:%.java= $(PackageTargetDir)/%.class)
181     JniHeaders = $(JniSource:%.java= $(PackageSourceDir)/%.h)
182     ObjectFiles = $(CFiles:%.c= $(PackageTargetDir)/%.o)\
183 tim 1512 $(CppFiles:%.cpp= $(PackageTargetDir)/%.o)\
184 tim 1525 $(FortranFiles:%.f= $(PackageTargetDir)/%.o)\
185     $(F90Files:%.F90= $(PackageTargetDir)/%.o)\
186     $(LexFiles:%.l= $(PackageTargetDir)/%.o)\
187     $(YaccFiles:%.y= $(PackageTargetDir)/%.o)
188 gezelter 1508 ParallelObjectFiles = $(CFiles:%.c= $(PackageParallelTargetDir)/%.o)\
189 tim 1525 $(CppFiles:%.cpp= $(PackageParallelTargetDir)/%.o)\
190     $(FortranFiles:%.f= $(PackageParallelTargetDir)/%.o)\
191     $(F90Files:%.F90= $(PackageParallelTargetDir)/%.o)\
192     $(LexFiles:%.l= $(PackageParallelTargetDir)/%.o)\
193     $(YaccFiles:%.y= $(PackageParallelTargetDir)/%.o)
194 gezelter 1508
195     DerivedSource = $(YaccFiles:%.y= %.h) \
196 tim 1525 $(YaccFiles:%.y= %.c) \
197     $(LexFiles:%.l= %.c)
198 gezelter 1508
199     DerivedCFiles = $(YaccFiles:%.y= %.c) \
200 tim 1525 $(LexFiles:%.l= %.c)
201 gezelter 1508
202     OtherTargetFiles = $(OtherSourceFiles:%=$(PackageTargetDir)/%)
203    
204     ThirdPartyJarsTmp = $(patsubst %,$(LibDir)/%,$(JavaLibraries))
205     ThirdPartyJars = $(subst $(Space),$(X),$(ThirdPartyJarsTmp))
206    
207     ifneq "$(words $(JavaFiles))" "0"
208     JavaPackageName = $(subst /,.,$(Package))
209     JarFile = $(LibDir)/$(subst /,,$(Package)).jar
210     endif
211    
212     #if Main is defined, do not build library. It may not be true sometimes
213     ifneq "$(words $(ObjectFiles) $(ParallelObjectFiles))" "0"
214     DependencyFile = $(PackageSourceDir)/Makedepend
215     ifneq "$(Main)" ""
216 tim 1512 Executable = $(BinDir)/$(Main)
217 gezelter 1508 ParallelExecutable = $(BinDir)/$(Main)_MPI
218     else
219 tim 1529 SharedLibrary = $(LibDir)/lib$(subst /,,$(patsubst %,oopse_%,$(Package)))_UP.so
220     StaticLibrary = $(LibDir)/lib$(subst /,,$(patsubst %,oopse_%,$(Package)))_UP.a
221     ParallelSharedLibrary = $(LibDir)/lib$(subst /,,$(patsubst %,oopse_%,$(Package)))_MPI.so
222     ParallelStaticLibrary = $(LibDir)/lib$(subst /,,$(patsubst %,oopse_%,$(Package)))_MPI.a
223 gezelter 1508 endif
224     endif
225 tim 1544
226 gezelter 1508 #
227     # Misc
228     #
229     ClassPath = $(JRE)$(X)$(TargetDir)$(X)$(ThirdPartyJars)
230     JavaPackageNames = $(subst /,.,$(JavaPackages))
231     IncludePath = -I$(SourceDir) $(IncludeDirs:%=-I%)
232     LibDirs = -L$(LibDir) $(LibraryDirs:%=-L%)
233 tim 1529 LocalLibs = $(subst /,,$(patsubst %, oopse_%_UP, $(PackageLibs)))
234     ParallelLocalLibs= $(subst /,,$(patsubst %, oopse_%_MPI, $(PackageLibs)))
235 gezelter 1521 LibList = $(LocalLibs:%=-l%) $(Libraries)
236 tim 1529 LibNames = $(LocalLibs:%=$(LibDir)/lib%.a)
237 tim 1525 ParallelLibList = $(ParallelLocalLibs:%=-l%) $(Libraries)
238 tim 1529 ParallelLibNames = $(ParallelLocalLibs:%=$(LibDir)/lib%.a)
239 gezelter 1508
240    
241     #---------------------------------------------------------------------------
242     #
243     # Tools & Options
244     #
245     #---------------------------------------------------------------------------
246     Print = @echo
247     Move = mv
248     Copy = cp
249     CCompiler = @CC@
250     CppCompiler = @CXX@
251     Linker = @CXX@
252     MakeDepend = makedepend
253 gezelter 1552 INSTALL = @INSTALL@
254 gezelter 1508 InstallProgram = @INSTALL_PROGRAM@
255     InstallData = @INSTALL_DATA@
256 tim 1544 MkDir = @MKINSTALLDIRS@
257 gezelter 1508 Delete = rm -fr
258     StaticArchiver = @AR@
259     DynamicArchiver = @CC@
260     FortranCompiler = @FC@
261     F90Compiler = @F90@
262     JavaCompiler = $(JAVA_HOME)/bin/javac
263     JavaArchiver = $(JAVA_HOME)/bin/jar
264     JarSigner = $(JAVA_HOME)/bin/jarsigner
265     JavadocGenerator = $(JAVA_HOME)/bin/javadoc
266     JniCompiler = $(JAVA_HOME)/bin/javah
267     RmiCompiler = $(JAVA_HOME)/bin/rmic
268     JavaExecute = $(JAVA_HOME)/bin/java
269     Purify = purify
270     WordCount = wc
271     List = cat
272     Yacc = @YACC@
273     Lex = @LEX@
274 tim 1529 Ranlib = @RANLIB@
275 tim 1539 Doxygen = @DOXYGEN@
276 gezelter 1508
277 tim 1514 MakeOptions = -k
278 gezelter 1508 MakeDependOptions =
279     StaticArchiverOptions = rc
280     DynamicArchiverOptions = -shared
281     JavaArchiverOptions =
282     JniOptions =
283     RmiOptions = -d $(TargetDir) -classpath $(ClassPath) \
284     -sourcepath $(SourceDir)
285 chrisfen 1635 COptions = $(FrcDeclare) @CFLAGS@
286     CParallelOptions = $(FrcDeclare) $(ParallelDeclare) @CFLAGS@
287     CppOptions = $(FrcDeclare) @CXXFLAGS@
288     CppParallelOptions = $(FrcDeclare) $(ParallelDeclare) @CXXFLAGS@
289 gezelter 1508 FortranOptions =
290 tim 1554 F90Options = @PREPFLAG@ @F90FLAGS@ @MODDIRFLAG@$(SourceDir) @MODDIRFLAG@$(TargetDir)
291     F90ParallelOptions = @PREPFLAG@ @F90FLAGS@ @MODDIRFLAG@$(SourceDir) @MODDIRFLAG@$(ParallelTargetDir) @PREPDEFFLAG@$(ParallelDeclare)
292 gezelter 1508 JavaCompilerOptions = -d $(TargetDir) -classpath $(ClassPath) \
293     -sourcepath $(SourceDir) -deprecation
294     JavaRunOptions = -classpath $(ClassPath)
295     PurifyOptions =
296     JavadocOptions = -d $(DocsDir) \
297     -sourcepath $(SourceDir) \
298     -classpath $(ClassPath) \
299     -author \
300     -package \
301     -use \
302     -splitIndex \
303     -version \
304     -link file:$(JAVA_HOME)/docs/api \
305     -windowtitle $(JavadocWindowTitle) \
306     -doctitle $(JavadocDocTitle) \
307     -header $(JavadocHeader) \
308     -bottom $(JavadocFooter)
309     WordCountOptions = --lines
310    
311     Empty =
312     Space = $(Empty) $(Empty)
313    
314    
315     #---------------------------------------------------------------------------
316     #
317 tim 1544 # Install
318     #
319     #---------------------------------------------------------------------------
320    
321     ifneq "$(words $(SampleFiles))" "0"
322 tim 1546 MySample = $(subst $(shell cd $(DEV_ROOT)/samples; pwd)/,,$(CurrentDir))
323     MyInstallDir = $(SampleSimDir)/$(MySample)
324     InstallFiles = $(SampleFiles)
325     InstallCommand = $(InstallData)
326 tim 1544 endif
327    
328     ifneq "$(words $(Main))" "0"
329 tim 1546 MyInstallDir = $(InstallBinDir)
330     ifeq "$(UseMPI)" "yes"
331     InstallFiles = $(Executable) $(ParallelExecutable)
332     else
333     InstallFiles = $(Executable)
334     endif
335     InstallCommand = $(InstallProgram)
336 tim 1544 endif
337    
338 tim 1545 ifneq "$(words $(ForcefieldFiles))" "0"
339 tim 1546 MyInstallDir = $(ForceParamDir)
340     InstallFiles = $(ForcefieldFiles)
341     InstallCommand = $(InstallData)
342 tim 1544 endif
343    
344     ifneq "$(words $(InstallFiles))" "0"
345     InstallList =
346     else
347 tim 1545 InstallList = $(patsubst %,$(DEV_ROOT)/%,$(Samples)) $(DEV_ROOT)/forceFields $(patsubst %, $(SourceDir)/%,$(Applications))
348 tim 1544 endif
349    
350     InstallListLoop = $(patsubst %,$(SourceDir)/%/.install,$(PackageList)) $(patsubst %,%/.install,$(InstallList))
351    
352    
353    
354     #---------------------------------------------------------------------------
355     #
356 gezelter 1508 # Rules
357     #
358     #---------------------------------------------------------------------------
359     default : build
360    
361     %.loop :
362     @$(MAKE) $(MakeOptions) -C $(subst .loop,,$@) _$(MAKECMDGOALS)all
363    
364     # Create target directory
365     $(PackageTargetDir) :
366     $(MakeDir) $@
367    
368     # .c -> .o
369 tim 1512 $(PackageTargetDir)/%.o : %.c
370 gezelter 1508 $(Print) $@
371 tim 1514 $(CCompiler) $(COptions) -c $(IncludePath) $< -o $@
372 gezelter 1508
373 tim 1525 $(PackageParallelTargetDir)/%.o : %.c
374     $(Print) $@
375     $(CCompiler) $(CParallelOptions) -c $(IncludePath) $< -o $@
376    
377     ifeq "$(UseMPI)" "yes"
378 tim 1512 %.o : %.c
379 gezelter 1508 $(MAKE) $(MakeOptions) $(PackageTargetDir)/$@
380 tim 1525 $(MAKE) $(MakeOptions) $(PackageParallelTargetDir)/$@
381     else
382     %.o : %.c
383     $(MAKE) $(MakeOptions) $(PackageTargetDir)/$@
384     endif
385 gezelter 1508
386     # .cpp -> .o
387 tim 1512 $(PackageTargetDir)/%.o : %.cpp
388 gezelter 1508 $(CppCompiler) $(CppOptions) -c $(IncludePath) $< -o $@
389    
390 tim 1525 $(PackageParallelTargetDir)/%.o : %.cpp
391     $(CppCompiler) $(CppParallelOptions) -c $(IncludePath) $< -o $@
392    
393     ifeq "$(UseMPI)" "yes"
394 tim 1512 %.o : %.cpp
395 gezelter 1508 $(MAKE) $(MakeOptions) $(PackageTargetDir)/$@
396 tim 1525 $(MAKE) $(MakeOptions) $(PackageParallelTargetDir)/$@
397     else
398     %.o : %.cpp
399     $(MAKE) $(MakeOptions) $(PackageTargetDir)/$@
400     endif
401 gezelter 1508
402     # .f -> .o
403 tim 1512 $(PackageTargetDir)/%.o : %.f
404 tim 1514 $(FortranCompiler) $(FortranOptions) -c $< -o $@
405 gezelter 1508
406 tim 1525 $(PackageParallelTargetDir)/%.o : %.f
407     $(FortranCompiler) $(FortranParallelOptions) -c $< -o $@
408    
409     ifeq "$(UseMPI)" "yes"
410 tim 1512 %.o : %.f
411 gezelter 1508 $(MAKE) $(MakeOptions) $(PackageTargetDir)/$@
412 tim 1525 $(MAKE) $(MakeOptions) $(PackageParallelTargetDir)/$@
413     else
414     %.o : %.f
415     $(MAKE) $(MakeOptions) $(PackageTargetDir)/$@
416     endif
417 gezelter 1508
418     # .F90 -> .o
419 tim 1512 $(PackageTargetDir)/%.o : %.F90
420 tim 1525 $(F90Compiler) $(F90Options) $(IncludePath) -c $< -o $@
421 tim 1553 if test -f *.$(ModSuffix); then \
422     $(Move) *.$(ModSuffix) $(PackageTargetDir);\
423     fi
424 gezelter 1508
425 tim 1525 $(PackageParallelTargetDir)/%.o : %.F90
426     $(F90Compiler) $(F90ParallelOptions) $(IncludePath) -c $< -o $@
427 tim 1553 if test -f *.$(ModSuffix); then \
428     $(Move) *.$(ModSuffix) $(PackageParallelTargetDir);\
429     fi
430 tim 1525
431     ifeq "$(UseMPI)" "yes"
432 tim 1512 %.o : %.F90
433 gezelter 1508 $(MAKE) $(MakeOptions) $(PackageTargetDir)/$@
434 tim 1553 if test -f *.$(ModSuffix); then \
435     $(Move) *.$(ModSuffix) $(PackageTargetDir);\
436     fi
437    
438 tim 1525 $(MAKE) $(MakeOptions) $(PackageParallelTargetDir)/$@
439 tim 1553 if test -f *.$(ModSuffix); then \
440     $(Move) *.$(ModSuffix) $(PackageParallelTargetDir);\
441     fi
442    
443 tim 1525 else
444     %.o : %.F90
445     $(MAKE) $(MakeOptions) $(PackageTargetDir)/$@
446 tim 1553 if test -f *.$(ModSuffix); then \
447     $(Move) *.$(ModSuffix) $(PackageTargetDir);\
448     fi
449    
450 tim 1525 endif
451 gezelter 1508
452 tim 1525
453 gezelter 1508 # .java -> .class
454     $(PackageTargetDir)/%.class : $(PackageSourceDir)/%.java
455 tim 1514 $(JavaCompiler) $(JavaCompilerOptions) $<
456 gezelter 1508
457     %.class : $(PackageSourceDir)/%.java
458     @$(MAKE) $(MakeOptions) $(PackageTargetDir)/$@
459    
460     # .class -> .h
461     $(PackageSourceDir)/%.h : $(PackageTargetDir)/%.class
462     $(JniCompiler) $(JniOptions) $(JavaPackageName).$*
463    
464     %.h : %.class
465     $(MAKE) $(MakeOptions) $(PackageSourceDir)/$@
466    
467     #.y -> .h
468 tim 1512 %.h : %.y
469 tim 1514 $(Yacc) -d $?
470 gezelter 1508 @$(Move) y.tab.h $*.h
471     @$(Delete) y.tab.c
472    
473     #.y -> .c
474 tim 1512 %.c : %.y
475 tim 1514 $(Yacc) -d $?
476 gezelter 1508 @$(Move) y.tab.c $*.c
477     @$(Delete) y.tab.h
478    
479     # .l -> .c
480 tim 1512 %.c : %.l
481 gezelter 1508 $(Print) $@
482     $(Print) $(Lex) -o$@ $?
483     @$(Lex) -o$@ $?
484    
485     # .o -> .a
486 tim 1525
487 tim 1529 $(LibDir)/%_UP.a : $(ObjectFiles)
488 tim 1514 $(StaticArchiver) $(StaticArchiverOptions) $@ $(ObjectFiles)
489 tim 1530 @touch $(LibDir)/.stamp_UP
490 gezelter 1508
491 tim 1529 $(LibDir)/%_MPI.a: $(ParallelObjectFiles)
492 tim 1514 $(StaticArchiver) $(StaticArchiverOptions) $@ $(ParallelObjectFiles)
493 tim 1530 @touch $(LibDir)/.stamp_MPI
494 gezelter 1508
495 tim 1529 %_UP.a : $(ObjectFiles)
496 gezelter 1508 $(MAKE) $(MakeOptions) $(LibDir)/$@
497 tim 1529
498     %_MPI.a : $(ParallelObjectFiles)
499 tim 1525 $(MAKE) $(MakeOptions) $(LibDir)/$@
500 gezelter 1508
501     # .o -> .so
502 tim 1529 $(LibDir)/%_UP.so : $(ObjectFiles)
503 gezelter 1508 $(DynamicArchiver) $(ObjectFiles) $(DynamicArchiverOptions) -o $@
504    
505 tim 1529 $(LibDir)/%_MPI.so : $(ParallelObjectFiles)
506 gezelter 1508 $(DynamicArchiver) $(ParallelObjectFiles) $(DynamicArchiverOptions) -o $@
507    
508 tim 1529 %_UP.so : $(ObjectFiles)
509 gezelter 1508 $(MAKE) $(MakeOptions) $(LibDir)/$@
510 tim 1529
511     %_MPI.so : $(ParallelObjectFiles)
512 tim 1525 $(MAKE) $(MakeOptions) $(LibDir)/$@
513 gezelter 1508
514     # .class -> .jar
515     $(LibDir)/%.jar : $(JavaClassFiles) $(OtherTargetFiles)
516     $(Print) $@
517     @cd $(TargetDir); $(JavaArchiver) -cf $@ \
518     $(JavaClassFilesRel) $(OtherTargetFiles)
519    
520     %.jar : $(JavaClassFiles) $(OtherTargetFiles)
521     $(MAKE) $(MakeOptions) $(LibDir)/$@
522    
523     # .class -> JavaDoc
524     javadoc :
525     $(Print) $(JavaPackageNames) > $(DEV_ROOT)/packages.tmp
526     $(JavadocGenerator) $(JavadocOptions) @$(DEV_ROOT)/packages.tmp
527     $(Delete) $(DEV_ROOT)/packages.tmp
528     $(Print) Done JavaDoc.
529    
530     # .class -> _Stub.class
531     $(PackageTargetDir)/%_Stub.class : $(PackageTargetDir)/%.class
532     $(Print) $@
533     $(RmiCompiler) $(RmiOptions) $(JavaPackageName).$*
534    
535     %_Stub.class : %.class
536     $(MAKE) $(MakeOptions) $(PackageTargetDir)/$@
537    
538     # .class -> _Skel.class
539     $(PackageTargetDir)/%_Skel.class : $(PackageTargetDir)/%.class
540     $(Print) $@
541     $(RmiCompiler) $(RmiOptions) $(JavaPackageName).$*
542    
543     %_Skel.class : %.class
544     $(MAKE) $(MakeOptions) $(PackageTargetDir)/$@
545    
546 tim 1539 document :
547     $(Print) Generate Documentation for OOPSE-2.0
548     @cd $(DEV_ROOT)/src
549     $(Doxygen) $(DEV_ROOT)/make/Doxyfile
550    
551 tim 1529 #GUN make funtions to merge the libraries
552     find_objs = $(shell $(StaticArchiver) -t $(1))
553     extract_objs = $(shell $(StaticArchiver) -x $(1) $(call find_objs, $(1)))
554     create_archive = $(shell $(StaticArchiver) $(StaticArchiverOptions) $(2) $(call find_objs, $(1)))
555     remove_objs = $(shell $(Delete) $(call find_objs, $(1)))
556     do_create = $(call extract_objs,$(1))$(call create_archive,$(1),$(2))$(call remove_objs,$(1))
557    
558 tim 1530 $(CombinedStaticLib) : $(LibDir)/.stamp_UP
559     $(Print) create $@
560 tim 1529 $(foreach thisLib,$(LibNames),$(call do_create,$(thisLib),$@))
561     $(Ranlib) $(CombinedStaticLib)
562    
563     $(CombinedParallelStaticLib) : $(LibDir)/.stamp_MPI
564 tim 1530 $(Print) create $@
565 tim 1529 $(foreach thisLib,$(ParallelLibNames), $(call do_create, $(thisLib), $@))
566     $(Ranlib) $(CombinedParallelStaticLib)
567    
568 gezelter 1508 # Executable
569 tim 1529 $(Executable) : $(CombinedStaticLib) $(ObjectFiles)
570     $(Linker) $(ObjectFiles) $(LinkOptions) $(LibDirs) $(CombinedStaticLib) $(Libraries) -o $@
571 gezelter 1508
572 tim 1529 $(ParallelExecutable) : $(CombinedParallelStaticLib) $(ParallelObjectFiles)
573     $(Linker) $(ParallelObjectFiles) $(ParallelLinkOptions) $(LibDirs) $(CombinedParallelStaticLib) $(Libraries) -o $@
574 gezelter 1508
575     # Anything else is just copied from source to target
576     $(PackageTargetDir)/% : $(PackageSourceDir)/%
577     $(Print) $@
578     $(Copy) $< $@
579    
580     # make (or make build)
581     build : $(PackageListLoop)
582     $(Print) Done build.
583    
584     _all : _buildall
585    
586 tim 1544 _buildall :
587 tim 1525 ifeq "$(UseMPI)" "yes"
588 gezelter 1508 _buildall : \
589     $(DependencyFile) \
590     $(PackageTargetDir) \
591     $(ObjectFiles) \
592 tim 1525 $(ParallelObjectFiles) \
593 gezelter 1508 $(JavaClassFiles) \
594     $(RmiStubFiles) \
595     $(RmiSkeletonFiles) \
596     $(OtherTargetFiles) \
597     $(StaticLibrary) \
598 tim 1525 $(ParallelStaticLibrary) \
599 gezelter 1508 $(JarFile) \
600 tim 1525 $(Executable) \
601     $(ParallelExecutable)
602     else
603     _buildall : \
604     $(DependencyFile) \
605     $(PackageTargetDir) \
606     $(ObjectFiles) \
607     $(JavaClassFiles) \
608     $(RmiStubFiles) \
609     $(RmiSkeletonFiles) \
610     $(OtherTargetFiles) \
611     $(StaticLibrary) \
612     $(JarFile) \
613     $(Executable)
614     endif
615 gezelter 1508
616 tim 1525
617 gezelter 1508 # make clean
618     clean : $(PackageListLoop)
619     $(Print) Done clean.
620    
621     _cleanall :
622 tim 1514 $(Delete) $(ObjectFiles) $(ParallelObjectFiles)
623    
624     # make distclean
625     distclean : $(PackageListLoop)
626     $(Print) Done clean.
627    
628     _distcleanall :
629     $(Delete) $(ObjectFiles) \
630     $(ParallelObjectFiles) \
631 tim 1523 $(JarFile) \
632 gezelter 1508 $(SharedLibrary) \
633     $(StaticLibrary) \
634 tim 1514 $(ParallelSharedLibrary) \
635     $(ParallelStaticLibrary) \
636 gezelter 1508 $(Executable) \
637 tim 1514 $(ParallelExecutable) \
638 tim 1523 $(DependencyFile)
639 gezelter 1508
640    
641     # make depend
642     depend : $(PackageListLoop)
643     $(Print) Done dependencies.
644    
645     _dependall : $(DependencyFile)
646    
647     $(DependencyFile) : $(DerivedSource)
648     $(Print) $@
649     @cd $(PackageSourceDir)
650 tim 1510
651     ifneq "$(words $(CppFiles))" "0"
652 tim 1557 $(DEV_ROOT)/scripts/filepp -I $(DEV_ROOT)/src -od '$$(TargetDir)/' -MM $(CppFiles)>> Make.cpptemp
653     @cat Make.cpptemp >> $(DependencyFile)
654 gezelter 1535 $(Delete) Make.cpptemp
655 tim 1554
656     ifeq "$(UseMPI)" "yes"
657 tim 1557 $(DEV_ROOT)/scripts/filepp -I $(DEV_ROOT)/src -od '$$(ParallelTargetDir)/' $(ParallelDeclare) -MM $(CppFiles)>> Make.cpptemp
658     @cat Make.cpptemp >> $(DependencyFile)
659 tim 1539 @$(Delete) Make.cpptemp
660 tim 1554 endif
661    
662 gezelter 1508 endif
663 tim 1510
664     ifneq "$(words $(CFiles))" "0"
665 tim 1557 $(DEV_ROOT)/scripts/filepp -I $(DEV_ROOT)/src -od '$$(TargetDir)/' -MM $(CFiles) $(DerivedCFiles) >> Make.ctemp
666     @cat Make.ctemp >> $(DependencyFile)
667 gezelter 1535 $(Delete) Make.ctemp
668 tim 1554
669     ifeq "$(UseMPI)" "yes"
670 tim 1557 $(DEV_ROOT)/scripts/filepp -I $(DEV_ROOT)/src -od '$$(ParallelTargetDir)/' $(ParallelDeclare) -MM $(CFiles) $(DerivedCFiles) >> Make.ctemp
671     @cat Make.ctemp >> $(DependencyFile)
672 tim 1539 @$(Delete) Make.ctemp
673 tim 1554 endif
674    
675 gezelter 1508 endif
676 tim 1510
677     ifneq "$(words $(F90Files))" "0"
678 tim 1557 $(DEV_ROOT)/scripts/filepp -I $(DEV_ROOT)/src -od '$$(TargetDir)/' $(F90Declare) -MM -mc $(ModuleCase) -ms $(ModSuffix) $(F90Files) > Make.ftemp
679 tim 1554 @cat Make.ftemp >> $(DependencyFile)
680     @$(Delete) Make.ftemp
681    
682     ifeq "$(UseMPI)" "yes"
683 tim 1557 $(DEV_ROOT)/scripts/filepp -I $(DEV_ROOT)/src -od '$$(ParallelTargetDir)/' $(ParallelDeclare) $(F90Declare) -MM -mc $(ModuleCase) -ms $(ModSuffix) $(F90Files) >> Make.ftemp
684 tim 1539 @cat Make.ftemp >> $(DependencyFile)
685     @$(Delete) Make.ftemp
686 tim 1554 endif
687    
688 gezelter 1508 endif
689    
690     # make lib
691     lib : $(PackageListLoop)
692     $(Print) Libraries built.
693    
694     _liball : $(JarFile) $(SharedLibrary) $(StaticLibrary)
695    
696     jar : $(JarFile)
697    
698     jarsign : $(JarFile)
699     $(JarSigner) -keystore GeoSoftKeystore $(JarFile) myself
700    
701 tim 1544 #make install
702     %.install :
703     @$(MAKE) $(MakeOptions) -C $(subst .install,,$@) _installall
704    
705     install : $(InstallListLoop)
706     $(Print) Done Install
707    
708     _installall : _buildall _installdata
709    
710     $(MyInstallDir) :
711     $(MkDir) $@
712    
713     _installdata : $(MyInstallDir)
714     $(Print) $(InstallFiles)
715     ifneq "$(words $(InstallFiles))" "0"
716     $(InstallData) $(InstallFiles) $(MyInstallDir)
717     endif
718    
719 gezelter 1508 # make statistics
720     _statisticsall :
721 tim 1530 @$(Print) $(patsubst %,$(CurrentDir)/%,$(SourceFiles)) >> $(DEV_ROOT)/files.tmp
722 gezelter 1508
723     statistics : $(PackageListLoop)
724     @$(List) $(DEV_ROOT)/files.tmp | xargs $(WordCount) $(WordCountOptions)
725     @$(Delete) $(DEV_ROOT)/files.tmp
726     $(Print) Done statistics.
727    
728     # make pure
729     $(Executable).pure :
730     $(Purify) $(PurifyOptions) $(CppCompiler) $(LinkOptions) $(LibDirs) \
731     $(LibList) $(ObjectFiles) -o $@
732    
733     pure : $(Executable).pure
734    
735 tim 1523 #make cvslog
736     cvslog:
737     $(DEV_ROOT)/scripts/cvs2cl.pl
738    
739 gezelter 1508 # Execute
740     _runexe :
741     $(Executable) $(RunParameters)
742    
743     _runjava :
744     $(JavaExecute) $(JavaRunOptions) $(JavaMainClass) $(RunParameters)
745    
746     run : _runjava
747    
748    
749     ifdef $(DependencyFile)
750     -include $(DependencyFile)
751     endif