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