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