powerpc instruction semantics
[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 GCC      ?= gcc
95 GXX      ?= g++
96 LINKER   = ld
97 AS              = as
98 CC       ?= $(GCC)
99 CXX      ?= $(GXX)
100 LEX      = flex
101 RANLIB   = ranlib
102 AR       = ar
103 YFLAGS   = -d -y
104 YACC     = bison
105 MV       = mv
106 CP       = cp
107 RM       = rm -f
108 LN       = ln -s
109 MKDIR           = mkdir -p
110 CHMOD    = chmod
111 PERL            = perl          # NB: perl v5 or higher required!
112
113 # COLLECTOR is only used by purify & quantify
114 COLLECTOR       = /s/gcc-2.7.2/bin/../lib/gcc-lib/$(PLATFORM)/2.7.2/ld
115 # BUILDSTAMP is used to generate local build vouchers
116 BUILDSTAMP      = $(TO_CORE)/../scripts/buildstamp
117
118 ifndef PLATFORM
119 BUILDERROR: PLATFORM must be defined in environment to build (and run) Paradyn
120 endif
121
122 # Define all tags based on the platform string. When a new platform
123 # is added, add it to the list
124
125 #
126 # Brief description of -Ds:
127 #
128 # CAP
129 # cap_save_the_world: support for creating a patched binary
130 # cap_relocation: function relocation
131 # cap_stripped_binaries: recursive parsing and function discovery without symbols
132 # cap_async_events: 
133 # cap_ptrace: uses ptrace interface
134 # cap_proc: uses /proc interface
135 # cap_proc_ioctl: uses ioctl interface to proc
136 # cap_proc_fd: uses solaris-style multiple-fd proc interface
137 # cap_threads: support for threaded applications
138 # cap_dynamic_heap: support for a dynamically growing inferior heap
139 # cap_threaded_times: (Linux only) times() returns per-thread information.
140 # cap_syscall_trap: The ability (or necessity) to place a trap instruction at the instruction following a system call.
141 # cap_slicing: (i386-unknown-linux2.4 and 2.6, sparc-sun-solaris2.8 and 2.9) Intraprocedural slicing feature
142 # cap_32_64: platforms that support 32- and 64-bit mutatees
143 # cap_liveness: liveness analysis
144 # cap_fixpoint_gen: Generate code using a fixpoint method that saves space
145 # cap_noaddr_gen: Allow code generation before determining the address code is going into
146 # cap_mutatee_traps: Traps can be handled mutatee side
147 # cap_instruction_api: System uses instruction API
148 # cap_registers: User can access registers in snippets
149 # cap_instruction_replacement: we use the replaceCode concept to implement (e.g.,) function call replacement
150 # cap_tramp_liveness: we can run liveness over our trampolines to determine what's used
151 #
152 # BUG
153 # bug_aix_broken_fork: AIX child process does not stop on fork if requested.
154 # bug_syscall_changepc_rewind: Linux rewinds the PC by <addr width> if
155 #   the change occurs within a system call; reported by SGI.
156 # bug_freebsd_missing_sigstop: A stop followed by a continue and a new SIGSTOP 
157 #   results in the new SIGSTOP event never being returned from waitpid
158 # bug_freebsd_mt_suspend: threads do not suspend after an attach
159 # bug_freebsd_change_pc: when changing the PC for a thread, the OS may not
160 #   schedule the thread if it is blocked in the kernel.
161 # bug_phdrs_first_page: the OS requires that the program headers for a ELF
162 #   binary must reside in the first page of the binary on disk
163
164 ifeq ($(PLATFORM),i386-unknown-linux2.4)
165 OLD_DEF     = -Di386_unknown_linux2_0
166 ARCH_DEF    = -Darch_x86
167 OS_DEF      = -Dos_linux
168 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
169 BUG_DEF     = -Dbug_syscall_changepc_rewind
170 endif
171
172 ifeq ($(PLATFORM),i386-unknown-linux2.6)
173 OLD_DEF     = -Di386_unknown_linux2_0
174 ARCH_DEF    = -Darch_x86
175 OS_DEF      = -Dos_linux
176 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
177 BUG_DEF     = -Dbug_syscall_changepc_rewind
178 endif
179
180 ifeq ($(PLATFORM),x86_64-unknown-linux2.4)
181 OLD_DEF     = -Dx86_64_unknown_linux2_4
182 ARCH_DEF    = -Darch_x86_64 -Darch_64bit
183 OS_DEF      = -Dos_linux
184 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
185 BUG_DEF     = -Dbug_syscall_changepc_rewind
186 endif
187
188 ifeq ($(PLATFORM),sparc-sun-solaris2.8)
189 OLD_DEF     = -Dsparc_sun_solaris2_4
190 ARCH_DEF    = -Darch_sparc
191 OS_DEF      = -Dos_solaris
192 CAP_DEF     = -Dcap_proc -Dcap_proc_fd -Dcap_async_events -Dcap_dynamic_heap -Dcap_threads -Dcap_relocation -Dcap_dwarf \
193 -Dcap_syscall_trap -Dcap_serialization
194 BUG_DEF     =
195 endif
196
197 ifeq ($(PLATFORM),sparc-sun-solaris2.9)
198 OLD_DEF     = -Dsparc_sun_solaris2_4
199 ARCH_DEF    = -Darch_sparc
200 OS_DEF      = -Dos_solaris
201 CAP_DEF     = -Dcap_proc -Dcap_proc_fd -Dcap_async_events -Dcap_dynamic_heap -Dcap_threads -Dcap_relocation -Dcap_dwarf \
202 -Dcap_syscall_trap -Dcap_serialization
203 BUG_DEF     =
204 endif
205
206 ifeq ($(PLATFORM),rs6000-ibm-aix5.1)
207 OLD_DEF     = -Drs6000_ibm_aix5_1 -Drs6000_ibm_aix4_1
208 ARCH_DEF    = -Darch_power
209 OS_DEF      = -Dos_aix
210 CAP_DEF     = -Dcap_proc -Dcap_proc_fd -Dcap_async_events -Dcap_relocation -Dcap_threads -Dcap_dynamic_heap -Dcap_syscall_trap \
211 -Dcap_liveness -Dcap_use_pdvector -Dcap_serialization -Dcap_registers -Dcap_instruction_replacement -Dcap_instruction_api \
212 -Dcap_stackwalker_use_symtab
213 BUG_DEF     =
214 endif
215
216 ifeq ($(PLATFORM),rs6000-ibm-aix64-5.2)
217 OLD_DEF     = -Drs6000_ibm_aix5_1 -Drs6000_ibm_aix4_1
218 ARCH_DEF    = -Darch_power -Darch_64bit
219 OS_DEF      = -Dos_aix
220 CAP_DEF     = -Dcap_proc -Dcap_proc_fd -Dcap_async_events -Dcap_relocation -Dcap_threads -Dcap_dynamic_heap -Dcap_syscall_trap \
221 -Dcap_liveness -Dcap_use_pdvector -Dcap_serialization -Dcap_registers -Dcap_instruction_replacement \
222 -Dcap_instruction_api -Dcap_32_64
223 BUG_DEF     = 
224 endif
225
226 ifeq ($(PLATFORM),ppc64_linux)
227 OLD_DEF     = -Dppc64_linux
228 ARCH_DEF    = -Darch_power -Darch_64bit
229 OS_DEF      = -Dos_linux
230 CAP_DEF     = -Dcap_ptrace -Dcap_relocation -Dcap_async_events -Dcap_threads -Dcap_dynamic_heap -Dcap_dwarf -Dcap_liveness \
231 -Dcap_32_64 -Dcap_serialization -Dcap_registers -Dcap_instruction_replacement -Dcap_binary_rewriter -Dcap_instruction_api
232 BUG_DEF     = -Dbug_syscall_changepc_rewind
233 endif
234
235 ifeq ($(PLATFORM),ppc32_linux)
236 OLD_DEF     = -Dppc32_linux
237 ARCH_DEF    = -Darch_power
238 OS_DEF      = -Dos_linux
239 CAP_DEF     = -Dcap_ptrace -Dcap_relocation -Dcap_async_events -Dcap_threads -Dcap_dynamic_heap -Dcap_dwarf -Dcap_liveness \
240 -Dcap_serialization -Dcap_registers -Dcap_instruction_replacement -Dcap_instruction_api \
241 -Dcap_binary_rewriter
242 BUG_DEF     = -Dbug_syscall_changepc_rewind
243 endif
244
245 ifeq ($(PLATFORM),ppc32_bgl_ion)
246 OLD_DEF     = -Dppc32_bluegene
247 ARCH_DEF    = -Darch_power
248 OS_DEF      = -Dos_bg -Dos_bgl -Dos_bg_ion
249 CAP_DEF     = -Dcap_dwarf
250 BUG_DEF     = 
251 endif
252
253 ifeq ($(PLATFORM),ppc32_bgl_compute)
254 OLD_DEF     = -Dppc32_bluegene
255 ARCH_DEF    = -Darch_powerO
256 OS_DEF      = -Dos_bg -Dos_bgl -Dos_bg_compute
257 CAP_DEF     = -Dcap_dwarf
258 BUG_DEF     = 
259 endif
260
261 ifeq ($(PLATFORM),ppc32_bgp_ion)
262 OLD_DEF     = -Dppc32_bluegene
263 ARCH_DEF    = -Darch_power
264 OS_DEF      = -Dos_bg -Dos_bgp -Dos_bg_ion
265 CAP_DEF     = -Dcap_dwarf
266 BUG_DEF     = 
267 endif
268
269 ifeq ($(PLATFORM),ppc32_bgp_compute)
270 OLD_DEF     = -Dppc32_bluegene
271 ARCH_DEF    = -Darch_power
272 OS_DEF      = -Dos_bg -Dos_bgp -Dos_bg_compute
273 CAP_DEF     = -Dcap_dwarf
274 BUG_DEF     = 
275 endif
276
277 ifeq ($(PLATFORM),x86_64_catamount)
278 OLD_DEF     = -Dx86_64_catamount
279 ARCH_DEF    = -Darch_x86_64 -Darch_64bit
280 OS_DEF      = -Dos_catamount
281 CAP_DEF     = -Dcap_dwarf
282 BUG_DEF     = 
283 endif
284 ifeq ($(PLATFORM),x86_64_cnl)
285 OLD_DEF     = -Dx86_64_cnl
286 ARCH_DEF    = -Darch_x86_64 -Darch_64bit
287 OS_DEF      = -Dos_linux -Dos_cnl
288 CAP_DEF     = -Dcap_ptrace -Dcap_stripped_binaries -Dcap_async_events -Dcap_threads -Dcap_dynamic_heap -Dcap_relocation \
289 -Dcap_dwarf -Dcap_32_64 -Dcap_liveness -Dcap_fixpoint_gen -Dcap_noaddr_gen -Dcap_mutatee_traps \
290 -Dcap_instruction_api
291 BUG_DEF     = -Dbug_syscall_changepc_rewind
292 endif
293 #
294
295 ifeq ($(PLATFORM),ppc32-unknown-vxworks6.x)
296 OLD_DEF     = -Dppc32_vxworks
297 ARCH_DEF    = -Darch_power -Dtarget_ppc32 -Dtarget_smallmem -Dendian_mismatch
298 OS_DEF      = -Dos_vxworks
299 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
300 #CAP_DEF     = -Dcap_mutatee_traps -Dcap_binary_rewriter -Dcap_stripped_binaries
301 BUG_DEF     =
302 endif
303
304 ifeq ($(PLATFORM),i386-unknown-freebsd7.2)
305 OLD_DEF     = -Di386_unknown_freebsd7_0
306 ARCH_DEF    = -Darch_x86
307 OS_DEF      = -Dos_freebsd
308 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
309 BUG_DEF     = -Dbug_freebsd_missing_sigstop -Dbug_freebsd_mt_suspend -Dbug_freebsd_change_pc -Dbug_phdrs_first_page
310 endif
311
312 ifeq ($(PLATFORM),amd64-unknown-freebsd7.2)
313 OLD_DEF     = -Damd64_unknown_freebsd7_0
314 ARCH_DEF    = -Darch_x86_64 -Darch_64bit
315 OS_DEF      = -Dos_freebsd
316 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
317 BUG_DEF     = -Dbug_freebsd_missing_sigstop -Dbug_freebsd_mt_suspend -Dbug_freebsd_change_pc -Dbug_phdrs_first_page
318 endif
319
320
321 # Combine all the #defines for ease of use
322 UNIFIED_DEF     = $(ARCH_DEF) $(OS_DEF) $(VER_DEF) $(CAP_DEF) $(BUG_DEF) $(OLD_DEF) $(AC_DEF)
323 UNIFIED_TEST_DEF        = $(ARCH_DEF) $(OS_DEF) $(VER_DEF) $(CAP_DEF) $(BUG_DEF) $(OLD_DEF)
324
325 #ifeq (solaris,$(findstring solaris,$(PLATFORM)))
326 ifeq (solaris,$(findstring solaris,$(OS_DEF)))
327 #AS             = /usr/ccs/bin/as
328 RANLIB          = true
329 endif
330
331 ifeq (linux,$(findstring linux,$(OS_DEF)))
332 AS              = /usr/bin/as
333 RANLIB          = true 
334 ASFLAGS         =
335 else
336 ASFLAGS         = -P $(UNIFIED_DEF) 
337 endif 
338
339 # set the macros that control whether the stdint limit and constant
340 # macros are defined for C++ on the compilers command line so that
341 # we don't have to worry about the ordering of #includes.
342 ifeq (linux,$(findstring linux,$(PLATFORM)))
343 STDINT_MACROS   = -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS
344 else
345 ifeq (freebsd,$(findstring freebsd,$(PLATFORM)))
346 STDINT_MACROS   = -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS
347 else
348 ifeq (bluegene,$(findstring bluegene,$(PLATFORM)))
349 STDINT_MACROS   = -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS
350 else
351 STDINT_MACROS   = 
352 endif
353 endif
354 endif
355
356 # Default module compiler; modules which want $(CC) should redefine
357 # this, **NOT** CC
358
359 MODCC           = $(CXX)
360 MODCFLAGS       = $(CXXFLAGS)
361 DEPCC       = $(MODCC)
362
363 .SUFFIXES:      .I
364
365 # Added dyninst/external for included external dependencies - bernat, 11JUN07
366 IFLAGS          = $(FIRST_INCLUDE) -I../h -I. -I$(TO_CORE) -I$(TO_CORE)/dynutil/h -I$(TO_CORE)/external
367
368 # uncomment/comment the line below to build with/without compilation warnings
369 # SILENCE_WARNINGS=true
370
371 ifndef SILENCE_WARNINGS
372 BASICWARNINGS   = -W -Wall
373
374 COMMONWARNINGS  = -W -Wall -Wshadow -Wpointer-arith       \
375                 -Wcast-qual            \
376                 -Wredundant-decls -Woverloaded-virtual
377
378 # not as strict as above, but can actually be used -- mdc
379 USEFULWARNINGS  = -W -Wall -Wpointer-arith       \
380                 -Wcast-qual            \
381                 -Woverloaded-virtual
382
383 # being nice to poor old pathetic tcl/tk header files --ari
384 TCLFRIENDLYWARNINGS = -W -Wall -Wpointer-arith \
385                 -Wcast-qual \
386                 -Woverloaded-virtual
387
388 ifeq (solaris,$(findstring solaris,$(PLATFORM)))
389 COMMONWARNINGS       += -Wno-unknown-pragmas
390 USEFULWARNINGS       += -Wno-unknown-pragmas
391 TCLFRIENDLYWARNINGS  += -Wno-unknown-pragmas
392 else   # STL on Solaris with cast-align generates a warning with much output
393 COMMONWARNINGS       += -Wcast-align
394 USEFULWARNINGS       += -Wcast-align
395 endif
396 endif # SILENCE_WARNINGS
397
398
399 ifndef GCC_2_95
400 GCC_VER := $(shell gcc --version)
401 ifneq (,$(findstring 2.95,$(GCC_VER)))
402 GCC_2_95 = true
403 endif
404 endif
405
406 ifndef OLD_GCC
407 GCC_VER := $(shell gcc --version | head -n 1 | perl -ane 'print pop(@F)')
408 versionNumbers = $(sort $(GCC_VER) 2.95)
409 versionNumber  = $(firstword $(versionNumbers))
410 ifneq (2.95, $(versionNumber))
411 OLD_GCC = true
412 endif
413 endif
414
415 ifndef OLD_GCC
416 COMMONWARNINGS += -Wno-non-template-friend
417 USEFULWARNINGS += -Wno-non-template-friend
418 TCLFRIENDLYWARNINGS += -Wno-non-template-friend
419 endif
420
421 #don't inline -- for the files that won't emit template code
422 INLINE_DEFINES = 
423
424 #inline the private members of the class -- templates.o can use this
425 TEMP_INLINE_DEFINES = -DDO_INLINE_P="inline"
426
427 # inline everything -- the way things should be
428 ALL_INLINE_DEFINES = -DDO_INLINE_F="inline" -DDO_INLINE_P="inline"
429
430
431 ifeq (solaris,$(findstring solaris,$(PLATFORM)))
432 USES_LIBDYNINST_SO = true
433 endif
434 ifeq (linux,$(findstring linux,$(PLATFORM)))
435 USES_LIBDYNINST_SO = true
436 endif
437
438 # Set this variable if it's desired that dyninst be built with the native
439 # compiler on Solaris
440 SOLARIS_NATIVE =  #1
441
442 ifdef SOLARIS_NATIVE
443 ifeq (solaris,$(findstring solaris,$(PLATFORM)))
444 USES_LIBDYNINST_SO = true
445 USES_NATIVE_CC = true
446 NATIVE_CC      = cc
447 NATIVE_CXX     = CC
448 endif
449 endif
450
451 ifeq (ibm-aix,$(findstring ibm-aix,$(PLATFORM)))
452 ifndef IBM_BPATCH_COMPAT
453   USES_LIBDYNINST_SO = true
454 endif
455
456 USES_PERF_LIBRARY = true
457 # No longer used, because of relocation.
458 #USES_LIB_TEXT_HEAP = true
459
460 ifdef IBM_BPATCH_COMPAT
461   ifeq (ibm-aix, $(findstring ibm-aix, $(PLATFORM)))
462     USES_NATIVE_CC = true
463     NATIVE_CC = xlc
464     NATIVE_CXX = xlC
465     DEPCC = xlC
466     DEPENDFLAGS = -M -E -qhalt=E -qro -qtbtable=full -DCOMPILER="xlC"
467   endif
468 endif
469
470 # As of AIX 5, the pm_init function in libpmapi takes more
471 # parameters. This is keyed by the USES_PMAPI_GROUPS define,
472 # and handled in the paradyn runtime library
473 PMAPI_VERSION := $(shell uname -v )
474 ifeq (5, $(findstring 5,$(PMAPI_VERSION)))
475 USES_PMAPI_GROUPS = true
476 endif
477 endif
478
479 # if we don't want OPT_FLAG defined for a particular part of the code
480 # (e.g. rtinst for aix), we just need to define NO_OPT_FLAG before doing
481 # the include of make.config - naim
482 ifndef NO_OPT_FLAG
483 OPT_FLAG        = -O2
484 endif
485
486 # Do we shorten compile lines?
487 ifndef VERBOSE_COMPILATION
488 HIDE_COMP       = @
489 endif
490
491 ifeq (ibm-aix64-, $(findstring ibm-aix64-, $(PLATFORM)))
492     ARCH_FLAGS   = -maix64 -Drs6000_ibm_aix64
493 endif
494
495 ifeq (ppc64_linux, $(findstring ppc64_linux, $(PLATFORM)))
496     ARCH_FLAGS = -m64
497 endif
498
499 # flags for normal (non-kludge) files, with common warnings
500 CFLAGS          = $(IFLAGS) $(UNIFIED_DEF) $(OPT_FLAG) $(COMMON_WARNINGS) $(ARCH_FLAGS)
501 CXXFLAGS        = $(IFLAGS) $(UNIFIED_DEF) $(OPT_FLAG) $(COMMON_WARNINGS) $(STDINT_MACROS) $(ARCH_FLAGS)
502 LDFLAGS         = $(ARCH_FLAGS)
503
504 # flags for kludge files, won't have warnings generated
505 KFLAGS          = $(IFLAGS) $(UNIFIED_DEF) $(BASICWARNINGS)
506
507 ifdef COVERAGE
508
509 CFLAGS += -fprofile-arcs -ftest-coverage
510 CXXFLAGS += -fprofile-arcs -ftest-coverage
511 LDFLAGS += -fprofile-arcs -ftest-coverage
512
513 endif
514
515 ifdef USING_PURIFY
516 CFLAGS          += -DPURE_BUILD
517 CXXFLAGS        += -DPURE_BUILD
518 endif
519
520 ifdef USES_PERF_LIBRARY
521 # Add any platform-specific performance libraries here
522 ifeq (ibm-aix,$(findstring ibm-aix,$(PLATFORM)))
523 USES_PMAPI = true
524 CFLAGS          += -DUSES_PMAPI
525 CXXFLAGS        += -DUSES_PMAPI
526 LDFLAGS         += -lpmapi
527 ifdef USES_PMAPI_GROUPS
528 CFLAGS          += -DPMAPI_GROUPS
529 CXXFLAGS        += -DPMAPI_GROUPS
530 endif # USES_PMAPI_GROUPS
531 endif # ibm-aix
532 endif # perf_library
533
534 ifdef USE_DEPRECATED_BPATCH_VECTOR
535 CXXFLAGS        += -DUSE_DEPRECATED_BPATCH_VECTOR
536 CFLAGS          += -DUSE_DEPRECATED_BPATCH_VECTOR
537 TFLAGS          += -DUSE_DEPRECATED_BPATCH_VECTOR
538 else
539 #CFLAGS        += -fimplicit-templates
540 CXXFLAGS        += -fimplicit-templates
541 TFLAGS        += -fimplicit-templates
542 endif
543
544 ifdef IBM_BPATCH_COMPAT
545 CXXFLAGS        += -DIBM_BPATCH_COMPAT
546 CFLAGS          += -DIBM_BPATCH_COMPAT
547 endif
548
549 ifndef OPT_FLAG
550 KFLAGS          += -g
551 DEBUG_FLAG = -g
552 endif
553
554 ifeq ($(DEBUG_FLAG),none)
555 DEBUG_FLAG =
556 endif
557
558 ifdef DEBUG_FLAG
559 CFLAGS   += $(DEBUG_FLAG)
560 CXXFLAGS += $(DEBUG_FLAG)
561 KFLAGS   += $(DEBUG_FLAG)
562 endif
563
564 ifdef VERBOSE_CFG_ACCOUNTING
565 CFLAGS   += -DVERBOSE_CFG_FACTORY
566 CXXFLAGS += -DVERBOSE_CFG_FACTORY
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 HAVE_NATIVE_DEMANGLER
714 LDFLAGS += -ldemangle
715 CAP_DEF += -Dcap_native_demangler
716 endif
717
718 ifdef GNU_DEMANGLER
719 CAP_DEF += -Dcap_gnu_demangler
720 endif
721
722 ifdef USE_LIBERTY
723 CAP_DEF += -Dcap_liberty
724 ifdef LINK_LIBERTY
725 ifdef LIBIBERTY_LIB
726 DEMANGLER_LINK = -L$(LIBIBERTY_LIB) -liberty
727 else
728 DEMANGLER_LINK = -liberty
729 endif
730 else
731 ifdef LIBIBERTY_LIB
732 DEMANGLER_EXEC_LINK = -L$(LIBIBERTY_LIB) -liberty
733 else
734 DEMANGLER_EXEC_LINK = -liberty
735 endif
736 endif
737 endif
738
739 ifdef USES_FLEX
740 ifdef FLEX_DIR
741 WITHLIBFL       = --with-libfldir=$(FLEX_DIR)
742 else
743 WITHLIBFL       =
744 endif
745 endif
746
747 #Build other variables based off of the above defaults
748
749 ifdef USES_TCLTK
750 # use the first set if using tcl8.4,
751 # use the second set if still using tcl8.3
752 ifndef USE_TCL83
753
754 TCLTK_LIBVER_ID = 8.4
755 CFLAGS      += -DTCLCONST=const
756 CXXFLAGS    += -DTCLCONST=const
757 KFLAGS      += -DTCLCONST=const
758 TFLAGS      += -DTCLCONST=const
759
760 else
761
762 TCLTK_LIBVER_ID = 8.3
763 CFLAGS      += -DTCLCONST=""
764 CXXFLAGS    += -DTCLCONST=""
765 KFLAGS      += -DTCLCONST=""
766 TFLAGS      += -DTCLCONST=""
767
768 endif
769
770 TCL_LIB         = -ltcl$(TCLTK_LIBVER_ID)
771 TK_LIB          = -ltk$(TCLTK_LIBVER_ID)
772
773 ifdef LIBTCLTKSTATIC
774 TCLTK_LIBS      += -Wl,-Bstatic $(TCL_LIB) $(TK_LIB) -Wl,-Bdynamic
775 else
776 TCLTK_LIBS      += $(TCL_LIB) $(TK_LIB)
777 endif
778
779 # TCL2C is used to generate compilable sources from tcl files
780 TCL2C           = $(TO_CORE)/../scripts/tcl2c
781 TCL2C_GEN_SRCS  = tcl2c.C
782
783 IFLAGS          += -I$(TCLTK_INC_DIR)
784 ifdef CROSSCOMPILER
785 LIBDIR          += $(patsubst %,-L%/rs_aix41/lib,$(TCLTK_DIR))
786 else
787 LIBDIR      += $(patsubst %,-L%,$(TCLTK_LIB_DIR))
788 endif
789
790 endif # USES_TCLTK
791
792 ifdef USES_PAPI
793 PAPI_INCDIR     = $(PAPI_ROOT)
794 PAPI_LIBDIR     = $(PAPI_ROOT)
795 #PAPI_LIB       = -Wl,-static -lpapi -Wl,-Bdynamic
796 #PAPI_LIB       = $(PAPI_LIBDIR)/libpapi.a
797 PAPI_LIB        = -Wl,-rpath=$(PAPI_LIBDIR) -L$(PAPI_LIBDIR) -lpapi  
798 IFLAGS          += -I$(PAPI_INCDIR)
799 LIBDIR          += $(patsubst %,-L%,$(PAPI_LIBDIR))
800 CFLAGS          += -DPAPI 
801 CXXFLAGS        += -DPAPI
802 TFLAGS          += -DPAPI 
803 endif
804
805 ifdef USES_FLEX
806 FLEX_LIB        = -lfl
807 ifdef FLEX_DIR
808 LIBDIR          += $(patsubst %,-L%,$(FLEX_DIR))
809 VPATH           += $(FLEX_DIR)
810 endif
811 endif
812
813 ifdef CROSSCOMPILER
814 # no /s or /p allowed here
815 #FLEX_DIR       = /s/flex/rs_aix41/lib
816 #LIBDIR         += -L/p/sp2/gcc/lib 
817 endif
818
819 ifdef LIBDWARF_HASSETFRAME
820         CAP_DEF += -Ddwarf_has_setframe
821 endif
822
823 ifdef USES_X11
824 X11_LIB         = -lX11
825
826 ifeq (solaris,$(findstring solaris,$(PLATFORM)))
827 X11DIR          = /usr/openwin
828 CFLAGS          += -I$(X11DIR)/include
829 CXXFLAGS        += -I$(X11DIR)/include
830 TFLAGS          += -I$(X11DIR)/include
831 LIBDIR          += -R$(X11DIR)/lib -L$(X11DIR)/lib
832 endif
833
834 ifeq (linux,$(findstring linux,$(PLATFORM)))
835 X11DIR          = /usr/X11R6
836 CFLAGS          += -I$(X11DIR)/include/X11
837 CXXFLAGS        += -I$(X11DIR)/include/X11
838 TFLAGS          += -I$(X11DIR)/include/X11
839 LIBDIR          += -L$(X11DIR)/lib
840 endif
841
842 ifeq (x86_64,$(findstring x86_64,$(PLATFORM)))
843 LIBDIR          += -L$(X11DIR)/lib64
844 endif
845 ifeq (ibm-aix,$(findstring ibm-aix,$(PLATFORM)))
846 X11DIR          = /usr
847 endif
848
849 endif # USES_X11
850