ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/branches/new_design/OOPSE-4/make/Makefile.in
Revision: 1898
Committed: Mon Dec 20 20:36:40 2004 UTC (19 years, 6 months ago) by tim
File size: 22651 byte(s)
Log Message:
fix a test command incompatiable problem

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