1 | #!/usr/bin/env tclsh
|
---|
2 |
|
---|
3 | set prefix "tmp/"
|
---|
4 | set suffix " \\\n\t"
|
---|
5 |
|
---|
6 | set srcSuf {.$(SrcSuf)}
|
---|
7 | set objSuf {.$(ObjSuf)}
|
---|
8 | set exeSuf {$(ExeSuf)}
|
---|
9 |
|
---|
10 | proc dependencies {fileName firstLine {force 1} {command {}}} {
|
---|
11 | global suffix headerFiles sourceFiles
|
---|
12 |
|
---|
13 | if {[info exists sourceFiles($fileName)]} return
|
---|
14 |
|
---|
15 | set sourceFiles($fileName) 1
|
---|
16 |
|
---|
17 | set list {}
|
---|
18 | set fid [open $fileName]
|
---|
19 | while {! [eof $fid]} {
|
---|
20 | set line [gets $fid]
|
---|
21 | if [regexp -- {^\s*#include\s*"((\w+/)+\w+\.(h|hh))"} $line] {
|
---|
22 | set elements [split $line {"}]
|
---|
23 | set file [lindex $elements 1]
|
---|
24 | if [file exists $file] {
|
---|
25 | lappend list $file
|
---|
26 | set headerFiles($file) 1
|
---|
27 | }
|
---|
28 | }
|
---|
29 | }
|
---|
30 |
|
---|
31 | if {[llength $list] > 0} {
|
---|
32 | puts -nonewline $firstLine
|
---|
33 | foreach file $list {puts -nonewline $suffix$file}
|
---|
34 | if {$command != {}} {
|
---|
35 | puts ""
|
---|
36 | puts $command
|
---|
37 | }
|
---|
38 | puts ""
|
---|
39 | } elseif {$force} {
|
---|
40 | puts -nonewline $firstLine
|
---|
41 | if {$command != {}} {
|
---|
42 | puts ""
|
---|
43 | puts $command
|
---|
44 | }
|
---|
45 | puts ""
|
---|
46 | }
|
---|
47 |
|
---|
48 | close $fid
|
---|
49 | }
|
---|
50 |
|
---|
51 | proc dictDeps {dictVar args} {
|
---|
52 |
|
---|
53 | global prefix suffix srcSuf objSuf
|
---|
54 |
|
---|
55 | set dict [eval glob -nocomplain $args]
|
---|
56 |
|
---|
57 | set dictSrcFiles {}
|
---|
58 | set dictObjFiles {}
|
---|
59 |
|
---|
60 | foreach fileName $dict {
|
---|
61 | regsub {LinkDef\.h} $fileName {Dict} dictName
|
---|
62 | set dictName $prefix$dictName
|
---|
63 |
|
---|
64 | lappend dictSrcFiles $dictName$srcSuf
|
---|
65 | lappend dictObjFiles $dictName$objSuf
|
---|
66 |
|
---|
67 | dependencies $fileName "$dictName$srcSuf:$suffix$fileName"
|
---|
68 | }
|
---|
69 |
|
---|
70 | puts -nonewline "${dictVar} = $suffix"
|
---|
71 | puts [join $dictSrcFiles $suffix]
|
---|
72 | puts ""
|
---|
73 |
|
---|
74 | puts -nonewline "${dictVar}_OBJ = $suffix"
|
---|
75 | puts [join $dictObjFiles $suffix]
|
---|
76 | puts ""
|
---|
77 |
|
---|
78 | }
|
---|
79 |
|
---|
80 | proc sourceDeps {srcPrefix args} {
|
---|
81 |
|
---|
82 | global prefix suffix srcSuf objSuf
|
---|
83 |
|
---|
84 | set source [eval glob -nocomplain $args]
|
---|
85 |
|
---|
86 | set srcObjFiles {}
|
---|
87 |
|
---|
88 | foreach fileName $source {
|
---|
89 | regsub {\.cc} $fileName {} srcName
|
---|
90 | set srcObjName $prefix$srcName
|
---|
91 |
|
---|
92 | lappend srcObjFiles $srcObjName$objSuf
|
---|
93 |
|
---|
94 | dependencies $fileName "$srcObjName$objSuf:$suffix$srcName$srcSuf"
|
---|
95 | }
|
---|
96 |
|
---|
97 | puts -nonewline "${srcPrefix}_OBJ = $suffix"
|
---|
98 | puts [join $srcObjFiles $suffix]
|
---|
99 | puts ""
|
---|
100 | }
|
---|
101 |
|
---|
102 | proc tclDeps {} {
|
---|
103 |
|
---|
104 | global prefix suffix srcSuf objSuf
|
---|
105 |
|
---|
106 | set source [glob -nocomplain {tcl/*.c}]
|
---|
107 |
|
---|
108 | set srcObjFiles {}
|
---|
109 |
|
---|
110 | foreach fileName $source {
|
---|
111 | if {$fileName == "tcl/tclc.c" || $fileName == "tcl/tcl.c"} continue
|
---|
112 |
|
---|
113 | regsub {\.c} $fileName {} srcName
|
---|
114 | set srcObjName $prefix$srcName
|
---|
115 |
|
---|
116 | lappend srcObjFiles $srcObjName$objSuf
|
---|
117 |
|
---|
118 | dependencies $fileName "$srcObjName$objSuf:$suffix$fileName"
|
---|
119 | }
|
---|
120 |
|
---|
121 | puts -nonewline "TCL_OBJ = $suffix"
|
---|
122 | puts [join $srcObjFiles $suffix]
|
---|
123 | puts ""
|
---|
124 | }
|
---|
125 |
|
---|
126 | proc stdhepDeps {} {
|
---|
127 |
|
---|
128 | global prefix suffix srcSuf objSuf
|
---|
129 |
|
---|
130 | set source [glob -nocomplain {mcfio/*.c} {stdhep/*.c}]
|
---|
131 |
|
---|
132 | set srcObjFiles {}
|
---|
133 |
|
---|
134 | foreach fileName $source {
|
---|
135 | regsub {\.c} $fileName {} srcName
|
---|
136 | set srcObjName $prefix$srcName
|
---|
137 |
|
---|
138 | lappend srcObjFiles $srcObjName$objSuf
|
---|
139 |
|
---|
140 | dependencies $fileName "$srcObjName$objSuf:$suffix$fileName"
|
---|
141 | }
|
---|
142 |
|
---|
143 | puts -nonewline "STDHEP_OBJ = $suffix"
|
---|
144 | puts [join $srcObjFiles $suffix]
|
---|
145 | puts ""
|
---|
146 | }
|
---|
147 |
|
---|
148 | proc stdhepExecutableDeps {} {
|
---|
149 |
|
---|
150 | global prefix suffix objSuf exeSuf
|
---|
151 |
|
---|
152 | set executable [glob -nocomplain {test/ExRootSTDHEPConverter.cpp} \
|
---|
153 | {test/MatchingSTDHEPConverter.cpp}]
|
---|
154 |
|
---|
155 | set exeFiles {}
|
---|
156 |
|
---|
157 | foreach fileName $executable {
|
---|
158 | regsub {\.cpp} $fileName {} exeObjName
|
---|
159 | set exeObjName $prefix$exeObjName
|
---|
160 | set exeName [file tail $exeObjName]
|
---|
161 |
|
---|
162 | lappend exeFiles $exeName$exeSuf
|
---|
163 | lappend exeObjFiles $exeObjName$objSuf
|
---|
164 |
|
---|
165 | puts "$exeName$exeSuf:$suffix$exeObjName$objSuf"
|
---|
166 | puts ""
|
---|
167 |
|
---|
168 | dependencies $fileName "$exeObjName$objSuf:$suffix$fileName"
|
---|
169 | }
|
---|
170 |
|
---|
171 | if [info exists exeFiles] {
|
---|
172 | puts -nonewline "STDHEP_EXECUTABLE = $suffix"
|
---|
173 | puts [join $exeFiles $suffix]
|
---|
174 | puts ""
|
---|
175 | }
|
---|
176 | if [info exists exeObjFiles] {
|
---|
177 | puts -nonewline "STDHEP_EXECUTABLE_OBJ = $suffix"
|
---|
178 | puts [join $exeObjFiles $suffix]
|
---|
179 | puts ""
|
---|
180 | }
|
---|
181 |
|
---|
182 | }
|
---|
183 |
|
---|
184 | proc executableDeps {} {
|
---|
185 |
|
---|
186 | global prefix suffix objSuf exeSuf
|
---|
187 |
|
---|
188 | set executable [glob -nocomplain {test/*.cpp}]
|
---|
189 |
|
---|
190 | set exeFiles {}
|
---|
191 |
|
---|
192 | foreach fileName $executable {
|
---|
193 | if {$fileName == "test/ExRootSTDHEPConverter.cpp"} continue
|
---|
194 | if {$fileName == "test/MatchingSTDHEPConverter.cpp"} continue
|
---|
195 | regsub {\.cpp} $fileName {} exeObjName
|
---|
196 | set exeObjName $prefix$exeObjName
|
---|
197 | set exeName [file tail $exeObjName]
|
---|
198 |
|
---|
199 | lappend exeFiles $exeName$exeSuf
|
---|
200 | lappend exeObjFiles $exeObjName$objSuf
|
---|
201 |
|
---|
202 | puts "$exeName$exeSuf:$suffix$exeObjName$objSuf"
|
---|
203 | puts ""
|
---|
204 |
|
---|
205 | dependencies $fileName "$exeObjName$objSuf:$suffix$fileName"
|
---|
206 | }
|
---|
207 |
|
---|
208 | if [info exists exeFiles] {
|
---|
209 | puts -nonewline "EXECUTABLE = $suffix"
|
---|
210 | puts [join $exeFiles $suffix]
|
---|
211 | puts ""
|
---|
212 | }
|
---|
213 | if [info exists exeObjFiles] {
|
---|
214 | puts -nonewline "EXECUTABLE_OBJ = $suffix"
|
---|
215 | puts [join $exeObjFiles $suffix]
|
---|
216 | puts ""
|
---|
217 | }
|
---|
218 |
|
---|
219 | }
|
---|
220 |
|
---|
221 | proc headerDeps {} {
|
---|
222 | global suffix headerFiles
|
---|
223 |
|
---|
224 | foreach fileName [array names headerFiles] {
|
---|
225 | dependencies $fileName "$fileName:" 0 "\t@touch \$@"
|
---|
226 | }
|
---|
227 | }
|
---|
228 |
|
---|
229 | puts {
|
---|
230 | #
|
---|
231 | # Makefile for ExRootAnalysis
|
---|
232 | #
|
---|
233 | # Author: P. Demin - UCL, Louvain-la-Neuve
|
---|
234 | #
|
---|
235 | # multi-platform configuration is taken from ROOT (root/test/Makefile)
|
---|
236 | #
|
---|
237 |
|
---|
238 | ARCH = $(shell root-config --arch)
|
---|
239 |
|
---|
240 | CXX =
|
---|
241 | ObjSuf = o
|
---|
242 | SrcSuf = cc
|
---|
243 | ExeSuf =
|
---|
244 | DllSuf = so
|
---|
245 | LibSuf = a
|
---|
246 | OutPutOpt = -o # keep whitespace after "-o"
|
---|
247 |
|
---|
248 | ROOTCFLAGS := $(shell root-config --cflags)
|
---|
249 | ROOTLIBS := $(shell root-config --libs)
|
---|
250 | ROOTGLIBS := $(shell root-config --glibs)
|
---|
251 |
|
---|
252 | ifeq ($(ARCH),win32)
|
---|
253 | PLATFORM = win32
|
---|
254 | endif
|
---|
255 | ifeq ($(ARCH),win32gdk)
|
---|
256 | PLATFORM = win32
|
---|
257 | endif
|
---|
258 |
|
---|
259 | ifeq ($(ARCH),hpux)
|
---|
260 | # HP-UX with CC
|
---|
261 | CXX = CC
|
---|
262 | CXXFLAGS = -O +Z
|
---|
263 | LD = CC
|
---|
264 | LDFLAGS= -O +a1 -z
|
---|
265 | SOFLAGS= -b
|
---|
266 | DllSuf = sl
|
---|
267 | endif
|
---|
268 |
|
---|
269 | ifeq ($(ARCH),hpuxacc)
|
---|
270 | # HP-UX 10.x with aCC
|
---|
271 | CXX = aCC
|
---|
272 | CXXFLAGS = -O +Z
|
---|
273 | LD = aCC
|
---|
274 | LDFLAGS= -O -z
|
---|
275 | SOFLAGS= -b
|
---|
276 | endif
|
---|
277 |
|
---|
278 | ifeq ($(ARCH),hpuxia64acc)
|
---|
279 | # HP-UX 11i 1.5 (IA-64) with aCC
|
---|
280 | CXX = aCC
|
---|
281 | CXXFLAGS = +DD64 -O +Z
|
---|
282 | LD = aCC
|
---|
283 | LDFLAGS= +DD64 -O -z
|
---|
284 | SOFLAGS= -b
|
---|
285 | endif
|
---|
286 |
|
---|
287 | ifeq ($(ARCH),hpuxegcs)
|
---|
288 | # HP-UX 10.x with g++
|
---|
289 | CXXFLAGS = -O -fPIC
|
---|
290 | CXX = g++
|
---|
291 | LD = g++
|
---|
292 | LDFLAGS= -O
|
---|
293 | SOFLAGS= -fPIC -shared
|
---|
294 | endif
|
---|
295 |
|
---|
296 |
|
---|
297 | ifeq ($(ARCH),hurddeb)
|
---|
298 | # GNU/Hurd
|
---|
299 | CXX = g++
|
---|
300 | CXXFLAGS = -O -Wall -fPIC
|
---|
301 | LD = g++
|
---|
302 | LDFLAGS= -O
|
---|
303 | SOFLAGS= -shared
|
---|
304 | endif
|
---|
305 |
|
---|
306 | ifeq ($(ARCH),aix)
|
---|
307 | # IBM AIX xlC 4.x
|
---|
308 | CXX = xlC
|
---|
309 | CXXFLAGS = -O
|
---|
310 | LD = xlC
|
---|
311 | LDFLAGS= -O
|
---|
312 | SOFLAGS=
|
---|
313 | ROOTLIBS := $(shell root-config --nonew --libs)
|
---|
314 | ROOTGLIBS := $(shell root-config --nonew --glibs)
|
---|
315 | endif
|
---|
316 |
|
---|
317 | ifeq ($(ARCH),aix5)
|
---|
318 | # IBM AIX xlC 5.x
|
---|
319 | CXX = xlC
|
---|
320 | CXXFLAGS = -O
|
---|
321 | LD = xlC
|
---|
322 | LDFLAGS= -O
|
---|
323 | SOFLAGS=
|
---|
324 | ROOTLIBS := $(shell root-config --nonew --libs)
|
---|
325 | ROOTGLIBS := $(shell root-config --nonew --glibs)
|
---|
326 | endif
|
---|
327 |
|
---|
328 | ifeq ($(ARCH),aixegcs)
|
---|
329 | # IBM AIX with GCC
|
---|
330 | CXX = g++
|
---|
331 | CXXFLAGS = -O
|
---|
332 | LD = g++
|
---|
333 | LDFLAGS= -O
|
---|
334 | SOFLAGS= -shared
|
---|
335 | endif
|
---|
336 |
|
---|
337 | ifeq ($(ARCH),solaris)
|
---|
338 | # Solaris CC
|
---|
339 | CXX = /opt/SUNWspro/bin/CC
|
---|
340 | CXXFLAGS = -O -KPIC
|
---|
341 | LD = /opt/SUNWspro/bin/CC
|
---|
342 | LDFLAGS= -O
|
---|
343 | SOFLAGS= -G
|
---|
344 | endif
|
---|
345 |
|
---|
346 | ifeq ($(ARCH),solarisCC5)
|
---|
347 | # Solaris CC 5.0
|
---|
348 | CXX = CC
|
---|
349 | CXXFLAGS = -O -KPIC
|
---|
350 | LD = CC
|
---|
351 | LDFLAGS= -O
|
---|
352 | SOFLAGS= -G
|
---|
353 | endif
|
---|
354 |
|
---|
355 | ifeq ($(ARCH),solarisegcs)
|
---|
356 | # Solaris egcs
|
---|
357 | CXX = g++
|
---|
358 | CXXFLAGS = -O -fPIC
|
---|
359 | LD = CC
|
---|
360 | LDFLAGS= -O
|
---|
361 | SOFLAGS= -shared
|
---|
362 | endif
|
---|
363 |
|
---|
364 | ifeq ($(ARCH),solarisgcc)
|
---|
365 | # Solaris gcc
|
---|
366 | CXX = g++
|
---|
367 | CXXFLAGS = -O -fPIC
|
---|
368 | LD = g++
|
---|
369 | LDFLAGS= -O
|
---|
370 | SOFLAGS= -shared
|
---|
371 | endif
|
---|
372 |
|
---|
373 | ifeq ($(ARCH),solariskcc)
|
---|
374 | # Solaris kcc
|
---|
375 | CXX = KCC --one_instantiation_per_object
|
---|
376 | CXXFLAGS = -O4 -KPIC
|
---|
377 | LD = KCC
|
---|
378 | LDFLAGS= -O4
|
---|
379 | SOFLAGS=
|
---|
380 | endif
|
---|
381 |
|
---|
382 | ifeq ($(ARCH),solarisx86)
|
---|
383 | # Solaris CC on Intel
|
---|
384 | CXX = CC
|
---|
385 | CXXFLAGS = -O -KPIC
|
---|
386 | LD = CC
|
---|
387 | LDFLAGS= -O
|
---|
388 | SOFLAGS= -G
|
---|
389 | endif
|
---|
390 |
|
---|
391 | ifeq ($(ARCH),sgicc)
|
---|
392 | # SGI
|
---|
393 | CXX = CC -n32 -I/usr/include/CC.sgi
|
---|
394 | CXXFLAGS = -O
|
---|
395 | LD = CC -n32 -I/usr/include/CC.sgi
|
---|
396 | LDFLAGS= -O
|
---|
397 | SOFLAGS= -shared
|
---|
398 | endif
|
---|
399 |
|
---|
400 | ifeq ($(ARCH),sgiegcs)
|
---|
401 | # SGI 6.x with EGCS
|
---|
402 | CXX = g++
|
---|
403 | CXXFLAGS = -O -Wall -fPIC
|
---|
404 | LD = g++
|
---|
405 | LDFLAGS= -O -Wl,-u,__builtin_new -Wl,-u,__builtin_delete -Wl,-u,__nw__FUiPv
|
---|
406 | SOFLAGS= -shared
|
---|
407 | endif
|
---|
408 |
|
---|
409 | ifeq ($(ARCH),sgin32egcs)
|
---|
410 | # SGI 6.x with EGCS for n32 ABI
|
---|
411 | CXX = g++
|
---|
412 | CXXFLAGS = -O -Wall -fPIC
|
---|
413 | LD = g++
|
---|
414 | LDFLAGS= -O -L/usr/lib32 -Wl,-woff,134
|
---|
415 | SOFLAGS= -shared
|
---|
416 | endif
|
---|
417 |
|
---|
418 | ifeq ($(ARCH),sgigcc)
|
---|
419 | # SGI with GCC
|
---|
420 | CXX = g++
|
---|
421 | CXXFLAGS = -O -Wall -fPIC
|
---|
422 | LD = g++
|
---|
423 | LDFLAGS= -O -Wl,-u,__builtin_new -Wl,-u,__builtin_delete -Wl,-u,__nw__FUiPv
|
---|
424 | SOFLAGS= -shared
|
---|
425 | endif
|
---|
426 |
|
---|
427 | ifeq ($(ARCH),sgikcc)
|
---|
428 | # SGI with KCC
|
---|
429 | CXX = KCC -n32 --one_instantiation_per_object
|
---|
430 | CXXFLAGS = -O
|
---|
431 | LD = KCC -n32
|
---|
432 | LDFLAGS= -O
|
---|
433 | SOFLAGS=
|
---|
434 | endif
|
---|
435 |
|
---|
436 | ifeq ($(ARCH),alphagcc)
|
---|
437 | # Alpha/OSF with g++
|
---|
438 | CXX = g++
|
---|
439 | CXXFLAGS = -O -Wall -fPIC
|
---|
440 | LD = g++
|
---|
441 | LDFLAGS= -O
|
---|
442 | SOFLAGS= -Wl,-expect_unresolved,* -shared
|
---|
443 | endif
|
---|
444 |
|
---|
445 | ifeq ($(ARCH),alphaegcs)
|
---|
446 | # Alpha/OSF with egcs
|
---|
447 | CXX = g++
|
---|
448 | CXXFLAGS = -O -Wall -fPIC
|
---|
449 | LD = g++
|
---|
450 | LDFLAGS= -O
|
---|
451 | SOFLAGS= -Wl,-expect_unresolved,* -shared
|
---|
452 | endif
|
---|
453 |
|
---|
454 | ifeq ($(ARCH),alphakcc)
|
---|
455 | # Alpha/OSF with kai compiler (not yet valid)
|
---|
456 | CXX = KCC --one_instantiation_per_object
|
---|
457 | CXXFLAGS = -O -fPIC
|
---|
458 | LD = KCC
|
---|
459 | LDFLAGS= -O
|
---|
460 | SOFLAGS= -Wl,-expect_unresolved,* -shared
|
---|
461 | endif
|
---|
462 |
|
---|
463 | ifeq ($(ARCH),alphacxx6)
|
---|
464 | # Alpha/OSF with cxx6
|
---|
465 | CXX = cxx
|
---|
466 | CXXFLAGS = -O
|
---|
467 | LD = cxx
|
---|
468 | LDFLAGS= -O
|
---|
469 | SOFLAGS= -shared -nocxxstd -Wl,-expect_unresolved,*,-msym
|
---|
470 | endif
|
---|
471 |
|
---|
472 | ifeq ($(ARCH),alphacxx)
|
---|
473 | # Alpha/OSF with cxx5
|
---|
474 | CXX = cxx
|
---|
475 | CXXFLAGS = -O
|
---|
476 | LD = cxx
|
---|
477 | LDFLAGS= -O
|
---|
478 | SOFLAGS= -Wl,-expect_unresolved,* -call_shared
|
---|
479 | endif
|
---|
480 |
|
---|
481 | ifeq ($(ARCH),linuxrh51)
|
---|
482 | # Linux with gcc 2.7.2.x
|
---|
483 | CXX = g++
|
---|
484 | CXXFLAGS = -O -Wall -fPIC
|
---|
485 | LD = g++
|
---|
486 | LDFLAGS= -O
|
---|
487 | SOFLAGS= -shared
|
---|
488 | AR = ar
|
---|
489 | ARFLAGS = cru
|
---|
490 | RANLIB = ranlib
|
---|
491 | endif
|
---|
492 |
|
---|
493 | ifeq ($(ARCH),linuxrh42)
|
---|
494 | # Linux with gcc 2.7.2.x (RedHat 4.2)
|
---|
495 | CXX = g++
|
---|
496 | CXXFLAGS = -O -Wall -fPIC
|
---|
497 | LD = g++
|
---|
498 | LDFLAGS= -O
|
---|
499 | SOFLAGS= -shared
|
---|
500 | AR = ar
|
---|
501 | ARFLAGS = cru
|
---|
502 | RANLIB = ranlib
|
---|
503 | endif
|
---|
504 |
|
---|
505 | ifeq ($(ARCH),linuxdeb)
|
---|
506 | # Linux with gcc 2.7.2.x
|
---|
507 | CXX = g++
|
---|
508 | CXXFLAGS = -O -Wall -fPIC
|
---|
509 | LD = g++
|
---|
510 | LDFLAGS= -O
|
---|
511 | SOFLAGS= -shared
|
---|
512 | AR = ar
|
---|
513 | ARFLAGS = cru
|
---|
514 | RANLIB = ranlib
|
---|
515 | endif
|
---|
516 |
|
---|
517 | ifeq ($(ARCH),linuxdeb2)
|
---|
518 | # Linux with gcc 2.7.2.x
|
---|
519 | CXX = g++
|
---|
520 | CXXFLAGS = -O -Wall -fPIC
|
---|
521 | LD = g++
|
---|
522 | LDFLAGS= -O
|
---|
523 | SOFLAGS= -shared
|
---|
524 | AR = ar
|
---|
525 | ARFLAGS = cru
|
---|
526 | RANLIB = ranlib
|
---|
527 | endif
|
---|
528 |
|
---|
529 | ifeq ($(ARCH),linuxdeb2ppc)
|
---|
530 | # Debian/Linux on the PowerPC
|
---|
531 | CXX = g++
|
---|
532 | CXXFLAGS = -O -Wall -fPIC
|
---|
533 | LD = g++
|
---|
534 | LDFLAGS= -O
|
---|
535 | SOFLAGS= -shared
|
---|
536 | AR = ar
|
---|
537 | ARFLAGS = cru
|
---|
538 | RANLIB = ranlib
|
---|
539 | endif
|
---|
540 |
|
---|
541 |
|
---|
542 | ifeq ($(ARCH),linuxsuse6)
|
---|
543 | # Linux with gcc 2.7.2.x
|
---|
544 | CXX = g++
|
---|
545 | CXXFLAGS = -O -Wall -fPIC
|
---|
546 | LD = g++
|
---|
547 | LDFLAGS= -O
|
---|
548 | SOFLAGS= -shared
|
---|
549 | AR = ar
|
---|
550 | ARFLAGS = cru
|
---|
551 | RANLIB = ranlib
|
---|
552 | endif
|
---|
553 |
|
---|
554 | ifeq ($(ARCH),linux)
|
---|
555 | # Linux with egcs, gcc 2.9x, gcc 3.x (>= RedHat 5.2)
|
---|
556 | CXX = g++
|
---|
557 | CXXFLAGS = -O -Wall -fPIC
|
---|
558 | LD = g++
|
---|
559 | LDFLAGS= -O
|
---|
560 | SOFLAGS= -shared
|
---|
561 | AR = ar
|
---|
562 | ARFLAGS = cru
|
---|
563 | RANLIB = ranlib
|
---|
564 | endif
|
---|
565 |
|
---|
566 | ifeq ($(ARCH),linuxkcc)
|
---|
567 | # Linux with the KAI compiler
|
---|
568 | CXX = KCC --one_instantiation_per_object
|
---|
569 | CXXFLAGS = -fPIC +K0
|
---|
570 | LD = KCC
|
---|
571 | LDFLAGS= -O $(shell root-config --cflags)
|
---|
572 | SOFLAGS=
|
---|
573 | AR = ar
|
---|
574 | ARFLAGS = cru
|
---|
575 | RANLIB = ranlib
|
---|
576 | endif
|
---|
577 |
|
---|
578 | ifeq ($(ARCH),linuxicc)
|
---|
579 | # Linux with Intel icc compiler
|
---|
580 | CXX = icc
|
---|
581 | CXXFLAGS = -O
|
---|
582 | LD = icc
|
---|
583 | LDFLAGS= -O
|
---|
584 | SOFLAGS= -shared
|
---|
585 | AR = ar
|
---|
586 | ARFLAGS = cru
|
---|
587 | RANLIB = ranlib
|
---|
588 | endif
|
---|
589 |
|
---|
590 | ifeq ($(ARCH),linuxppcegcs)
|
---|
591 | # MkLinux with egcs/glibc
|
---|
592 | CXX = g++
|
---|
593 | CXXFLAGS = -O -Wall -fPIC
|
---|
594 | LD = g++
|
---|
595 | LDFLAGS= -O
|
---|
596 | SOFLAGS= -shared
|
---|
597 | AR = ar
|
---|
598 | ARFLAGS = cru
|
---|
599 | RANLIB = ranlib
|
---|
600 | endif
|
---|
601 |
|
---|
602 | ifeq ($(ARCH),linuxia64gcc)
|
---|
603 | # Itanium Linux with gcc 2.9x
|
---|
604 | CXX = g++
|
---|
605 | CXXFLAGS = -O -Wall -fPIC
|
---|
606 | LD = g++
|
---|
607 | LDFLAGS= -O
|
---|
608 | SOFLAGS= -shared
|
---|
609 | AR = ar
|
---|
610 | ARFLAGS = cru
|
---|
611 | RANLIB = ranlib
|
---|
612 | endif
|
---|
613 |
|
---|
614 | ifeq ($(ARCH),linuxia64sgi)
|
---|
615 | # Itanium Linux with sgiCC
|
---|
616 | CXX = sgiCC
|
---|
617 | CXXFLAGS = -O -Wall -fPIC
|
---|
618 | LD = gsgiCC
|
---|
619 | LDFLAGS= -O
|
---|
620 | SOFLAGS= -shared
|
---|
621 | AR = ar
|
---|
622 | ARFLAGS = cru
|
---|
623 | RANLIB = ranlib
|
---|
624 | endif
|
---|
625 |
|
---|
626 | ifeq ($(ARCH),linuxia64ecc)
|
---|
627 | # Itanium Linux with Intel ecc
|
---|
628 | CXX = ecc
|
---|
629 | CXXFLAGS = -O
|
---|
630 | LD = ecc
|
---|
631 | LDFLAGS= -O -i_dynamic
|
---|
632 | SOFLAGS= -shared
|
---|
633 | AR = ar
|
---|
634 | ARFLAGS = cru
|
---|
635 | RANLIB = ranlib
|
---|
636 | endif
|
---|
637 |
|
---|
638 | ifeq ($(ARCH),linuxx8664gcc)
|
---|
639 | # AMD Opteron (64 bit mode) Linux with gcc 3.x
|
---|
640 | CXX = g++
|
---|
641 | CXXFLAGS = -O -Wall -fPIC
|
---|
642 | LD = g++
|
---|
643 | LDFLAGS= -O
|
---|
644 | SOFLAGS= -shared
|
---|
645 | AR = ar
|
---|
646 | ARFLAGS = cru
|
---|
647 | RANLIB = ranlib
|
---|
648 | endif
|
---|
649 |
|
---|
650 | ifeq ($(ARCH),linuxalphaegcs)
|
---|
651 | # Alpha Linux with egcs
|
---|
652 | CXX = g++
|
---|
653 | CXXFLAGS = -O -Wall -fPIC
|
---|
654 | LD = g++
|
---|
655 | LDFLAGS= -O
|
---|
656 | SOFLAGS= -shared
|
---|
657 | AR = ar
|
---|
658 | ARFLAGS = cru
|
---|
659 | RANLIB = ranlib
|
---|
660 | endif
|
---|
661 |
|
---|
662 | ifeq ($(ARCH),linuxarm)
|
---|
663 | # ARM Linux with egcs
|
---|
664 | CXX = g++
|
---|
665 | CXXFLAGS = -O -Wall -fPIC
|
---|
666 | LD = g++
|
---|
667 | LDFLAGS= -O
|
---|
668 | SOFLAGS= -shared
|
---|
669 | AR = ar
|
---|
670 | ARFLAGS = cru
|
---|
671 | RANLIB = ranlib
|
---|
672 | endif
|
---|
673 |
|
---|
674 | ifeq ($(ARCH),mklinux)
|
---|
675 | # MkLinux with libc5
|
---|
676 | CXX = g++
|
---|
677 | CXXFLAGS = -O -Wall -fPIC
|
---|
678 | LD = g++
|
---|
679 | LDFLAGS= -O
|
---|
680 | SOFLAGS= -shared
|
---|
681 | AR = ar
|
---|
682 | ARFLAGS = cru
|
---|
683 | RANLIB = ranlib
|
---|
684 | endif
|
---|
685 |
|
---|
686 | ifeq ($(ARCH),freebsd)
|
---|
687 | # FreeBSD with libc5
|
---|
688 | CXX = g++
|
---|
689 | CXXFLAGS = -O -pipe -W -Wall -fPIC
|
---|
690 | LD = g++
|
---|
691 | LDFLAGS= -O
|
---|
692 | SOFLAGS= -shared -Wl,-x
|
---|
693 | AR = ar
|
---|
694 | ARFLAGS = cru -crv
|
---|
695 | RANLIB = ranlib
|
---|
696 | endif
|
---|
697 |
|
---|
698 | ifeq ($(ARCH),freebsd4)
|
---|
699 | # FreeBSD with glibc
|
---|
700 | CXX = g++
|
---|
701 | CXXFLAGS = -O -pipe -W -Wall -fPIC
|
---|
702 | LD = g++
|
---|
703 | LDFLAGS= -O
|
---|
704 | SOFLAGS= -shared -Wl,-x
|
---|
705 | AR = ar
|
---|
706 | ARFLAGS = cru -crv
|
---|
707 | RANLIB = ranlib
|
---|
708 | endif
|
---|
709 |
|
---|
710 | ifeq ($(ARCH),macosx)
|
---|
711 | # MacOS X with cc (GNU cc 2.95.2)
|
---|
712 | CXX = c++
|
---|
713 | CXXFLAGS = -O -pipe -Wall
|
---|
714 | LD = c++
|
---|
715 | LDFLAGS= -O -Xlinker -bind_at_load -flat_namespace
|
---|
716 | # The SOFLAGS will be used to create the .dylib; the .so will
|
---|
717 | # be created separately
|
---|
718 | DllSuf = dylib
|
---|
719 | SOFLAGS= -dynamiclib -flat_namespace -undefined suppress
|
---|
720 | AR = ar
|
---|
721 | ARFLAGS = cru -crv
|
---|
722 | RANLIB = ranlib
|
---|
723 | endif
|
---|
724 |
|
---|
725 | ifeq ($(ARCH),hiux)
|
---|
726 | # Hitachi HIUX
|
---|
727 | CXX = g++
|
---|
728 | CXXFLAGS = -O2 -fPIC
|
---|
729 | LD = g++
|
---|
730 | LDFLAGS= -Wl,+s
|
---|
731 | SOFLAGS= -Wl,-b,-E -nostdlib -nostartfiles
|
---|
732 | DllSuf = sl
|
---|
733 | endif
|
---|
734 |
|
---|
735 | ifeq ($(PLATFORM),win32)
|
---|
736 | # Windows with the VC++ compiler
|
---|
737 | ObjSuf = obj
|
---|
738 | SrcSuf = cxx
|
---|
739 | ExeSuf = .exe
|
---|
740 | DllSuf = dll
|
---|
741 | OutPutOpt = -out:
|
---|
742 | CXX = cl
|
---|
743 | CXXOPT = -O2
|
---|
744 | #CXXOPT = -Z7
|
---|
745 | CXXFLAGS = $(CXXOPT) -G5 -GR -GX -MD -DWIN32 -D_WINDOWS -nologo \
|
---|
746 | -DVISUAL_CPLUSPLUS -D_X86_=1 -D_DLL
|
---|
747 | LD = link
|
---|
748 | LDOPT = -opt:ref
|
---|
749 | #LDOPT = -debug
|
---|
750 | LDFLAGS= $(LDOPT) -pdb:none -nologo
|
---|
751 | SOFLAGS= -DLL
|
---|
752 |
|
---|
753 | ROOTLIBS := $(shell root-config --nonew --libs)
|
---|
754 | ROOTGLIBS := $(shell root-config --nonew --glibs)
|
---|
755 | EXPLLINKLIBS = $(ROOTLIBS) $(ROOTGLIBS)
|
---|
756 | endif
|
---|
757 |
|
---|
758 | ifeq ($(ARCH),win32gcc)
|
---|
759 | # Windows with gcc
|
---|
760 | DllSuf = dll
|
---|
761 | ExeSuf = .exe
|
---|
762 | CXX = g++
|
---|
763 | CXXFLAGS = -O -Wall -Woverloaded-virtual -I/usr/X11R6/include
|
---|
764 | LD = g++
|
---|
765 | LDFLAGS= -O -Wl,--enable-auto-import
|
---|
766 | SOFLAGS= -shared -D_DLL -Wl,--export-all-symbols
|
---|
767 | EXPLLINKLIBS = $(ROOTLIBS) $(ROOTGLIBS)
|
---|
768 | AR = ar
|
---|
769 | ARFLAGS = cru
|
---|
770 | RANLIB = ranlib
|
---|
771 | endif
|
---|
772 |
|
---|
773 | ifeq ($(CXX),)
|
---|
774 | $(error $(ARCH) invalid architecture)
|
---|
775 | endif
|
---|
776 |
|
---|
777 | CXXFLAGS += $(ROOTCFLAGS) -DDROP_CGAL -I. -Itcl -Imcfio -Istdhep -ICDFCones -ICDFCones/CDFcode
|
---|
778 | LIBS = $(ROOTLIBS) -lEG $(SYSLIBS)
|
---|
779 | GLIBS = $(ROOTGLIBS) $(SYSLIBS)
|
---|
780 |
|
---|
781 | ###
|
---|
782 |
|
---|
783 | STATIC = lib/libExRootAnalysisPGS.$(LibSuf)
|
---|
784 | SHARED = lib/libExRootAnalysis.$(DllSuf)
|
---|
785 |
|
---|
786 | all:
|
---|
787 |
|
---|
788 | }
|
---|
789 |
|
---|
790 | stdhepExecutableDeps
|
---|
791 |
|
---|
792 | executableDeps
|
---|
793 |
|
---|
794 | dictDeps {DICT} {src/*LinkDef.h} {modules/*LinkDef.h}
|
---|
795 |
|
---|
796 | dictDeps {PGS_DICT} {pgs/*LinkDef.h}
|
---|
797 |
|
---|
798 | sourceDeps {SOURCE} {src/*.cc} {modules/*.cc} {CDFCones/*.cc} {KtJet/*.cc} {CLHEP/src/*.cc}
|
---|
799 |
|
---|
800 | sourceDeps {PGS_SOURCE} {src/ExRootClasses.cc} {src/ExRootTreeBranch.cc} {src/ExRootTreeWriter.cc}
|
---|
801 |
|
---|
802 | sourceDeps {PGS} {pgs/*.cc}
|
---|
803 |
|
---|
804 | stdhepDeps
|
---|
805 |
|
---|
806 | tclDeps
|
---|
807 |
|
---|
808 | headerDeps
|
---|
809 |
|
---|
810 | puts {
|
---|
811 |
|
---|
812 | ###
|
---|
813 |
|
---|
814 | all: $(SHARED) $(EXECUTABLE) $(STDHEP_EXECUTABLE)
|
---|
815 |
|
---|
816 | static: $(STATIC)
|
---|
817 |
|
---|
818 | $(STATIC): $(PGS_DICT_OBJ) $(PGS_SOURCE_OBJ) $(PGS_OBJ)
|
---|
819 | @mkdir -p $(@D)
|
---|
820 | $(AR) $(ARFLAGS) $@ $^
|
---|
821 | $(RANLIB) $@
|
---|
822 |
|
---|
823 | $(SHARED): $(DICT_OBJ) $(SOURCE_OBJ) $(TCL_OBJ)
|
---|
824 | @mkdir -p $(@D)
|
---|
825 | @echo ">> Building $@"
|
---|
826 | ifeq ($(ARCH),aix)
|
---|
827 | @/usr/ibmcxx/bin/makeC++SharedLib $(OutPutOpt)$@ $(LIBS) -p 0 $^
|
---|
828 | else
|
---|
829 | ifeq ($(ARCH),aix5)
|
---|
830 | @/usr/vacpp/bin/makeC++SharedLib $(OutPutOpt)$@ $(LIBS) -p 0 $^
|
---|
831 | else
|
---|
832 | ifeq ($(ARCH),macosx)
|
---|
833 | # We need to make both the .dylib and the .so
|
---|
834 | @$(LD) $(SOFLAGS) $^ $(OutPutOpt)$@
|
---|
835 | @$(LD) -bundle -undefined suppress $(LDFLAGS) $^ $(LIBS) \
|
---|
836 | $(OutPutOpt)$(subst .$(DllSuf),.so,$@)
|
---|
837 | else
|
---|
838 | ifeq ($(PLATFORM),win32)
|
---|
839 | @bindexplib $* $^ > $*.def
|
---|
840 | @lib -nologo -MACHINE:IX86 $^ -def:$*.def \
|
---|
841 | $(OutPutOpt)$(EVENTLIB)
|
---|
842 | @$(LD) $(SOFLAGS) $(LDFLAGS) $^ $*.exp $(LIBS) \
|
---|
843 | $(OutPutOpt)$@
|
---|
844 | else
|
---|
845 | @$(LD) $(SOFLAGS) $(LDFLAGS) $^ $(OutPutOpt) $@ $(EXPLLINKLIBS)
|
---|
846 | endif
|
---|
847 | endif
|
---|
848 | endif
|
---|
849 | endif
|
---|
850 |
|
---|
851 | clean:
|
---|
852 | @rm -f $(PGS_DICT_OBJ) $(PGS_SOURCE_OBJ) $(PGS_OBJ) $(DICT_OBJ) $(SOURCE_OBJ) $(TCL_OBJ) $(STDHEP_OBJ) core
|
---|
853 |
|
---|
854 | distclean: clean
|
---|
855 | @rm -f $(SHARED) $(STATIC) $(EXECUTABLE) $(STDHEP_EXECUTABLE)
|
---|
856 |
|
---|
857 | ###
|
---|
858 |
|
---|
859 | .SUFFIXES: .$(SrcSuf) .$(ObjSuf) .$(DllSuf)
|
---|
860 |
|
---|
861 | %Dict.$(SrcSuf):
|
---|
862 | @mkdir -p $(@D)
|
---|
863 | @echo ">> Generating $@"
|
---|
864 | @rootcint -f $@ -c $<
|
---|
865 | @echo "#define private public" > $@.arch
|
---|
866 | @echo "#define protected public" >> $@.arch
|
---|
867 | @mv $@ $@.base
|
---|
868 | @cat $@.arch $< $@.base > $@
|
---|
869 | @rm $@.arch $@.base
|
---|
870 |
|
---|
871 | $(SOURCE_OBJ): tmp/%.$(ObjSuf): %.$(SrcSuf)
|
---|
872 | @mkdir -p $(@D)
|
---|
873 | @echo ">> Compiling $<"
|
---|
874 | @$(CXX) $(CXXFLAGS) -c $< $(OutPutOpt)$@
|
---|
875 |
|
---|
876 | $(PGS_OBJ): tmp/%.$(ObjSuf): %.$(SrcSuf)
|
---|
877 | @mkdir -p $(@D)
|
---|
878 | @echo ">> Compiling $<"
|
---|
879 | @$(CXX) $(CXXFLAGS) -c $< $(OutPutOpt)$@
|
---|
880 |
|
---|
881 | $(DICT_OBJ): %.$(ObjSuf): %.$(SrcSuf)
|
---|
882 | @mkdir -p $(@D)
|
---|
883 | @echo ">> Compiling $<"
|
---|
884 | @$(CXX) $(CXXFLAGS) -c $< $(OutPutOpt)$@
|
---|
885 |
|
---|
886 | $(PGS_DICT_OBJ): %.$(ObjSuf): %.$(SrcSuf)
|
---|
887 | @mkdir -p $(@D)
|
---|
888 | @echo ">> Compiling $<"
|
---|
889 | @$(CXX) $(CXXFLAGS) -c $< $(OutPutOpt)$@
|
---|
890 |
|
---|
891 | $(TCL_OBJ): tmp/%.$(ObjSuf): %.c
|
---|
892 | @mkdir -p $(@D)
|
---|
893 | @echo ">> Compiling $<"
|
---|
894 | @gcc $(CXXFLAGS) -c $< $(OutPutOpt)$@
|
---|
895 |
|
---|
896 | $(STDHEP_OBJ): tmp/%.$(ObjSuf): %.c
|
---|
897 | @mkdir -p $(@D)
|
---|
898 | @echo ">> Compiling $<"
|
---|
899 | @gcc $(CXXFLAGS) -c $< $(OutPutOpt)$@
|
---|
900 |
|
---|
901 | $(STDHEP_EXECUTABLE_OBJ): tmp/%.$(ObjSuf): %.cpp
|
---|
902 | @mkdir -p $(@D)
|
---|
903 | @echo ">> Compiling $<"
|
---|
904 | @$(CXX) $(CXXFLAGS) -c $< $(OutPutOpt)$@
|
---|
905 |
|
---|
906 | $(STDHEP_EXECUTABLE): %$(ExeSuf): $(DICT_OBJ) $(SOURCE_OBJ) $(TCL_OBJ) $(STDHEP_OBJ)
|
---|
907 | @echo ">> Building $@"
|
---|
908 | @$(LD) $(LDFLAGS) $^ $(LIBS) $(OutPutOpt)$@
|
---|
909 |
|
---|
910 | $(EXECUTABLE_OBJ): tmp/%.$(ObjSuf): %.cpp
|
---|
911 | @mkdir -p $(@D)
|
---|
912 | @echo ">> Compiling $<"
|
---|
913 | @$(CXX) $(CXXFLAGS) -c $< $(OutPutOpt)$@
|
---|
914 |
|
---|
915 | $(EXECUTABLE): %$(ExeSuf): $(DICT_OBJ) $(SOURCE_OBJ) $(TCL_OBJ)
|
---|
916 | @echo ">> Building $@"
|
---|
917 | @$(LD) $(LDFLAGS) $^ $(LIBS) $(OutPutOpt)$@
|
---|
918 |
|
---|
919 | ###
|
---|
920 |
|
---|
921 | }
|
---|