33 |
|
# $< - Current dependency |
34 |
|
# |
35 |
|
#--------------------------------------------------------------------------- |
36 |
+ |
IS_UNIX=1 |
37 |
+ |
#packages to be made |
38 |
+ |
Packages = \ |
39 |
+ |
utils \ |
40 |
+ |
math \ |
41 |
+ |
types \ |
42 |
+ |
primitives \ |
43 |
+ |
visitors \ |
44 |
+ |
UseTheForce/DarkSide \ |
45 |
+ |
UseTheForce \ |
46 |
+ |
brains \ |
47 |
+ |
io \ |
48 |
+ |
integrators \ |
49 |
+ |
minimizers \ |
50 |
+ |
constraints \ |
51 |
+ |
profiling \ |
52 |
+ |
restraints \ |
53 |
+ |
applications/oopse \ |
54 |
+ |
applications/dump2Xyz \ |
55 |
+ |
applications/simpleBuilder \ |
56 |
+ |
|
57 |
+ |
#packages contain libraries |
58 |
+ |
PackageLibs = \ |
59 |
+ |
utils \ |
60 |
+ |
math \ |
61 |
+ |
types \ |
62 |
+ |
primitives \ |
63 |
+ |
visitors \ |
64 |
+ |
UseTheForce/DarkSide \ |
65 |
+ |
UseTheForce \ |
66 |
+ |
brains \ |
67 |
+ |
io \ |
68 |
+ |
integrators \ |
69 |
+ |
minimizers \ |
70 |
+ |
constraints \ |
71 |
+ |
profiling \ |
72 |
+ |
restraints \ |
73 |
+ |
|
74 |
+ |
IncludeDirs = \ |
75 |
+ |
/usr/include \ |
76 |
+ |
/usr/local/include \ |
77 |
+ |
|
78 |
+ |
LibraryDirs = \ |
79 |
+ |
/usr/lib \ |
80 |
+ |
/usr/local/mpich/lib \ |
81 |
+ |
/usr/local/lib \ |
82 |
+ |
/usr/local/intel/compiler80/lib \ |
83 |
+ |
|
84 |
+ |
Libraries = \ |
85 |
+ |
mpich \ |
86 |
+ |
sprng \ |
87 |
+ |
ifcore \ |
88 |
+ |
|
89 |
|
#--------------------------------------------------------------------------- |
90 |
|
# |
91 |
|
# Directories |
100 |
|
CurrentDir = $(CURDIR) |
101 |
|
|
102 |
|
ifdef Source |
103 |
< |
Package = $(subst $(SourceDir)/,,$(CurrentDir)) |
103 |
> |
#get the relative path of current package to source directory |
104 |
> |
# /home/maul/gezelter/src/code/src/UseTheForce/Darkside --> UseTheForce/Darkside |
105 |
> |
#Package = $(shell echo $(CurrentDir) | sed -e 's/^.*\/src\/\(.*\)/\1/g') |
106 |
> |
Package = $(subst $(shell cd $(SourceDir); pwd)/,,$(CurrentDir)) |
107 |
> |
|
108 |
|
PackageList = $(Package) |
109 |
|
PackageSourceDir = $(SourceDir)/$(Package) |
110 |
|
PackageTargetDir = $(TargetDir) |
114 |
|
endif |
115 |
|
|
116 |
|
PackageListLoop = $(patsubst %,$(SourceDir)/%/.loop,$(PackageList)) |
117 |
+ |
#PackageListLoop = $(PackageList) |
118 |
|
|
119 |
|
JRE = $(JAVA_HOME)/jre/lib/rt.jar |
120 |
|
|
144 |
|
$(YaccFiles) $(CorbaFiles), \ |
145 |
|
$(Source)) |
146 |
|
ManifestFile = $(PackageSourceDir)/Manifest |
147 |
< |
SourceFiles = $(JavaFiles:%.java= $(PackageSourceDir)/%.java)\ |
147 |
> |
|
148 |
> |
SourceFiles = $(JavaFiles)\ |
149 |
> |
$(CppFiles)\ |
150 |
> |
$(CFiles)\ |
151 |
> |
$(FortranFiles)\ |
152 |
> |
$(F90Files)\ |
153 |
> |
$(LexFiles)\ |
154 |
> |
$(YaccFiles) |
155 |
> |
|
156 |
> |
#SourceFiles = $(JavaFiles:%.java= $(PackageSourceDir)/%.java)\ |
157 |
|
$(CppFiles:%.cpp= $(PackageSourceDir)/%.cpp)\ |
158 |
|
$(CFiles:%.c= $(PackageSourceDir)/%.c)\ |
159 |
|
$(FortranFiles:%.f= $(PackageSourceDir)/%.f)\ |
161 |
|
$(LexFiles:%.l= $(PackageSourceDir)/%.l)\ |
162 |
|
$(YaccFiles:%.y= $(PackageSourceDir)/%.y)\ |
163 |
|
|
97 |
– |
|
164 |
|
# Target |
165 |
|
JavaClassFiles = $(JavaFiles:%.java= $(PackageTargetDir)/%.class) |
166 |
|
JavaClassFilesRel = $(JavaFiles:%.java= $(Package)/%.class) |
191 |
|
JavaPackageName = $(subst /,.,$(Package)) |
192 |
|
JarFile = $(LibDir)/$(subst /,,$(Package)).jar |
193 |
|
endif |
194 |
+ |
|
195 |
+ |
#if Main is defined, do not build library. It may not be true sometimes |
196 |
|
ifneq "$(words $(ObjectFiles))" "0" |
197 |
|
DependencyFile = $(PackageSourceDir)/Makedepend |
130 |
– |
SharedLibrary = $(LibDir)/lib$(subst /,,$(Package)).so |
131 |
– |
StaticLibrary = $(LibDir)/lib$(subst /,,$(Package)).a |
198 |
|
ifneq "$(Main)" "" |
199 |
|
Executable = $(BinDir)/$(Main) |
200 |
+ |
else |
201 |
+ |
SharedLibrary = $(LibDir)/lib$(subst /,,$(Package)).so |
202 |
+ |
StaticLibrary = $(LibDir)/lib$(subst /,,$(Package)).a |
203 |
|
endif |
204 |
|
endif |
205 |
|
# |
209 |
|
JavaPackageNames = $(subst /,.,$(JavaPackages)) |
210 |
|
IncludePath = -I$(SourceDir) $(IncludeDirs:%=-I%) |
211 |
|
LibDirs = -L$(LibDir) $(LibraryDirs:%=-L%) |
212 |
< |
LocalLibs = $(subst /,,$(Packages)) |
212 |
> |
LocalLibs = $(subst /,,$(PackageLibs)) |
213 |
|
LibList = $(LocalLibs:%=-l%) $(Libraries:%=-l%) |
214 |
|
|
215 |
|
|
245 |
|
Lex = flex |
246 |
|
|
247 |
|
|
248 |
< |
MakeOptions = -k -s |
248 |
> |
MakeOptions = -k |
249 |
|
MakeDependOptions = |
250 |
|
StaticArchiverOptions = rc |
251 |
|
DynamicArchiverOptions = -shared |
293 |
|
$(MakeDir) $@ |
294 |
|
|
295 |
|
# .c -> .o |
296 |
< |
$(PackageTargetDir)/%.o : $(PackageSourceDir)/%.c |
297 |
< |
$(Print) $@ |
229 |
< |
@$(CCompiler) $(COptions) -c $(IncludePath) $< -o $@ |
296 |
> |
$(PackageTargetDir)/%.o : %.c |
297 |
> |
$(CCompiler) $(COptions) -c $(IncludePath) $< -o $@ |
298 |
|
|
299 |
< |
%.o : $(PackageSourceDir)/%.c |
299 |
> |
%.o : %.c |
300 |
|
$(MAKE) $(MakeOptions) $(PackageTargetDir)/$@ |
301 |
|
|
302 |
|
# .cpp -> .o |
303 |
< |
$(PackageTargetDir)/%.o : $(PackageSourceDir)/%.cpp |
236 |
< |
$(Print) $@ |
303 |
> |
$(PackageTargetDir)/%.o : %.cpp |
304 |
|
$(CppCompiler) $(CppOptions) -c $(IncludePath) $< -o $@ |
305 |
|
|
306 |
< |
%.o : $(PackageSourceDir)/%.cpp |
306 |
> |
%.o : %.cpp |
307 |
|
$(MAKE) $(MakeOptions) $(PackageTargetDir)/$@ |
308 |
|
|
309 |
|
# .f -> .o |
310 |
< |
$(PackageTargetDir)/%.o : $(PackageSourceDir)/%.f |
310 |
> |
$(PackageTargetDir)/%.o : %.f |
311 |
|
$(Print) $@ |
312 |
+ |
$(Print) $(FortranCompiler) $(FortranOptions) -c $< -o $@ |
313 |
|
@$(FortranCompiler) $(FortranOptions) -c $< -o $@ |
314 |
|
|
315 |
< |
%.o : $(PackageSourceDir)/%.f |
315 |
> |
%.o : %.f |
316 |
|
$(MAKE) $(MakeOptions) $(PackageTargetDir)/$@ |
317 |
|
|
318 |
|
# .F90 -> .o |
319 |
< |
$(PackageTargetDir)/%.o : $(PackageSourceDir)/%.F90 |
320 |
< |
$(Print) $@ |
253 |
< |
@$(F90Compiler) $(F90Options) -c $< -o $@ |
319 |
> |
$(PackageTargetDir)/%.o : %.F90 |
320 |
> |
$(F90Compiler) $(F90Options) -c $< -o $@ |
321 |
|
|
322 |
< |
%.o : $(PackageSourceDir)/%.F90 |
322 |
> |
%.o : %.F90 |
323 |
|
$(MAKE) $(MakeOptions) $(PackageTargetDir)/$@ |
324 |
|
|
325 |
|
# .java -> .class |
326 |
|
$(PackageTargetDir)/%.class : $(PackageSourceDir)/%.java |
327 |
|
$(Print) $@ |
328 |
+ |
$(Print) $(JavaCompiler) $(JavaCompilerOptions) $< |
329 |
|
@$(JavaCompiler) $(JavaCompilerOptions) $< |
330 |
|
|
331 |
|
%.class : $(PackageSourceDir)/%.java |
334 |
|
# .class -> .h |
335 |
|
$(PackageSourceDir)/%.h : $(PackageTargetDir)/%.class |
336 |
|
$(Print) $@ |
337 |
+ |
$(Print) $(JniCompiler) $(JniOptions) $(JavaPackageName).$* |
338 |
|
$(JniCompiler) $(JniOptions) $(JavaPackageName).$* |
339 |
|
|
340 |
|
%.h : %.class |
341 |
|
$(MAKE) $(MakeOptions) $(PackageSourceDir)/$@ |
342 |
|
|
343 |
|
#.y -> .h |
344 |
< |
$(PackageSourceDir)/%.h : $(PackageSourceDir)/%.y |
344 |
> |
%.h : %.y |
345 |
|
$(Print) $@ |
346 |
|
$(Print) @$(Yacc) -d $? |
347 |
|
@$(Yacc) -d $? |
349 |
|
@$(Delete) y.tab.c |
350 |
|
|
351 |
|
#.y -> .c |
352 |
< |
$(PackageSourceDir)/%.c : $(PackageSourceDir)/%.y |
352 |
> |
%.c : %.y |
353 |
|
$(Print) $@ |
354 |
< |
$(Print) @$(Yacc) -d $? |
354 |
> |
$(Print) $(Yacc) -d $? |
355 |
|
@$(Yacc) -d $? |
356 |
|
@$(Move) y.tab.c $*.c |
357 |
|
@$(Delete) y.tab.h |
358 |
|
|
359 |
|
# .l -> .c |
360 |
< |
$(PackageSourceDir)/%.c : $(PackageSourceDir)/%.l |
360 |
> |
%.c : %.l |
361 |
|
$(Print) $@ |
362 |
< |
$(Print) @$(Lex) -o$@ $? |
362 |
> |
$(Print) $(Lex) -o$@ $? |
363 |
|
@$(Lex) -o$@ $? |
364 |
|
|
365 |
|
# .o -> .a |
366 |
|
$(LibDir)/%.a : $(ObjectFiles) |
367 |
|
$(Print) $@ |
368 |
+ |
$(Print) $(StaticArchiver) $(StaticArchiverOptions) $@ $(ObjectFiles) |
369 |
|
@$(StaticArchiver) $(StaticArchiverOptions) $@ $(ObjectFiles) |
370 |
|
|
371 |
|
%.a : $(ObjectFiles) |
374 |
|
# .o -> .so |
375 |
|
$(LibDir)/%.so : $(ObjectFiles) |
376 |
|
$(Print) $@ |
377 |
+ |
$(Print) $(DynamicArchiver) $(ObjectFiles) $(DynamicArchiverOptions) -o $@ |
378 |
|
$(DynamicArchiver) $(ObjectFiles) $(DynamicArchiverOptions) -o $@ |
379 |
|
|
380 |
|
%.so : $(ObjectFiles) |
383 |
|
# .class -> .jar |
384 |
|
$(LibDir)/%.jar : $(JavaClassFiles) $(OtherTargetFiles) |
385 |
|
$(Print) $@ |
386 |
+ |
$(Print) $(JavaArchiver) -cf $@ $(JavaClassFilesRel) $(OtherTargetFiles) |
387 |
|
@cd $(TargetDir); $(JavaArchiver) -cf $@ \ |
388 |
|
$(JavaClassFilesRel) $(OtherTargetFiles) |
389 |
|
|
416 |
|
# Executable |
417 |
|
$(Executable) : $(ObjectFiles) |
418 |
|
$(Print) $@ |
419 |
+ |
$(Print) $(Linker) $(LinkOptions) $(LibDirs) $(LibList) $(ObjectFiles) -o $@ |
420 |
|
$(Linker) $(LinkOptions) $(LibDirs) $(LibList) $(ObjectFiles) -o $@ |
421 |
|
|
422 |
|
# Anything else is just copied from source to target |
449 |
|
$(Print) Done clean. |
450 |
|
|
451 |
|
_cleanall : |
452 |
< |
$(Delete) $(PackageTargetDir)/* \ |
452 |
> |
$(Delete) $(ObjectFiles) $(ParallelObjectFiles) |
453 |
> |
|
454 |
> |
# make distclean |
455 |
> |
distclean : $(PackageListLoop) |
456 |
> |
$(Print) Done clean. |
457 |
> |
|
458 |
> |
_distcleanall : |
459 |
> |
$(Delete) $(ObjectFiles) \ |
460 |
> |
$(ParallelObjectFiles) \ |
461 |
|
$(JarFile) \ |
462 |
|
$(SharedLibrary) \ |
463 |
|
$(StaticLibrary) \ |
464 |
+ |
$(ParallelSharedLibrary) \ |
465 |
+ |
$(ParallelStaticLibrary) \ |
466 |
|
$(Executable) \ |
467 |
+ |
$(ParallelExecutable) \ |
468 |
|
$(DependencyFile) |
469 |
|
|
470 |
|
|
476 |
|
|
477 |
|
$(DependencyFile) : $(DerivedSource) |
478 |
|
$(Print) $@ |
395 |
– |
$(Print) $(DerivedSource) |
479 |
|
@cd $(PackageSourceDir) |
397 |
– |
$(CppCompiler) $(IncludePath) -MM $(CppFiles) > Make.temp |
398 |
– |
$(CCompiler) $(IncludePath) -MM $(CFiles) $(DerivedCFiles) >> Make.temp |
399 |
– |
cat Make.temp | sed 's/^[a-zA-Z0-9]/$$\(DEV_ROOT\)\/obj\/&/g' >> $(DependencyFile) |
400 |
– |
cat Make.temp | sed 's/^[a-zA-Z0-9]/$$\(DEV_ROOT\)\/MPIobj\/&/g' >> $(DependencyFile) |
401 |
– |
#$(DEV_ROOT)/scripts/sfmakedepend -I $(DEV_ROOT)/src -d $(DEV_ROOT)/obj -f ./Make.ftemp -h *.F90 |
402 |
– |
#$(DEV_ROOT)/scripts/sfmakedepend -I $(DEV_ROOT)/src -d $(DEV_ROOT)/MPIobj -f ./Make.ftemp -h *.F90 |
403 |
– |
#cat Make.ftemp >> $(DependencyFile) |
404 |
– |
$(Delete) Make.temp Make.ftemp |
480 |
|
|
481 |
+ |
touch Make.ctemp |
482 |
+ |
touch Make.ctemp |
483 |
+ |
|
484 |
+ |
ifneq "$(words $(CppFiles))" "0" |
485 |
+ |
$(Print) Make dependencies for $(CppFiles) |
486 |
+ |
$(Print) $(CppCompiler) $(IncludePath) -MM $(CppFiles) > Make.cpptemp |
487 |
+ |
$(CppCompiler) $(IncludePath) -MM $(CppFiles) > Make.cpptemp |
488 |
+ |
cat Make.cpptemp | sed 's/^[a-zA-Z0-9]/$$\(DEV_ROOT\)\/obj\/&/g' >> $(DependencyFile) |
489 |
+ |
cat Make.cpptemp | sed 's/^[a-zA-Z0-9]/$$\(DEV_ROOT\)\/MPIobj\/&/g' >> $(DependencyFile) |
490 |
+ |
endif |
491 |
+ |
|
492 |
+ |
ifneq "$(words $(CFiles))" "0" |
493 |
+ |
$(Print) Make dependencies for $(CFiles) |
494 |
+ |
$(Print) $(CCompiler) $(IncludePath) -MM $(CFiles) $(DerivedCFiles) > Make.ctemp |
495 |
+ |
$(CCompiler) $(IncludePath) -MM $(CFiles) $(DerivedCFiles) > Make.ctemp |
496 |
+ |
cat Make.ctemp | sed 's/^[a-zA-Z0-9]/$$\(DEV_ROOT\)\/obj\/&/g' >> $(DependencyFile) |
497 |
+ |
cat Make.ctemp | sed 's/^[a-zA-Z0-9]/$$\(DEV_ROOT\)\/MPIobj\/&/g' >> $(DependencyFile) |
498 |
+ |
|
499 |
+ |
endif |
500 |
+ |
|
501 |
+ |
ifneq "$(words $(F90Files))" "0" |
502 |
+ |
$(Print) Make dependencies for $(F90Files) |
503 |
+ |
$(DEV_ROOT)/scripts/sfmakedepend -I $(DEV_ROOT)/src -d '$$(DEV_ROOT)/obj' -f ./Make.ftemp -h *.F90 |
504 |
+ |
cat Make.ftemp >> $(DependencyFile) |
505 |
+ |
endif |
506 |
+ |
$(Delete) Make.cpptemp Make.ctemp Make.ftemp |
507 |
+ |
|
508 |
|
# make lib |
509 |
|
lib : $(PackageListLoop) |
510 |
|
$(Print) Libraries built. |