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