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