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