ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE-2.0/make/Makefile.in
Revision: 1899
Committed: Mon Dec 20 20:50:56 2004 UTC (19 years, 6 months ago) by chuckv
File size: 22827 byte(s)
Log Message:
Fixed Makefile test bug under OSX and possibly other BSD's, replaced test -f *.mod with ls
function since BSD test apparently doesn't support wildcards.

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