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