ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE-4/make/Makefile.in
Revision: 2157
Committed: Mon Apr 11 16:14:05 2005 UTC (19 years, 2 months ago) by gezelter
File size: 25131 byte(s)
Log Message:
added some stuff to clean out module files during "make clean"

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