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