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