Bluegene testsuite fixes
[dyninst.git] / make.config
1 # -*- makefile -*-
2 # Paradyn overall build configuration (unix)
3 #
4 # $Id: make.config,v 1.242 2008/09/20 03:56:08 jaw Exp $
5 #
6
7 SUITE_NAME      = Paradyn
8 RELEASE_NUM     = 6.0
9
10 #BUILD_MARK     =
11 EXPLICIT_DEPENDS = 1
12 #USE_DEPRECATED_BPATCH_VECTOR   = 1
13 #IBM_BPATCH_COMPAT = 1
14 # Apart from actual "full" releases, don't modify these build Id components.
15 # For personal/experimental builds, feel free to use your 
16 # dyninst/make.config.local file to (re-)define BUILD_MARK as you desire.
17
18 # most "main" modules are only two levels deep, but we need to be able to
19 # change this for those that are deeper in the tree
20 ifndef TO_CORE
21 TO_CORE         = ../..
22 endif
23 TO_CORE_ABS = $(shell pwd)/$(TO_CORE)
24 ifndef TO_SCRIPTS
25 TO_SCRIPTS = $(TO_CORE)/../scripts
26 endif
27
28 # If the PLATFORM environment variable isn't set, we'll try to figure it out.
29 ifndef PLATFORM
30 SNAME = $(shell if [ -f ${TO_SCRIPTS}/sysname ]; then echo ${TO_SCRIPTS}/sysname; else pwd; fi )
31 ifdef SNAME
32 CURPLAT = $(shell ${SNAME})
33
34 # IA64/Linux, i386/Linux, x86-64/Linux, ppc/Linux
35 ifneq (,$(findstring linux,$(CURPLAT)))
36
37 ifneq (,$(findstring i686,$(CURPLAT)))
38 PLATFORM = i386-unknown-linux2.4
39 endif
40 ifneq (,$(findstring i586,$(CURPLAT)))
41 PLATFORM = i386-unknown-linux2.4
42 endif
43 ifneq (,$(findstring i486,$(CURPLAT)))
44 PLATFORM = i386-unknown-linux2.4
45 endif
46 ifneq (,$(findstring i386,$(CURPLAT)))
47 PLATFORM = i386-unknown-linux2.4
48 endif
49 ifneq (,$(findstring x86_64,$(CURPLAT)))
50 PLATFORM = x86_64-unknown-linux2.4
51 endif
52 ifneq (,$(findstring, ppc64,$(CURPLAT)))
53 PLATFORM = ppc64_linux
54 endif
55
56 endif
57
58 # AIX
59 ifneq (,$(findstring aix,$(CURPLAT)))
60 PLATFORM = rs6000-ibm-aix5.1
61 endif
62 # Solaris
63 ifneq (,$(findstring solaris,$(CURPLAT)))
64 PLATFORM = sparc-sun-solaris2.8
65 endif
66
67 endif
68 endif
69
70 ifndef PLATFORM
71 $(error Could not determine you current platform.  Please set your PLATFORM environment variable to whichever closest matches your platform:  i386-unknown-linux2.4 i386-unknown-nt4.0 x86_64-unknown-linux2.4 ppc32_bgp ppc32_bgp ppc32_linux ppc64_linux rs6000-ibm-aix5.1 rs6000-ibm-aix64-5.2 ppc32_bgl_ion ppc32_bgl_compute ppc32_bgp_ion ppc32_bgp_compute x86_64_catamount x86_64_cnl i386-unknown-freebsd7.2 amd64-unknown-freebsd7.2 ppc32-unknown-vxworks6.x)
72 endif
73
74 # ***** EXTERNAL SOFTWARE CONFIGURATION *****
75
76 # Include any per-user configuration changes; this "local" config file
77 # should *not* be under CVS control, so that it never gets committed.
78 include $(TO_CORE)/make.config.local
79
80 # Choose default development directories if necessary variables are unset
81
82
83
84 # Destinations for library and executable installation (relative to "dyninst"!)
85 # Warning: modification of the build/install structure is not recommended!
86 LIBRARY_DEST    ?= ${TO_CORE_ABS}/../${PLATFORM}/lib
87 PROGRAM_DEST    ?= ${TO_CORE_ABS}/../${PLATFORM}/bin
88 INCLUDE_DEST   ?= ${TO_CORE_ABS}/../include
89
90 # Usually, we look for files, binaries, libs in $(TO_CORE)/....<something>.
91 # But if the file doesn't exist there (i.e. if the user hasn't checked them out
92 # with cvs), then we should look in a backup location.  That's what this vrble
93 # is about.  It's used several times below in this file.
94 ifeq ($(PLATFORM),ppc32_bgl_compute)
95 GCC         = powerpc-bgp-linux-gcc
96 GXX         = powerpc-bgp-linux-g++
97 CC          = powerpc-bgp-linux-gcc
98 CXX         = powerpc-bgp-linux-g++
99 endif
100 ifeq ($(PLATFORM),ppc32_bgp_compute)
101 GCC         = powerpc-bgp-linux-gcc
102 GXX         = powerpc-bgp-linux-g++
103 CC          = powerpc-bgp-linux-gcc
104 CXX         = powerpc-bgp-linux-g++
105 endif
106
107 GCC      ?= gcc
108 GXX      ?= g++
109 LINKER   = ld
110 AS              = as
111 CC       ?= $(GCC)
112 CXX      ?= $(GXX)
113 LEX      = flex
114 RANLIB   = ranlib
115 AR       = ar
116 YFLAGS   = -d -y
117 YACC     = bison
118 MV       = mv
119 CP       = cp
120 RM       = rm -f
121 LN       = ln -s
122 MKDIR           = mkdir -p
123 CHMOD    = chmod
124 PERL            = perl          # NB: perl v5 or higher required!
125
126 # COLLECTOR is only used by purify & quantify
127 COLLECTOR       = /s/gcc-2.7.2/bin/../lib/gcc-lib/$(PLATFORM)/2.7.2/ld
128 # BUILDSTAMP is used to generate local build vouchers
129 BUILDSTAMP      = $(TO_CORE)/../scripts/buildstamp
130
131 ifndef PLATFORM
132 BUILDERROR: PLATFORM must be defined in environment to build (and run) Paradyn
133 endif
134
135 # Define all tags based on the platform string. When a new platform
136 # is added, add it to the list
137
138 #
139 # Brief description of -Ds:
140 #
141 # CAP
142 # cap_save_the_world: support for creating a patched binary
143 # cap_relocation: function relocation
144 # cap_stripped_binaries: recursive parsing and function discovery without symbols
145 # cap_async_events: 
146 # cap_ptrace: uses ptrace interface
147 # cap_proc: uses /proc interface
148 # cap_proc_ioctl: uses ioctl interface to proc
149 # cap_proc_fd: uses solaris-style multiple-fd proc interface
150 # cap_threads: support for threaded applications
151 # cap_dynamic_heap: support for a dynamically growing inferior heap
152 # cap_threaded_times: (Linux only) times() returns per-thread information.
153 # cap_syscall_trap: The ability (or necessity) to place a trap instruction at the instruction following a system call.
154 # cap_slicing: (i386-unknown-linux2.4 and 2.6, sparc-sun-solaris2.8 and 2.9) Intraprocedural slicing feature
155 # cap_32_64: platforms that support 32- and 64-bit mutatees
156 # cap_liveness: liveness analysis
157 # cap_fixpoint_gen: Generate code using a fixpoint method that saves space
158 # cap_noaddr_gen: Allow code generation before determining the address code is going into
159 # cap_mutatee_traps: Traps can be handled mutatee side
160 # cap_instruction_api: System uses instruction API
161 # cap_registers: User can access registers in snippets
162 # cap_instruction_replacement: we use the replaceCode concept to implement (e.g.,) function call replacement
163 # cap_tramp_liveness: we can run liveness over our trampolines to determine what's used
164 #
165 # BUG
166 # bug_aix_broken_fork: AIX child process does not stop on fork if requested.
167 # bug_syscall_changepc_rewind: Linux rewinds the PC by <addr width> if
168 #   the change occurs within a system call; reported by SGI.
169 # bug_freebsd_missing_sigstop: A stop followed by a continue and a new SIGSTOP 
170 #   results in the new SIGSTOP event never being returned from waitpid
171 # bug_freebsd_mt_suspend: threads do not suspend after an attach
172 # bug_freebsd_change_pc: when changing the PC for a thread, the OS may not
173 #   schedule the thread if it is blocked in the kernel.
174 # bug_phdrs_first_page: the OS requires that the program headers for a ELF
175 #   binary must reside in the first page of the binary on disk
176
177 ifeq ($(PLATFORM),i386-unknown-linux2.4)
178 OLD_DEF     = -Di386_unknown_linux2_0
179 ARCH_DEF    = -Darch_x86
180 OS_DEF      = -Dos_linux
181 CAP_DEF     = -Dcap_ptrace -Dcap_relocation -Dcap_stripped_binaries -Dcap_async_events -Dcap_threads -Dcap_dynamic_heap -Dcap_dwarf -Dcap_liveness -Dcap_fixpoint_gen -Dcap_noaddr_gen -Dcap_mutatee_traps -Dcap_instruction_api -Dcap_serialization -Dcap_binary_rewriter -Dcap_virtual_registers -Dcap_cache_func_starts -Dcap_instruction_replacement -Dcap_tramp_liveness
182 BUG_DEF     = -Dbug_syscall_changepc_rewind
183 endif
184
185 ifeq ($(PLATFORM),i386-unknown-linux2.6)
186 OLD_DEF     = -Di386_unknown_linux2_0
187 ARCH_DEF    = -Darch_x86
188 OS_DEF      = -Dos_linux
189 CAP_DEF     = -Dcap_ptrace -Dcap_relocation -Dcap_stripped_binaries -Dcap_async_events -Dcap_threads -Dcap_dynamic_heap -Dcap_dwarf -Dcap_liveness -Dcap_fixpoint_gen -Dcap_noaddr_gen -Dcap_mutatee_traps -Dcap_instruction_api -Dcap_serialization -Dcap_binary_rewriter -Dcap_virtual_registers -Dcap_instruction_replacement -Dcap_tramp_liveness
190 BUG_DEF     = -Dbug_syscall_changepc_rewind
191 endif
192
193 ifeq ($(PLATFORM),x86_64-unknown-linux2.4)
194 OLD_DEF     = -Dx86_64_unknown_linux2_4
195 ARCH_DEF    = -Darch_x86_64 -Darch_64bit
196 OS_DEF      = -Dos_linux
197 CAP_DEF     = -Dcap_ptrace -Dcap_stripped_binaries -Dcap_async_events -Dcap_threads -Dcap_dynamic_heap -Dcap_relocation -Dcap_dwarf -Dcap_32_64 -Dcap_liveness -Dcap_fixpoint_gen -Dcap_noaddr_gen -Dcap_mutatee_traps -Dcap_binary_rewriter -Dcap_registers -Dcap_instruction_api -Dcap_serialization -Dcap_instruction_replacement -Dcap_tramp_liveness
198 BUG_DEF     = -Dbug_syscall_changepc_rewind
199 endif
200
201 ifeq ($(PLATFORM),sparc-sun-solaris2.8)
202 OLD_DEF     = -Dsparc_sun_solaris2_4
203 ARCH_DEF    = -Darch_sparc
204 OS_DEF      = -Dos_solaris
205 CAP_DEF     = -Dcap_proc -Dcap_proc_fd -Dcap_async_events -Dcap_dynamic_heap -Dcap_threads -Dcap_relocation -Dcap_dwarf \
206 -Dcap_syscall_trap -Dcap_serialization
207 BUG_DEF     =
208 endif
209
210 ifeq ($(PLATFORM),sparc-sun-solaris2.9)
211 OLD_DEF     = -Dsparc_sun_solaris2_4
212 ARCH_DEF    = -Darch_sparc
213 OS_DEF      = -Dos_solaris
214 CAP_DEF     = -Dcap_proc -Dcap_proc_fd -Dcap_async_events -Dcap_dynamic_heap -Dcap_threads -Dcap_relocation -Dcap_dwarf \
215 -Dcap_syscall_trap -Dcap_serialization
216 BUG_DEF     =
217 endif
218
219 ifeq ($(PLATFORM),rs6000-ibm-aix5.1)
220 OLD_DEF     = -Drs6000_ibm_aix5_1 -Drs6000_ibm_aix4_1
221 ARCH_DEF    = -Darch_power
222 OS_DEF      = -Dos_aix
223 CAP_DEF     = -Dcap_proc -Dcap_proc_fd -Dcap_async_events -Dcap_relocation -Dcap_threads -Dcap_dynamic_heap -Dcap_syscall_trap \
224 -Dcap_liveness -Dcap_use_pdvector -Dcap_serialization -Dcap_registers -Dcap_instruction_replacement -Dcap_instruction_api \
225 -Dcap_stackwalker_use_symtab
226 BUG_DEF     =
227 endif
228
229 ifeq ($(PLATFORM),rs6000-ibm-aix64-5.2)
230 OLD_DEF     = -Drs6000_ibm_aix5_1 -Drs6000_ibm_aix4_1
231 ARCH_DEF    = -Darch_power -Darch_64bit
232 OS_DEF      = -Dos_aix
233 CAP_DEF     = -Dcap_proc -Dcap_proc_fd -Dcap_async_events -Dcap_relocation -Dcap_threads -Dcap_dynamic_heap -Dcap_syscall_trap \
234 -Dcap_liveness -Dcap_use_pdvector -Dcap_serialization -Dcap_registers -Dcap_instruction_replacement \
235 -Dcap_instruction_api -Dcap_32_64
236 BUG_DEF     = 
237 endif
238
239 ifeq ($(PLATFORM),ppc64_linux)
240 OLD_DEF     = -Dppc64_linux
241 ARCH_DEF    = -Darch_power -Darch_64bit
242 OS_DEF      = -Dos_linux
243 CAP_DEF     = -Dcap_ptrace -Dcap_relocation -Dcap_async_events -Dcap_threads -Dcap_dynamic_heap -Dcap_dwarf -Dcap_liveness \
244 -Dcap_32_64 -Dcap_serialization -Dcap_registers -Dcap_instruction_replacement -Dcap_binary_rewriter -Dcap_instruction_api
245 BUG_DEF     = -Dbug_syscall_changepc_rewind
246 endif
247
248 ifeq ($(PLATFORM),ppc32_linux)
249 OLD_DEF     = -Dppc32_linux
250 ARCH_DEF    = -Darch_power
251 OS_DEF      = -Dos_linux
252 CAP_DEF     = -Dcap_ptrace -Dcap_mutatee_traps -Dcap_relocation -Dcap_async_events -Dcap_threads -Dcap_dynamic_heap -Dcap_dwarf -Dcap_liveness \
253 -Dcap_serialization -Dcap_registers -Dcap_instruction_replacement -Dcap_instruction_api \
254 -Dcap_binary_rewriter
255 BUG_DEF     = -Dbug_syscall_changepc_rewind
256 endif
257
258 ifeq ($(PLATFORM),ppc32_bgp)
259 OLD_DEF     = -Dppc32_linux
260 ARCH_DEF    = -Darch_power
261 OS_DEF      = -Dos_linux
262 CAP_DEF     = -Dcap_ptrace -Dcap_mutatee_traps -Dcap_relocation -Dcap_async_events -Dcap_threads -Dcap_dynamic_heap -Dcap_dwarf -Dcap_liveness \
263 -Dcap_serialization -Dcap_registers -Dcap_instruction_replacement -Dcap_instruction_api \
264 -Dcap_binary_rewriter
265 BUG_DEF     = -Dbug_syscall_changepc_rewind
266 endif
267
268
269 ifeq ($(PLATFORM),ppc32_bgl_ion)
270 OLD_DEF     = -Dppc32_bluegene
271 ARCH_DEF    = -Darch_power
272 OS_DEF      = -Dos_bg -Dos_bgl -Dos_bg_ion
273 CAP_DEF     = -Dcap_dwarf
274 BUG_DEF     = 
275 endif
276
277 ifeq ($(PLATFORM),ppc32_bgl_compute)
278 OLD_DEF     = -Dppc32_bluegene
279 ARCH_DEF    = -Darch_powerO
280 OS_DEF      = -Dos_bg -Dos_bgl -Dos_bg_compute
281 CAP_DEF     = -Dcap_dwarf
282 BUG_DEF     = 
283 endif
284
285 ifeq ($(PLATFORM),ppc32_bgp_ion)
286 OLD_DEF     = -Dppc32_bluegene
287 ARCH_DEF    = -Darch_power
288 OS_DEF      = -Dos_bg -Dos_bgp -Dos_bg_ion
289 CAP_DEF     = -Dcap_dwarf
290 BUG_DEF     = 
291 endif
292
293 ifeq ($(PLATFORM),ppc32_bgp_compute)
294 OLD_DEF     = -Dppc32_bluegene
295 ARCH_DEF    = -Darch_power
296 OS_DEF      = -Dos_bg -Dos_bgp -Dos_bg_compute
297 CAP_DEF     = -Dcap_dwarf
298 BUG_DEF     = 
299 endif
300
301 ifeq ($(PLATFORM),x86_64_catamount)
302 OLD_DEF     = -Dx86_64_catamount
303 ARCH_DEF    = -Darch_x86_64 -Darch_64bit
304 OS_DEF      = -Dos_catamount
305 CAP_DEF     = -Dcap_dwarf
306 BUG_DEF     = 
307 endif
308 ifeq ($(PLATFORM),x86_64_cnl)
309 OLD_DEF     = -Dx86_64_cnl
310 ARCH_DEF    = -Darch_x86_64 -Darch_64bit
311 OS_DEF      = -Dos_linux -Dos_cnl
312 CAP_DEF     = -Dcap_ptrace -Dcap_stripped_binaries -Dcap_async_events -Dcap_threads -Dcap_dynamic_heap -Dcap_relocation \
313 -Dcap_dwarf -Dcap_32_64 -Dcap_liveness -Dcap_fixpoint_gen -Dcap_noaddr_gen -Dcap_mutatee_traps \
314 -Dcap_instruction_api
315 BUG_DEF     = -Dbug_syscall_changepc_rewind
316 endif
317 #
318
319 ifeq ($(PLATFORM),ppc32-unknown-vxworks6.x)
320 OLD_DEF     = -Dppc32_vxworks
321 ARCH_DEF    = -Darch_power -Dtarget_ppc32 -Dtarget_smallmem -Dendian_mismatch
322 OS_DEF      = -Dos_vxworks
323 CAP_DEF     = -Dcap_relocation -Dcap_async_events -Dcap_threads -Dcap_dynamic_heap -Dcap_dwarf -Dcap_slicing -Dcap_liveness -Dcap_fixpoint_gen -Dcap_noaddr_gen -Dno_cap_serialization -Dcap_virtual_registers -Dcap_stackwalker_use_symtab -Dcap_cache_func_starts -Dcap_instruction_replacement -Dcap_instruction_api
324 #CAP_DEF     = -Dcap_mutatee_traps -Dcap_binary_rewriter -Dcap_stripped_binaries
325 BUG_DEF     =
326 endif
327
328 ifeq ($(PLATFORM),i386-unknown-freebsd7.2)
329 OLD_DEF     = -Di386_unknown_freebsd7_0
330 ARCH_DEF    = -Darch_x86
331 OS_DEF      = -Dos_freebsd
332 CAP_DEF     = -Dcap_instruction_api -Dcap_noaddr_gen -Dcap_dwarf -Dcap_binary_rewriter -Dcap_liveness -Dcap_fixpoint_gen -Dcap_registers -Dcap_instruction_replacement -Dcap_tramp_liveness -Dcap_relocation -Dcap_virtual_registers -Dcap_stripped_binaries
333 BUG_DEF     = -Dbug_freebsd_missing_sigstop -Dbug_freebsd_mt_suspend -Dbug_freebsd_change_pc -Dbug_phdrs_first_page
334 endif
335
336 ifeq ($(PLATFORM),amd64-unknown-freebsd7.2)
337 OLD_DEF     = -Damd64_unknown_freebsd7_0
338 ARCH_DEF    = -Darch_x86_64 -Darch_64bit
339 OS_DEF      = -Dos_freebsd
340 CAP_DEF     = -Dcap_instruction_api -Dcap_noaddr_gen -Dcap_dwarf -Dcap_binary_rewriter -Dcap_liveness -Dcap_fixpoint_gen -Dcap_registers -Dcap_instruction_replacement -Dcap_tramp_liveness -Dcap_relocation -Dcap_virtual_registers -Dcap_stripped_binaries -Dcap_32_64
341 BUG_DEF     = -Dbug_freebsd_missing_sigstop -Dbug_freebsd_mt_suspend -Dbug_freebsd_change_pc -Dbug_phdrs_first_page
342 endif
343
344
345 # Combine all the #defines for ease of use
346 UNIFIED_DEF     = $(ARCH_DEF) $(OS_DEF) $(VER_DEF) $(CAP_DEF) $(BUG_DEF) $(OLD_DEF) $(AC_DEF)
347 UNIFIED_TEST_DEF        = $(ARCH_DEF) $(OS_DEF) $(VER_DEF) $(CAP_DEF) $(BUG_DEF) $(OLD_DEF)
348
349 #ifeq (solaris,$(findstring solaris,$(PLATFORM)))
350 ifeq (solaris,$(findstring solaris,$(OS_DEF)))
351 #AS             = /usr/ccs/bin/as
352 RANLIB          = true
353 endif
354
355 ifeq (linux,$(findstring linux,$(OS_DEF)))
356 AS              = /usr/bin/as
357 RANLIB          = true 
358 ASFLAGS         =
359 else
360 ASFLAGS         = -P $(UNIFIED_DEF) 
361 endif 
362
363 # set the macros that control whether the stdint limit and constant
364 # macros are defined for C++ on the compilers command line so that
365 # we don't have to worry about the ordering of #includes.
366 ifeq (linux,$(findstring linux,$(PLATFORM)))
367 STDINT_MACROS   = -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS
368 else
369 ifeq (freebsd,$(findstring freebsd,$(PLATFORM)))
370 STDINT_MACROS   = -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS
371 else
372 ifeq (bluegene,$(findstring bluegene,$(PLATFORM)))
373 STDINT_MACROS   = -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS
374 else
375 ifeq (bgp,$(findstring bgp,$(PLATFORM)))
376 STDINT_MACROS   = -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS
377 else
378 STDINT_MACROS   = 
379 endif
380 endif
381 endif
382 endif
383
384 # Default module compiler; modules which want $(CC) should redefine
385 # this, **NOT** CC
386
387 MODCC           = $(CXX)
388 MODCFLAGS       = $(CXXFLAGS)
389 DEPCC       = $(MODCC)
390
391 .SUFFIXES:      .I
392
393 # Added dyninst/external for included external dependencies - bernat, 11JUN07
394 IFLAGS          = $(FIRST_INCLUDE) -I../h -I. -I$(TO_CORE) -I$(TO_CORE)/dynutil/h -I$(TO_CORE)/external
395
396 # uncomment/comment the line below to build with/without compilation warnings
397 # SILENCE_WARNINGS=true
398
399 ifndef SILENCE_WARNINGS
400 BASICWARNINGS   = -W -Wall
401
402 COMMONWARNINGS  = -W -Wall -Wshadow -Wpointer-arith       \
403                 -Wcast-qual            \
404                 -Wredundant-decls -Woverloaded-virtual
405
406 # not as strict as above, but can actually be used -- mdc
407 USEFULWARNINGS  = -W -Wall -Wpointer-arith       \
408                 -Wcast-qual            \
409                 -Woverloaded-virtual
410
411 # being nice to poor old pathetic tcl/tk header files --ari
412 TCLFRIENDLYWARNINGS = -W -Wall -Wpointer-arith \
413                 -Wcast-qual \
414                 -Woverloaded-virtual
415
416 ifeq (solaris,$(findstring solaris,$(PLATFORM)))
417 COMMONWARNINGS       += -Wno-unknown-pragmas
418 USEFULWARNINGS       += -Wno-unknown-pragmas
419 TCLFRIENDLYWARNINGS  += -Wno-unknown-pragmas
420 else   # STL on Solaris with cast-align generates a warning with much output
421 COMMONWARNINGS       += -Wcast-align
422 USEFULWARNINGS       += -Wcast-align
423 endif
424 endif # SILENCE_WARNINGS
425
426
427 ifndef GCC_2_95
428 GCC_VER := $(shell gcc --version)
429 ifneq (,$(findstring 2.95,$(GCC_VER)))
430 GCC_2_95 = true
431 endif
432 endif
433
434 ifndef OLD_GCC
435 GCC_VER := $(shell gcc --version | head -n 1 | perl -ane 'print pop(@F)')
436 versionNumbers = $(sort $(GCC_VER) 2.95)
437 versionNumber  = $(firstword $(versionNumbers))
438 ifneq (2.95, $(versionNumber))
439 OLD_GCC = true
440 endif
441 endif
442
443 ifndef OLD_GCC
444 COMMONWARNINGS += -Wno-non-template-friend
445 USEFULWARNINGS += -Wno-non-template-friend
446 TCLFRIENDLYWARNINGS += -Wno-non-template-friend
447 endif
448
449 #don't inline -- for the files that won't emit template code
450 INLINE_DEFINES = 
451
452 #inline the private members of the class -- templates.o can use this
453 TEMP_INLINE_DEFINES = -DDO_INLINE_P="inline"
454
455 # inline everything -- the way things should be
456 ALL_INLINE_DEFINES = -DDO_INLINE_F="inline" -DDO_INLINE_P="inline"
457
458
459 ifeq (solaris,$(findstring solaris,$(PLATFORM)))
460 USES_LIBDYNINST_SO = true
461 endif
462 ifeq (linux,$(findstring linux,$(PLATFORM)))
463 USES_LIBDYNINST_SO = true
464 endif
465
466 # Set this variable if it's desired that dyninst be built with the native
467 # compiler on Solaris
468 SOLARIS_NATIVE =  #1
469
470 ifdef SOLARIS_NATIVE
471 ifeq (solaris,$(findstring solaris,$(PLATFORM)))
472 USES_LIBDYNINST_SO = true
473 USES_NATIVE_CC = true
474 NATIVE_CC      = cc
475 NATIVE_CXX     = CC
476 endif
477 endif
478
479 ifeq (ibm-aix,$(findstring ibm-aix,$(PLATFORM)))
480 ifndef IBM_BPATCH_COMPAT
481   USES_LIBDYNINST_SO = true
482 endif
483
484 USES_PERF_LIBRARY = true
485 # No longer used, because of relocation.
486 #USES_LIB_TEXT_HEAP = true
487
488 ifdef IBM_BPATCH_COMPAT
489   ifeq (ibm-aix, $(findstring ibm-aix, $(PLATFORM)))
490     USES_NATIVE_CC = true
491     NATIVE_CC = xlc
492     NATIVE_CXX = xlC
493     DEPCC = xlC
494     DEPENDFLAGS = -M -E -qhalt=E -qro -qtbtable=full -DCOMPILER="xlC"
495   endif
496 endif
497
498 # As of AIX 5, the pm_init function in libpmapi takes more
499 # parameters. This is keyed by the USES_PMAPI_GROUPS define,
500 # and handled in the paradyn runtime library
501 PMAPI_VERSION := $(shell uname -v )
502 ifeq (5, $(findstring 5,$(PMAPI_VERSION)))
503 USES_PMAPI_GROUPS = true
504 endif
505 endif
506
507 # if we don't want OPT_FLAG defined for a particular part of the code
508 # (e.g. rtinst for aix), we just need to define NO_OPT_FLAG before doing
509 # the include of make.config - naim
510 ifndef NO_OPT_FLAG
511 OPT_FLAG        = -O2
512 endif
513
514 # Do we shorten compile lines?
515 ifndef VERBOSE_COMPILATION
516 HIDE_COMP       = @
517 endif
518
519 ifeq (ibm-aix64-, $(findstring ibm-aix64-, $(PLATFORM)))
520     ARCH_FLAGS   = -maix64 -Drs6000_ibm_aix64
521 endif
522
523 ifeq (ppc64_linux, $(findstring ppc64_linux, $(PLATFORM)))
524     ARCH_FLAGS = -m64
525 endif
526
527 # flags for normal (non-kludge) files, with common warnings
528 CFLAGS          = $(IFLAGS) $(UNIFIED_DEF) $(OPT_FLAG) $(COMMON_WARNINGS) $(ARCH_FLAGS)
529 CXXFLAGS        = $(IFLAGS) $(UNIFIED_DEF) $(OPT_FLAG) $(COMMON_WARNINGS) $(STDINT_MACROS) $(ARCH_FLAGS)
530 LDFLAGS         = $(ARCH_FLAGS)
531
532 # flags for kludge files, won't have warnings generated
533 KFLAGS          = $(IFLAGS) $(UNIFIED_DEF) $(BASICWARNINGS)
534
535 ifdef COVERAGE
536
537 CFLAGS += -fprofile-arcs -ftest-coverage
538 CXXFLAGS += -fprofile-arcs -ftest-coverage
539 LDFLAGS += -fprofile-arcs -ftest-coverage
540
541 endif
542
543 ifdef USING_PURIFY
544 CFLAGS          += -DPURE_BUILD
545 CXXFLAGS        += -DPURE_BUILD
546 endif
547
548 ifdef USES_PERF_LIBRARY
549 # Add any platform-specific performance libraries here
550 ifeq (ibm-aix,$(findstring ibm-aix,$(PLATFORM)))
551 USES_PMAPI = true
552 CFLAGS          += -DUSES_PMAPI
553 CXXFLAGS        += -DUSES_PMAPI
554 LDFLAGS         += -lpmapi
555 ifdef USES_PMAPI_GROUPS
556 CFLAGS          += -DPMAPI_GROUPS
557 CXXFLAGS        += -DPMAPI_GROUPS
558 endif # USES_PMAPI_GROUPS
559 endif # ibm-aix
560 endif # perf_library
561
562 ifdef USE_DEPRECATED_BPATCH_VECTOR
563 CXXFLAGS        += -DUSE_DEPRECATED_BPATCH_VECTOR
564 CFLAGS          += -DUSE_DEPRECATED_BPATCH_VECTOR
565 TFLAGS          += -DUSE_DEPRECATED_BPATCH_VECTOR
566 else
567 #CFLAGS        += -fimplicit-templates
568 CXXFLAGS        += -fimplicit-templates
569 TFLAGS        += -fimplicit-templates
570 endif
571
572 ifdef IBM_BPATCH_COMPAT
573 CXXFLAGS        += -DIBM_BPATCH_COMPAT
574 CFLAGS          += -DIBM_BPATCH_COMPAT
575 endif
576
577 ifndef OPT_FLAG
578 KFLAGS          += -g
579 DEBUG_FLAG = -g
580 endif
581
582 ifeq ($(DEBUG_FLAG),none)
583 DEBUG_FLAG =
584 endif
585
586 ifdef DEBUG_FLAG
587 CFLAGS   += $(DEBUG_FLAG)
588 CXXFLAGS += $(DEBUG_FLAG)
589 KFLAGS   += $(DEBUG_FLAG)
590 endif
591
592 ifdef VERBOSE_CFG_ACCOUNTING
593 CFLAGS   += -DVERBOSE_CFG_FACTORY
594 CXXFLAGS += -DVERBOSE_CFG_FACTORY
595 endif
596
597 # flags for template files, don't define external template flags
598 # -g is optional in this case -- should be defined at module level
599 TFLAGS          = $(IFLAGS) $(TEMP_INLINE_DEFINES) $(UNIFIED_DEF) $(OPT_FLAG) $(BASICWARNINGS) $(STDINT_MACROS) $(ARCH_FLAGS)
600
601 ifdef DO_INLINE_ALL
602 CFLAGS         += $(ALL_INLINE_DEFINES)
603 CXXFLAGS       += $(ALL_INLINE_DEFINES)
604 endif
605
606 # Start off LIBDIR to point to the user's devel area's paradyn lib directory.
607 # As a backup, in case the user hasn't checked out & compiled some paradyn lib,
608 LIBDIR          = $(FIRST_LIBDIR) \
609                  -L$(TO_CORE)/../$(PLATFORM)/lib 
610
611 # Set IGEN to point to $(TO_CORE)/../bin/$(PLATFORM)/igen, if it exists,
612 # else set it to just "igen" (i.e. assume it's in the user's path)
613 ifdef CROSSCOMPILER
614 IGEN = $(shell if [ -f ${TO_CORE}/../${BASEPLATFORM}/bin/igen ]; then echo ${TO_CORE}/../${BASEPLATFORM}/bin/igen; else if [ -f ${TO_CORE}/igen/${BASEPLATFORM}/igen ]; then echo ${TO_CORE}/igen/${BASEPLATFORM}/igen; else echo igen; fi; fi )
615 else
616 IGEN = $(shell if [ -f ${TO_CORE}/${PROGRAM_DEST}/igen ]; then echo ${TO_CORE}/${PROGRAM_DEST}/igen; else if [ -f ${TO_CORE}/igen/$(PLATFORM)/igen ]; then echo ${TO_CORE}/igen/${PLATFORM}/igen; else echo igen; fi; fi )
617 endif
618
619 ifdef NO_IMPLICIT_TEMPLATES
620 ifdef USE_DEPRECATED_BPATCH_VECTOR
621 #  CFLAGS               += -fno-implicit-templates
622   CXXFLAGS      += -fno-implicit-templates
623   KFLAGS                += -fno-implicit-templates
624 endif
625 endif
626
627 ifndef INSTANTIATE_TEMPLATES
628 ifndef NO_IMPLICIT_TEMPLATES
629 # -fexternal-templates and -Dexternal_templates should both be used or
630 # neither should be used; add them to CFLAGS, CXXFLAGS, and KFLAGS
631 # (but not to TFLAGS).
632 #
633 #CFLAGS         +=  -fexternal-templates -Dexternal_templates
634 #CXXFLAGS       +=  -fexternal-templates -Dexternal_templates
635 #KFLAGS         +=  -fexternal-templates -Dexternal_templates
636 endif
637 endif
638
639 THREADSLIB      =
640 USE_PTHREADS    = yes
641
642 ifeq (xyes,x$(USE_PTHREADS))
643 THREADSLIB      += -lpthread
644
645 # On Linux, programs using pthreads are supposed to define _REENTRANT
646 ifeq (linux,$(findstring linux,$(PLATFORM)))
647 CFLAGS                  += -D_REENTRANT=1
648 CXXFLAGS                += -D_REENTRANT=1
649 KFLAGS                  += -D_REENTRANT=1
650 TFLAGS                  += -D_REENTRANT=1
651 endif
652
653 # Ditto for FreeBSD
654 ifeq (freebsd,$(findstring freebsd,$(PLATFORM)))
655 CFLAGS                  += -D_REENTRANT=1
656 CXXFLAGS                += -D_REENTRANT=1
657 KFLAGS                  += -D_REENTRANT=1
658 TFLAGS                  += -D_REENTRANT=1
659 endif
660
661 ifeq (ibm-aix,$(findstring ibm-aix,$(PLATFORM)))
662 #CFLAGS                 += -D_REENTRANT=1 -D_THREAD_SAFE=1 -D_THREAD_SAFE_ERRNO=1
663 #CXXFLAGS               += -D_REENTRANT=1 -D_THREAD_SAFE=1 -D_THREAD_SAFE_ERRNO=1
664 #KFLAGS                 += -D_REENTRANT=1 -D_THREAD_SAFE=1 -D_THREAD_SAFE_ERRNO=1
665 #TFLAGS                 += -D_REENTRANT=1 -D_THREAD_SAFE=1 -D_THREAD_SAFE_ERRNO=1
666 endif
667
668 ifeq (solaris,$(findstring solaris,$(PLATFORM)))
669 CFLAGS                  += -D_REENTRANT=1 -D_THREAD_SAFE=1 -D_THREAD_SAFE_ERRNO=1
670 CXXFLAGS                += -D_REENTRANT=1 -D_THREAD_SAFE=1 -D_THREAD_SAFE_ERRNO=1
671 KFLAGS                  += -D_REENTRANT=1 -D_THREAD_SAFE=1 -D_THREAD_SAFE_ERRNO=1
672 TFLAGS                  += -D_REENTRANT=1 -D_THREAD_SAFE=1 -D_THREAD_SAFE_ERRNO=1
673 endif
674
675 endif
676
677 # System build constraints
678 #Build the MT daemon on AIX, Solaris, and Linux/x86
679 DONT_BUILD_PD_MT = true
680 ifeq (ibm-aix,$(findstring ibm-aix,$(PLATFORM)))
681 DONT_BUILD_PD_MT =
682 endif
683 ifeq (sparc-sun-solaris,$(findstring sparc-sun-solaris,$(PLATFORM)))
684 DONT_BUILD_PD_MT =
685 endif
686 ifeq (i386-unknown-linux2.4,$(findstring i386-unknown-linux2.4,$(PLATFORM)))
687 DONT_BUILD_PD_MT =
688 endif
689
690 # Build newtestsuite on i386, x86_64 and ia64 linux
691 #DONT_BUILD_NEWTESTSUITE = true
692 #ifeq (i386-unknown-linux,$(findstring i386-unknown-linux,$(PLATFORM)))
693 #DONT_BUILD_NEWTESTSUITE = false
694 #endif
695 #ifeq (ia64-unknown-linux,$(findstring ia64-unknown-linux,$(PLATFORM)))
696 #DONT_BUILD_NEWTESTSUITE = false
697 #endif
698 #ifeq (x86_64-unknown-linux,$(findstring x86_64-unknown-linux,$(PLATFORM)))
699 #DONT_BUILD_NEWTESTSUITE = false
700 #endif
701 #ifeq (ppc32_linux,$(findstring ppc32_linux,$(PLATFORM)))
702 #DONT_BUILD_NEWTESTSUITE = false
703 #endif
704 #ifeq (sparc-sun-solaris,$(findstring sparc-sun-solaris,$(PLATFORM)))
705 #DONT_BUILD_NEWTESTSUITE = false
706 #endif
707 #ifeq (rs6000-ibm-aix,$(findstring rs6000-ibm-aix,$(PLATFORM)))
708 #DONT_BUILD_NEWTESTSUITE = false
709 #endif
710
711 ifeq (ppc32_bgp,$(findstring ppc32_bgp,$(PLATFORM)))
712 DONT_BUILD_NEWTESTSUITE = true
713 endif
714 ifdef USES_MMTIMER
715 CFLAGS             += -Dcap_mmtimer
716 CXXFLAGS           += -Dcap_mmtimer
717 endif
718
719 ifdef USES_TCLTK
720 ifndef TCLTK_DIR
721 $(error error: TCLTK_DIR is not set.  Please set in make.config.local)
722 endif
723 TCLTK_LIB_DIR  ?= $(TCLTK_DIR)/lib
724 TCLTK_INC_DIR  ?= $(TCLTK_DIR)/include
725 endif
726
727 ifdef USES_UNWIND_LIB
728 CFLAGS         += -Dcap_unwind
729 CXXFLAGS       += -Dcap_unwind 
730 LIBUNWIND_LIB  ?= $(LIBUNWINDDIR)/lib
731 LIBUNWIND_INC  ?= $(LIBUNWINDDIR)/include
732 endif
733
734 ifdef USES_DWARF_DEBUG
735 LIBDWARF_INC   ?= $(LIBDWARFDIR)/include
736 LIBDWARF_LIB   ?= $(LIBDWARFDIR)/lib
737 endif
738
739 ifdef USES_LIBELF
740 LIBELF_INC     ?= $(LIBELFDIR)/include
741 LIBELF_LIB     ?= $(LIBELFDIR)/lib
742 endif
743
744 ifdef HAVE_NATIVE_DEMANGLER
745 LDFLAGS += -ldemangle
746 CAP_DEF += -Dcap_native_demangler
747 endif
748
749 ifdef GNU_DEMANGLER
750 CAP_DEF += -Dcap_gnu_demangler
751 endif
752
753 ifdef USE_LIBERTY
754 CAP_DEF += -Dcap_liberty
755 ifdef LINK_LIBERTY
756 ifdef LIBIBERTY_LIB
757 DEMANGLER_LINK = -L$(LIBIBERTY_LIB) -liberty
758 else
759 DEMANGLER_LINK = -liberty
760 endif
761 else
762 ifdef LIBIBERTY_LIB
763 DEMANGLER_EXEC_LINK = -L$(LIBIBERTY_LIB) -liberty
764 else
765 DEMANGLER_EXEC_LINK = -liberty
766 endif
767 endif
768 endif
769
770 ifdef USES_FLEX
771 ifdef FLEX_DIR
772 WITHLIBFL       = --with-libfldir=$(FLEX_DIR)
773 else
774 WITHLIBFL       =
775 endif
776 endif
777
778 #Build other variables based off of the above defaults
779
780 ifdef USES_TCLTK
781 # use the first set if using tcl8.4,
782 # use the second set if still using tcl8.3
783 ifndef USE_TCL83
784
785 TCLTK_LIBVER_ID = 8.4
786 CFLAGS      += -DTCLCONST=const
787 CXXFLAGS    += -DTCLCONST=const
788 KFLAGS      += -DTCLCONST=const
789 TFLAGS      += -DTCLCONST=const
790
791 else
792
793 TCLTK_LIBVER_ID = 8.3
794 CFLAGS      += -DTCLCONST=""
795 CXXFLAGS    += -DTCLCONST=""
796 KFLAGS      += -DTCLCONST=""
797 TFLAGS      += -DTCLCONST=""
798
799 endif
800
801 TCL_LIB         = -ltcl$(TCLTK_LIBVER_ID)
802 TK_LIB          = -ltk$(TCLTK_LIBVER_ID)
803
804 ifdef LIBTCLTKSTATIC
805 TCLTK_LIBS      += -Wl,-Bstatic $(TCL_LIB) $(TK_LIB) -Wl,-Bdynamic
806 else
807 TCLTK_LIBS      += $(TCL_LIB) $(TK_LIB)
808 endif
809
810 # TCL2C is used to generate compilable sources from tcl files
811 TCL2C           = $(TO_CORE)/../scripts/tcl2c
812 TCL2C_GEN_SRCS  = tcl2c.C
813
814 IFLAGS          += -I$(TCLTK_INC_DIR)
815 ifdef CROSSCOMPILER
816 LIBDIR          += $(patsubst %,-L%/rs_aix41/lib,$(TCLTK_DIR))
817 else
818 LIBDIR      += $(patsubst %,-L%,$(TCLTK_LIB_DIR))
819 endif
820
821 endif # USES_TCLTK
822
823 ifdef USES_PAPI
824 PAPI_INCDIR     = $(PAPI_ROOT)
825 PAPI_LIBDIR     = $(PAPI_ROOT)
826 #PAPI_LIB       = -Wl,-static -lpapi -Wl,-Bdynamic
827 #PAPI_LIB       = $(PAPI_LIBDIR)/libpapi.a
828 PAPI_LIB        = -Wl,-rpath=$(PAPI_LIBDIR) -L$(PAPI_LIBDIR) -lpapi  
829 IFLAGS          += -I$(PAPI_INCDIR)
830 LIBDIR          += $(patsubst %,-L%,$(PAPI_LIBDIR))
831 CFLAGS          += -DPAPI 
832 CXXFLAGS        += -DPAPI
833 TFLAGS          += -DPAPI 
834 endif
835
836 ifdef USES_FLEX
837 FLEX_LIB        = -lfl
838 ifdef FLEX_DIR
839 LIBDIR          += $(patsubst %,-L%,$(FLEX_DIR))
840 VPATH           += $(FLEX_DIR)
841 endif
842 endif
843
844 ifdef CROSSCOMPILER
845 # no /s or /p allowed here
846 #FLEX_DIR       = /s/flex/rs_aix41/lib
847 #LIBDIR         += -L/p/sp2/gcc/lib 
848 endif
849
850 ifdef LIBDWARF_HASSETFRAME
851         CAP_DEF += -Ddwarf_has_setframe
852 endif
853
854 ifdef USES_X11
855 X11_LIB         = -lX11
856
857 ifeq (solaris,$(findstring solaris,$(PLATFORM)))
858 X11DIR          = /usr/openwin
859 CFLAGS          += -I$(X11DIR)/include
860 CXXFLAGS        += -I$(X11DIR)/include
861 TFLAGS          += -I$(X11DIR)/include
862 LIBDIR          += -R$(X11DIR)/lib -L$(X11DIR)/lib
863 endif
864
865 ifeq (linux,$(findstring linux,$(PLATFORM)))
866 X11DIR          = /usr/X11R6
867 CFLAGS          += -I$(X11DIR)/include/X11
868 CXXFLAGS        += -I$(X11DIR)/include/X11
869 TFLAGS          += -I$(X11DIR)/include/X11
870 LIBDIR          += -L$(X11DIR)/lib
871 endif
872
873 ifeq (x86_64,$(findstring x86_64,$(PLATFORM)))
874 LIBDIR          += -L$(X11DIR)/lib64
875 endif
876 ifeq (ibm-aix,$(findstring ibm-aix,$(PLATFORM)))
877 X11DIR          = /usr
878 endif
879
880 endif # USES_X11
881