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