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