Misc power rewriter commit
[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_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_bgl_ion)
259 OLD_DEF     = -Dppc32_bluegene
260 ARCH_DEF    = -Darch_power
261 OS_DEF      = -Dos_bg -Dos_bgl -Dos_bg_ion
262 CAP_DEF     = -Dcap_dwarf
263 BUG_DEF     = 
264 endif
265
266 ifeq ($(PLATFORM),ppc32_bgl_compute)
267 OLD_DEF     = -Dppc32_bluegene
268 ARCH_DEF    = -Darch_powerO
269 OS_DEF      = -Dos_bg -Dos_bgl -Dos_bg_compute
270 CAP_DEF     = -Dcap_dwarf
271 BUG_DEF     = 
272 endif
273
274 ifeq ($(PLATFORM),ppc32_bgp_ion)
275 OLD_DEF     = -Dppc32_bluegene
276 ARCH_DEF    = -Darch_power
277 OS_DEF      = -Dos_bg -Dos_bgp -Dos_bg_ion
278 CAP_DEF     = -Dcap_dwarf
279 BUG_DEF     = 
280 endif
281
282 ifeq ($(PLATFORM),ppc32_bgp_compute)
283 OLD_DEF     = -Dppc32_bluegene
284 ARCH_DEF    = -Darch_power
285 OS_DEF      = -Dos_bg -Dos_bgp -Dos_bg_compute
286 CAP_DEF     = -Dcap_dwarf
287 BUG_DEF     = 
288 endif
289
290 ifeq ($(PLATFORM),x86_64_catamount)
291 OLD_DEF     = -Dx86_64_catamount
292 ARCH_DEF    = -Darch_x86_64 -Darch_64bit
293 OS_DEF      = -Dos_catamount
294 CAP_DEF     = -Dcap_dwarf
295 BUG_DEF     = 
296 endif
297 ifeq ($(PLATFORM),x86_64_cnl)
298 OLD_DEF     = -Dx86_64_cnl
299 ARCH_DEF    = -Darch_x86_64 -Darch_64bit
300 OS_DEF      = -Dos_linux -Dos_cnl
301 CAP_DEF     = -Dcap_ptrace -Dcap_stripped_binaries -Dcap_async_events -Dcap_threads -Dcap_dynamic_heap -Dcap_relocation \
302 -Dcap_dwarf -Dcap_32_64 -Dcap_liveness -Dcap_fixpoint_gen -Dcap_noaddr_gen -Dcap_mutatee_traps \
303 -Dcap_instruction_api
304 BUG_DEF     = -Dbug_syscall_changepc_rewind
305 endif
306 #
307
308 ifeq ($(PLATFORM),ppc32-unknown-vxworks6.x)
309 OLD_DEF     = -Dppc32_vxworks
310 ARCH_DEF    = -Darch_power -Dtarget_ppc32 -Dtarget_smallmem -Dendian_mismatch
311 OS_DEF      = -Dos_vxworks
312 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
313 #CAP_DEF     = -Dcap_mutatee_traps -Dcap_binary_rewriter -Dcap_stripped_binaries
314 BUG_DEF     =
315 endif
316
317 ifeq ($(PLATFORM),i386-unknown-freebsd7.2)
318 OLD_DEF     = -Di386_unknown_freebsd7_0
319 ARCH_DEF    = -Darch_x86
320 OS_DEF      = -Dos_freebsd
321 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
322 BUG_DEF     = -Dbug_freebsd_missing_sigstop -Dbug_freebsd_mt_suspend -Dbug_freebsd_change_pc -Dbug_phdrs_first_page
323 endif
324
325 ifeq ($(PLATFORM),amd64-unknown-freebsd7.2)
326 OLD_DEF     = -Damd64_unknown_freebsd7_0
327 ARCH_DEF    = -Darch_x86_64 -Darch_64bit
328 OS_DEF      = -Dos_freebsd
329 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
330 BUG_DEF     = -Dbug_freebsd_missing_sigstop -Dbug_freebsd_mt_suspend -Dbug_freebsd_change_pc -Dbug_phdrs_first_page
331 endif
332
333
334 # Combine all the #defines for ease of use
335 UNIFIED_DEF     = $(ARCH_DEF) $(OS_DEF) $(VER_DEF) $(CAP_DEF) $(BUG_DEF) $(OLD_DEF) $(AC_DEF)
336 UNIFIED_TEST_DEF        = $(ARCH_DEF) $(OS_DEF) $(VER_DEF) $(CAP_DEF) $(BUG_DEF) $(OLD_DEF)
337
338 #ifeq (solaris,$(findstring solaris,$(PLATFORM)))
339 ifeq (solaris,$(findstring solaris,$(OS_DEF)))
340 #AS             = /usr/ccs/bin/as
341 RANLIB          = true
342 endif
343
344 ifeq (linux,$(findstring linux,$(OS_DEF)))
345 AS              = /usr/bin/as
346 RANLIB          = true 
347 ASFLAGS         =
348 else
349 ASFLAGS         = -P $(UNIFIED_DEF) 
350 endif 
351
352 # set the macros that control whether the stdint limit and constant
353 # macros are defined for C++ on the compilers command line so that
354 # we don't have to worry about the ordering of #includes.
355 ifeq (linux,$(findstring linux,$(PLATFORM)))
356 STDINT_MACROS   = -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS
357 else
358 ifeq (freebsd,$(findstring freebsd,$(PLATFORM)))
359 STDINT_MACROS   = -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS
360 else
361 ifeq (bluegene,$(findstring bluegene,$(PLATFORM)))
362 STDINT_MACROS   = -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS
363 else
364 STDINT_MACROS   = 
365 endif
366 endif
367 endif
368
369 # Default module compiler; modules which want $(CC) should redefine
370 # this, **NOT** CC
371
372 MODCC           = $(CXX)
373 MODCFLAGS       = $(CXXFLAGS)
374 DEPCC       = $(MODCC)
375
376 .SUFFIXES:      .I
377
378 # Added dyninst/external for included external dependencies - bernat, 11JUN07
379 IFLAGS          = $(FIRST_INCLUDE) -I../h -I. -I$(TO_CORE) -I$(TO_CORE)/dynutil/h -I$(TO_CORE)/external
380
381 # uncomment/comment the line below to build with/without compilation warnings
382 # SILENCE_WARNINGS=true
383
384 ifndef SILENCE_WARNINGS
385 BASICWARNINGS   = -W -Wall
386
387 COMMONWARNINGS  = -W -Wall -Wshadow -Wpointer-arith       \
388                 -Wcast-qual            \
389                 -Wredundant-decls -Woverloaded-virtual
390
391 # not as strict as above, but can actually be used -- mdc
392 USEFULWARNINGS  = -W -Wall -Wpointer-arith       \
393                 -Wcast-qual            \
394                 -Woverloaded-virtual
395
396 # being nice to poor old pathetic tcl/tk header files --ari
397 TCLFRIENDLYWARNINGS = -W -Wall -Wpointer-arith \
398                 -Wcast-qual \
399                 -Woverloaded-virtual
400
401 ifeq (solaris,$(findstring solaris,$(PLATFORM)))
402 COMMONWARNINGS       += -Wno-unknown-pragmas
403 USEFULWARNINGS       += -Wno-unknown-pragmas
404 TCLFRIENDLYWARNINGS  += -Wno-unknown-pragmas
405 else   # STL on Solaris with cast-align generates a warning with much output
406 COMMONWARNINGS       += -Wcast-align
407 USEFULWARNINGS       += -Wcast-align
408 endif
409 endif # SILENCE_WARNINGS
410
411
412 ifndef GCC_2_95
413 GCC_VER := $(shell gcc --version)
414 ifneq (,$(findstring 2.95,$(GCC_VER)))
415 GCC_2_95 = true
416 endif
417 endif
418
419 ifndef OLD_GCC
420 GCC_VER := $(shell gcc --version | head -n 1 | perl -ane 'print pop(@F)')
421 versionNumbers = $(sort $(GCC_VER) 2.95)
422 versionNumber  = $(firstword $(versionNumbers))
423 ifneq (2.95, $(versionNumber))
424 OLD_GCC = true
425 endif
426 endif
427
428 ifndef OLD_GCC
429 COMMONWARNINGS += -Wno-non-template-friend
430 USEFULWARNINGS += -Wno-non-template-friend
431 TCLFRIENDLYWARNINGS += -Wno-non-template-friend
432 endif
433
434 #don't inline -- for the files that won't emit template code
435 INLINE_DEFINES = 
436
437 #inline the private members of the class -- templates.o can use this
438 TEMP_INLINE_DEFINES = -DDO_INLINE_P="inline"
439
440 # inline everything -- the way things should be
441 ALL_INLINE_DEFINES = -DDO_INLINE_F="inline" -DDO_INLINE_P="inline"
442
443
444 ifeq (solaris,$(findstring solaris,$(PLATFORM)))
445 USES_LIBDYNINST_SO = true
446 endif
447 ifeq (linux,$(findstring linux,$(PLATFORM)))
448 USES_LIBDYNINST_SO = true
449 endif
450
451 # Set this variable if it's desired that dyninst be built with the native
452 # compiler on Solaris
453 SOLARIS_NATIVE =  #1
454
455 ifdef SOLARIS_NATIVE
456 ifeq (solaris,$(findstring solaris,$(PLATFORM)))
457 USES_LIBDYNINST_SO = true
458 USES_NATIVE_CC = true
459 NATIVE_CC      = cc
460 NATIVE_CXX     = CC
461 endif
462 endif
463
464 ifeq (ibm-aix,$(findstring ibm-aix,$(PLATFORM)))
465 ifndef IBM_BPATCH_COMPAT
466   USES_LIBDYNINST_SO = true
467 endif
468
469 USES_PERF_LIBRARY = true
470 # No longer used, because of relocation.
471 #USES_LIB_TEXT_HEAP = true
472
473 ifdef IBM_BPATCH_COMPAT
474   ifeq (ibm-aix, $(findstring ibm-aix, $(PLATFORM)))
475     USES_NATIVE_CC = true
476     NATIVE_CC = xlc
477     NATIVE_CXX = xlC
478     DEPCC = xlC
479     DEPENDFLAGS = -M -E -qhalt=E -qro -qtbtable=full -DCOMPILER="xlC"
480   endif
481 endif
482
483 # As of AIX 5, the pm_init function in libpmapi takes more
484 # parameters. This is keyed by the USES_PMAPI_GROUPS define,
485 # and handled in the paradyn runtime library
486 PMAPI_VERSION := $(shell uname -v )
487 ifeq (5, $(findstring 5,$(PMAPI_VERSION)))
488 USES_PMAPI_GROUPS = true
489 endif
490 endif
491
492 # if we don't want OPT_FLAG defined for a particular part of the code
493 # (e.g. rtinst for aix), we just need to define NO_OPT_FLAG before doing
494 # the include of make.config - naim
495 ifndef NO_OPT_FLAG
496 OPT_FLAG        = -O2
497 endif
498
499 # Do we shorten compile lines?
500 ifndef VERBOSE_COMPILATION
501 HIDE_COMP       = @
502 endif
503
504 ifeq (ibm-aix64-, $(findstring ibm-aix64-, $(PLATFORM)))
505     ARCH_FLAGS   = -maix64 -Drs6000_ibm_aix64
506 endif
507
508 ifeq (ppc64_linux, $(findstring ppc64_linux, $(PLATFORM)))
509     ARCH_FLAGS = -m64
510 endif
511
512 # flags for normal (non-kludge) files, with common warnings
513 CFLAGS          = $(IFLAGS) $(UNIFIED_DEF) $(OPT_FLAG) $(COMMON_WARNINGS) $(ARCH_FLAGS)
514 CXXFLAGS        = $(IFLAGS) $(UNIFIED_DEF) $(OPT_FLAG) $(COMMON_WARNINGS) $(STDINT_MACROS) $(ARCH_FLAGS)
515 LDFLAGS         = $(ARCH_FLAGS)
516
517 # flags for kludge files, won't have warnings generated
518 KFLAGS          = $(IFLAGS) $(UNIFIED_DEF) $(BASICWARNINGS)
519
520 ifdef COVERAGE
521
522 CFLAGS += -fprofile-arcs -ftest-coverage
523 CXXFLAGS += -fprofile-arcs -ftest-coverage
524 LDFLAGS += -fprofile-arcs -ftest-coverage
525
526 endif
527
528 ifdef USING_PURIFY
529 CFLAGS          += -DPURE_BUILD
530 CXXFLAGS        += -DPURE_BUILD
531 endif
532
533 ifdef USES_PERF_LIBRARY
534 # Add any platform-specific performance libraries here
535 ifeq (ibm-aix,$(findstring ibm-aix,$(PLATFORM)))
536 USES_PMAPI = true
537 CFLAGS          += -DUSES_PMAPI
538 CXXFLAGS        += -DUSES_PMAPI
539 LDFLAGS         += -lpmapi
540 ifdef USES_PMAPI_GROUPS
541 CFLAGS          += -DPMAPI_GROUPS
542 CXXFLAGS        += -DPMAPI_GROUPS
543 endif # USES_PMAPI_GROUPS
544 endif # ibm-aix
545 endif # perf_library
546
547 ifdef USE_DEPRECATED_BPATCH_VECTOR
548 CXXFLAGS        += -DUSE_DEPRECATED_BPATCH_VECTOR
549 CFLAGS          += -DUSE_DEPRECATED_BPATCH_VECTOR
550 TFLAGS          += -DUSE_DEPRECATED_BPATCH_VECTOR
551 else
552 #CFLAGS        += -fimplicit-templates
553 CXXFLAGS        += -fimplicit-templates
554 TFLAGS        += -fimplicit-templates
555 endif
556
557 ifdef IBM_BPATCH_COMPAT
558 CXXFLAGS        += -DIBM_BPATCH_COMPAT
559 CFLAGS          += -DIBM_BPATCH_COMPAT
560 endif
561
562 ifndef OPT_FLAG
563 KFLAGS          += -g
564 DEBUG_FLAG = -g
565 endif
566
567 ifeq ($(DEBUG_FLAG),none)
568 DEBUG_FLAG =
569 endif
570
571 ifdef DEBUG_FLAG
572 CFLAGS   += $(DEBUG_FLAG)
573 CXXFLAGS += $(DEBUG_FLAG)
574 KFLAGS   += $(DEBUG_FLAG)
575 endif
576
577 ifdef VERBOSE_CFG_ACCOUNTING
578 CFLAGS   += -DVERBOSE_CFG_FACTORY
579 CXXFLAGS += -DVERBOSE_CFG_FACTORY
580 endif
581
582 # flags for template files, don't define external template flags
583 # -g is optional in this case -- should be defined at module level
584 TFLAGS          = $(IFLAGS) $(TEMP_INLINE_DEFINES) $(UNIFIED_DEF) $(OPT_FLAG) $(BASICWARNINGS) $(STDINT_MACROS) $(ARCH_FLAGS)
585
586 ifdef DO_INLINE_ALL
587 CFLAGS         += $(ALL_INLINE_DEFINES)
588 CXXFLAGS       += $(ALL_INLINE_DEFINES)
589 endif
590
591 # Start off LIBDIR to point to the user's devel area's paradyn lib directory.
592 # As a backup, in case the user hasn't checked out & compiled some paradyn lib,
593 LIBDIR          = $(FIRST_LIBDIR) \
594                  -L$(TO_CORE)/../$(PLATFORM)/lib 
595
596 # Set IGEN to point to $(TO_CORE)/../bin/$(PLATFORM)/igen, if it exists,
597 # else set it to just "igen" (i.e. assume it's in the user's path)
598 ifdef CROSSCOMPILER
599 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 )
600 else
601 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 )
602 endif
603
604 ifdef NO_IMPLICIT_TEMPLATES
605 ifdef USE_DEPRECATED_BPATCH_VECTOR
606 #  CFLAGS               += -fno-implicit-templates
607   CXXFLAGS      += -fno-implicit-templates
608   KFLAGS                += -fno-implicit-templates
609 endif
610 endif
611
612 ifndef INSTANTIATE_TEMPLATES
613 ifndef NO_IMPLICIT_TEMPLATES
614 # -fexternal-templates and -Dexternal_templates should both be used or
615 # neither should be used; add them to CFLAGS, CXXFLAGS, and KFLAGS
616 # (but not to TFLAGS).
617 #
618 #CFLAGS         +=  -fexternal-templates -Dexternal_templates
619 #CXXFLAGS       +=  -fexternal-templates -Dexternal_templates
620 #KFLAGS         +=  -fexternal-templates -Dexternal_templates
621 endif
622 endif
623
624 THREADSLIB      =
625 USE_PTHREADS    = yes
626
627 ifeq (xyes,x$(USE_PTHREADS))
628 THREADSLIB      += -lpthread
629
630 # On Linux, programs using pthreads are supposed to define _REENTRANT
631 ifeq (linux,$(findstring linux,$(PLATFORM)))
632 CFLAGS                  += -D_REENTRANT=1
633 CXXFLAGS                += -D_REENTRANT=1
634 KFLAGS                  += -D_REENTRANT=1
635 TFLAGS                  += -D_REENTRANT=1
636 endif
637
638 # Ditto for FreeBSD
639 ifeq (freebsd,$(findstring freebsd,$(PLATFORM)))
640 CFLAGS                  += -D_REENTRANT=1
641 CXXFLAGS                += -D_REENTRANT=1
642 KFLAGS                  += -D_REENTRANT=1
643 TFLAGS                  += -D_REENTRANT=1
644 endif
645
646 ifeq (ibm-aix,$(findstring ibm-aix,$(PLATFORM)))
647 #CFLAGS                 += -D_REENTRANT=1 -D_THREAD_SAFE=1 -D_THREAD_SAFE_ERRNO=1
648 #CXXFLAGS               += -D_REENTRANT=1 -D_THREAD_SAFE=1 -D_THREAD_SAFE_ERRNO=1
649 #KFLAGS                 += -D_REENTRANT=1 -D_THREAD_SAFE=1 -D_THREAD_SAFE_ERRNO=1
650 #TFLAGS                 += -D_REENTRANT=1 -D_THREAD_SAFE=1 -D_THREAD_SAFE_ERRNO=1
651 endif
652
653 ifeq (solaris,$(findstring solaris,$(PLATFORM)))
654 CFLAGS                  += -D_REENTRANT=1 -D_THREAD_SAFE=1 -D_THREAD_SAFE_ERRNO=1
655 CXXFLAGS                += -D_REENTRANT=1 -D_THREAD_SAFE=1 -D_THREAD_SAFE_ERRNO=1
656 KFLAGS                  += -D_REENTRANT=1 -D_THREAD_SAFE=1 -D_THREAD_SAFE_ERRNO=1
657 TFLAGS                  += -D_REENTRANT=1 -D_THREAD_SAFE=1 -D_THREAD_SAFE_ERRNO=1
658 endif
659
660 endif
661
662 # System build constraints
663 #Build the MT daemon on AIX, Solaris, and Linux/x86
664 DONT_BUILD_PD_MT = true
665 ifeq (ibm-aix,$(findstring ibm-aix,$(PLATFORM)))
666 DONT_BUILD_PD_MT =
667 endif
668 ifeq (sparc-sun-solaris,$(findstring sparc-sun-solaris,$(PLATFORM)))
669 DONT_BUILD_PD_MT =
670 endif
671 ifeq (i386-unknown-linux2.4,$(findstring i386-unknown-linux2.4,$(PLATFORM)))
672 DONT_BUILD_PD_MT =
673 endif
674
675 # Build newtestsuite on i386, x86_64 and ia64 linux
676 #DONT_BUILD_NEWTESTSUITE = true
677 #ifeq (i386-unknown-linux,$(findstring i386-unknown-linux,$(PLATFORM)))
678 #DONT_BUILD_NEWTESTSUITE = false
679 #endif
680 #ifeq (ia64-unknown-linux,$(findstring ia64-unknown-linux,$(PLATFORM)))
681 #DONT_BUILD_NEWTESTSUITE = false
682 #endif
683 #ifeq (x86_64-unknown-linux,$(findstring x86_64-unknown-linux,$(PLATFORM)))
684 #DONT_BUILD_NEWTESTSUITE = false
685 #endif
686 #ifeq (ppc32_linux,$(findstring ppc32_linux,$(PLATFORM)))
687 #DONT_BUILD_NEWTESTSUITE = false
688 #endif
689 #ifeq (sparc-sun-solaris,$(findstring sparc-sun-solaris,$(PLATFORM)))
690 #DONT_BUILD_NEWTESTSUITE = false
691 #endif
692 #ifeq (rs6000-ibm-aix,$(findstring rs6000-ibm-aix,$(PLATFORM)))
693 #DONT_BUILD_NEWTESTSUITE = false
694 #endif
695
696 ifdef USES_MMTIMER
697 CFLAGS             += -Dcap_mmtimer
698 CXXFLAGS           += -Dcap_mmtimer
699 endif
700
701 ifdef USES_TCLTK
702 ifndef TCLTK_DIR
703 $(error error: TCLTK_DIR is not set.  Please set in make.config.local)
704 endif
705 TCLTK_LIB_DIR  ?= $(TCLTK_DIR)/lib
706 TCLTK_INC_DIR  ?= $(TCLTK_DIR)/include
707 endif
708
709 ifdef USES_UNWIND_LIB
710 CFLAGS         += -Dcap_unwind
711 CXXFLAGS       += -Dcap_unwind 
712 LIBUNWIND_LIB  ?= $(LIBUNWINDDIR)/lib
713 LIBUNWIND_INC  ?= $(LIBUNWINDDIR)/include
714 endif
715
716 ifdef USES_DWARF_DEBUG
717 LIBDWARF_INC   ?= $(LIBDWARFDIR)/include
718 LIBDWARF_LIB   ?= $(LIBDWARFDIR)/lib
719 endif
720
721 ifdef USES_LIBELF
722 LIBELF_INC     ?= $(LIBELFDIR)/include
723 LIBELF_LIB     ?= $(LIBELFDIR)/lib
724 endif
725
726 ifdef HAVE_NATIVE_DEMANGLER
727 LDFLAGS += -ldemangle
728 CAP_DEF += -Dcap_native_demangler
729 endif
730
731 ifdef GNU_DEMANGLER
732 CAP_DEF += -Dcap_gnu_demangler
733 endif
734
735 ifdef USE_LIBERTY
736 CAP_DEF += -Dcap_liberty
737 ifdef LINK_LIBERTY
738 ifdef LIBIBERTY_LIB
739 DEMANGLER_LINK = -L$(LIBIBERTY_LIB) -liberty
740 else
741 DEMANGLER_LINK = -liberty
742 endif
743 else
744 ifdef LIBIBERTY_LIB
745 DEMANGLER_EXEC_LINK = -L$(LIBIBERTY_LIB) -liberty
746 else
747 DEMANGLER_EXEC_LINK = -liberty
748 endif
749 endif
750 endif
751
752 ifdef USES_FLEX
753 ifdef FLEX_DIR
754 WITHLIBFL       = --with-libfldir=$(FLEX_DIR)
755 else
756 WITHLIBFL       =
757 endif
758 endif
759
760 #Build other variables based off of the above defaults
761
762 ifdef USES_TCLTK
763 # use the first set if using tcl8.4,
764 # use the second set if still using tcl8.3
765 ifndef USE_TCL83
766
767 TCLTK_LIBVER_ID = 8.4
768 CFLAGS      += -DTCLCONST=const
769 CXXFLAGS    += -DTCLCONST=const
770 KFLAGS      += -DTCLCONST=const
771 TFLAGS      += -DTCLCONST=const
772
773 else
774
775 TCLTK_LIBVER_ID = 8.3
776 CFLAGS      += -DTCLCONST=""
777 CXXFLAGS    += -DTCLCONST=""
778 KFLAGS      += -DTCLCONST=""
779 TFLAGS      += -DTCLCONST=""
780
781 endif
782
783 TCL_LIB         = -ltcl$(TCLTK_LIBVER_ID)
784 TK_LIB          = -ltk$(TCLTK_LIBVER_ID)
785
786 ifdef LIBTCLTKSTATIC
787 TCLTK_LIBS      += -Wl,-Bstatic $(TCL_LIB) $(TK_LIB) -Wl,-Bdynamic
788 else
789 TCLTK_LIBS      += $(TCL_LIB) $(TK_LIB)
790 endif
791
792 # TCL2C is used to generate compilable sources from tcl files
793 TCL2C           = $(TO_CORE)/../scripts/tcl2c
794 TCL2C_GEN_SRCS  = tcl2c.C
795
796 IFLAGS          += -I$(TCLTK_INC_DIR)
797 ifdef CROSSCOMPILER
798 LIBDIR          += $(patsubst %,-L%/rs_aix41/lib,$(TCLTK_DIR))
799 else
800 LIBDIR      += $(patsubst %,-L%,$(TCLTK_LIB_DIR))
801 endif
802
803 endif # USES_TCLTK
804
805 ifdef USES_PAPI
806 PAPI_INCDIR     = $(PAPI_ROOT)
807 PAPI_LIBDIR     = $(PAPI_ROOT)
808 #PAPI_LIB       = -Wl,-static -lpapi -Wl,-Bdynamic
809 #PAPI_LIB       = $(PAPI_LIBDIR)/libpapi.a
810 PAPI_LIB        = -Wl,-rpath=$(PAPI_LIBDIR) -L$(PAPI_LIBDIR) -lpapi  
811 IFLAGS          += -I$(PAPI_INCDIR)
812 LIBDIR          += $(patsubst %,-L%,$(PAPI_LIBDIR))
813 CFLAGS          += -DPAPI 
814 CXXFLAGS        += -DPAPI
815 TFLAGS          += -DPAPI 
816 endif
817
818 ifdef USES_FLEX
819 FLEX_LIB        = -lfl
820 ifdef FLEX_DIR
821 LIBDIR          += $(patsubst %,-L%,$(FLEX_DIR))
822 VPATH           += $(FLEX_DIR)
823 endif
824 endif
825
826 ifdef CROSSCOMPILER
827 # no /s or /p allowed here
828 #FLEX_DIR       = /s/flex/rs_aix41/lib
829 #LIBDIR         += -L/p/sp2/gcc/lib 
830 endif
831
832 ifdef LIBDWARF_HASSETFRAME
833         CAP_DEF += -Ddwarf_has_setframe
834 endif
835
836 ifdef USES_X11
837 X11_LIB         = -lX11
838
839 ifeq (solaris,$(findstring solaris,$(PLATFORM)))
840 X11DIR          = /usr/openwin
841 CFLAGS          += -I$(X11DIR)/include
842 CXXFLAGS        += -I$(X11DIR)/include
843 TFLAGS          += -I$(X11DIR)/include
844 LIBDIR          += -R$(X11DIR)/lib -L$(X11DIR)/lib
845 endif
846
847 ifeq (linux,$(findstring linux,$(PLATFORM)))
848 X11DIR          = /usr/X11R6
849 CFLAGS          += -I$(X11DIR)/include/X11
850 CXXFLAGS        += -I$(X11DIR)/include/X11
851 TFLAGS          += -I$(X11DIR)/include/X11
852 LIBDIR          += -L$(X11DIR)/lib
853 endif
854
855 ifeq (x86_64,$(findstring x86_64,$(PLATFORM)))
856 LIBDIR          += -L$(X11DIR)/lib64
857 endif
858 ifeq (ibm-aix,$(findstring ibm-aix,$(PLATFORM)))
859 X11DIR          = /usr
860 endif
861
862 endif # USES_X11
863