ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/branches/new_design/OOPSE-3.0/make/Makefile.in
Revision: 1779
Committed: Wed Nov 24 18:20:15 2004 UTC (19 years, 7 months ago) by tim
File size: 22590 byte(s)
Log Message:
change Makefile

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