Merge branch 'bsd'
[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 ifeq (ibm-aix64-, $(findstring ibm-aix64-, $(PLATFORM)))
483     ARCH_FLAGS   = -maix64 -Drs6000_ibm_aix64
484 endif
485
486 ifeq (ppc64_linux, $(findstring ppc64_linux, $(PLATFORM)))
487     ARCH_FLAGS = -m64
488 endif
489
490 # flags for normal (non-kludge) files, with common warnings
491 CFLAGS          = $(IFLAGS) $(UNIFIED_DEF) $(OPT_FLAG) $(COMMON_WARNINGS) $(ARCH_FLAGS)
492 CXXFLAGS        = $(IFLAGS) $(UNIFIED_DEF) $(OPT_FLAG) $(COMMON_WARNINGS) $(STDINT_MACROS) $(ARCH_FLAGS)
493 LDFLAGS         = $(ARCH_FLAGS)
494
495 # flags for kludge files, won't have warnings generated
496 KFLAGS          = $(IFLAGS) $(UNIFIED_DEF) $(BASICWARNINGS)
497
498 ifdef COVERAGE
499
500 CFLAGS += -fprofile-arcs -ftest-coverage
501 CXXFLAGS += -fprofile-arcs -ftest-coverage
502 LDFLAGS += -fprofile-arcs -ftest-coverage
503
504 endif
505
506 ifdef USING_PURIFY
507 CFLAGS          += -DPURE_BUILD
508 CXXFLAGS        += -DPURE_BUILD
509 endif
510
511 ifdef USES_PERF_LIBRARY
512 # Add any platform-specific performance libraries here
513 ifeq (ibm-aix,$(findstring ibm-aix,$(PLATFORM)))
514 USES_PMAPI = true
515 CFLAGS          += -DUSES_PMAPI
516 CXXFLAGS        += -DUSES_PMAPI
517 LDFLAGS         += -lpmapi
518 ifdef USES_PMAPI_GROUPS
519 CFLAGS          += -DPMAPI_GROUPS
520 CXXFLAGS        += -DPMAPI_GROUPS
521 endif # USES_PMAPI_GROUPS
522 endif # ibm-aix
523 endif # perf_library
524
525 ifdef USE_DEPRECATED_BPATCH_VECTOR
526 CXXFLAGS        += -DUSE_DEPRECATED_BPATCH_VECTOR
527 CFLAGS          += -DUSE_DEPRECATED_BPATCH_VECTOR
528 TFLAGS          += -DUSE_DEPRECATED_BPATCH_VECTOR
529 else
530 #CFLAGS        += -fimplicit-templates
531 CXXFLAGS        += -fimplicit-templates
532 TFLAGS        += -fimplicit-templates
533 endif
534
535 ifdef IBM_BPATCH_COMPAT
536 CXXFLAGS        += -DIBM_BPATCH_COMPAT
537 CFLAGS          += -DIBM_BPATCH_COMPAT
538 endif
539
540 ifndef OPT_FLAG
541 KFLAGS          += -g
542 DEBUG_FLAG = -g
543 endif
544
545 ifeq ($(DEBUG_FLAG),none)
546 DEBUG_FLAG =
547 endif
548
549 ifdef DEBUG_FLAG
550 CFLAGS   += $(DEBUG_FLAG)
551 CXXFLAGS += $(DEBUG_FLAG)
552 KFLAGS   += $(DEBUG_FLAG)
553 endif
554
555 # flags for template files, don't define external template flags
556 # -g is optional in this case -- should be defined at module level
557 TFLAGS          = $(IFLAGS) $(TEMP_INLINE_DEFINES) $(UNIFIED_DEF) $(OPT_FLAG) $(BASICWARNINGS) $(STDINT_MACROS) $(ARCH_FLAGS)
558
559 ifdef DO_INLINE_ALL
560 CFLAGS         += $(ALL_INLINE_DEFINES)
561 CXXFLAGS       += $(ALL_INLINE_DEFINES)
562 endif
563
564 # Start off LIBDIR to point to the user's devel area's paradyn lib directory.
565 # As a backup, in case the user hasn't checked out & compiled some paradyn lib,
566 LIBDIR          = $(FIRST_LIBDIR) \
567                  -L$(TO_CORE)/../$(PLATFORM)/lib 
568
569 # Set IGEN to point to $(TO_CORE)/../bin/$(PLATFORM)/igen, if it exists,
570 # else set it to just "igen" (i.e. assume it's in the user's path)
571 ifdef CROSSCOMPILER
572 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 )
573 else
574 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 )
575 endif
576
577 ifdef NO_IMPLICIT_TEMPLATES
578 ifdef USE_DEPRECATED_BPATCH_VECTOR
579 #  CFLAGS               += -fno-implicit-templates
580   CXXFLAGS      += -fno-implicit-templates
581   KFLAGS                += -fno-implicit-templates
582 endif
583 endif
584
585 ifndef INSTANTIATE_TEMPLATES
586 ifndef NO_IMPLICIT_TEMPLATES
587 # -fexternal-templates and -Dexternal_templates should both be used or
588 # neither should be used; add them to CFLAGS, CXXFLAGS, and KFLAGS
589 # (but not to TFLAGS).
590 #
591 #CFLAGS         +=  -fexternal-templates -Dexternal_templates
592 #CXXFLAGS       +=  -fexternal-templates -Dexternal_templates
593 #KFLAGS         +=  -fexternal-templates -Dexternal_templates
594 endif
595 endif
596
597 THREADSLIB      =
598 USE_PTHREADS    = yes
599
600 ifeq (xyes,x$(USE_PTHREADS))
601 THREADSLIB      += -lpthread
602
603 # On Linux, programs using pthreads are supposed to define _REENTRANT
604 ifeq (linux,$(findstring linux,$(PLATFORM)))
605 CFLAGS                  += -D_REENTRANT=1
606 CXXFLAGS                += -D_REENTRANT=1
607 KFLAGS                  += -D_REENTRANT=1
608 TFLAGS                  += -D_REENTRANT=1
609 endif
610
611 # Ditto for FreeBSD
612 ifeq (freebsd,$(findstring freebsd,$(PLATFORM)))
613 CFLAGS                  += -D_REENTRANT=1
614 CXXFLAGS                += -D_REENTRANT=1
615 KFLAGS                  += -D_REENTRANT=1
616 TFLAGS                  += -D_REENTRANT=1
617 endif
618
619 ifeq (ibm-aix,$(findstring ibm-aix,$(PLATFORM)))
620 #CFLAGS                 += -D_REENTRANT=1 -D_THREAD_SAFE=1 -D_THREAD_SAFE_ERRNO=1
621 #CXXFLAGS               += -D_REENTRANT=1 -D_THREAD_SAFE=1 -D_THREAD_SAFE_ERRNO=1
622 #KFLAGS                 += -D_REENTRANT=1 -D_THREAD_SAFE=1 -D_THREAD_SAFE_ERRNO=1
623 #TFLAGS                 += -D_REENTRANT=1 -D_THREAD_SAFE=1 -D_THREAD_SAFE_ERRNO=1
624 endif
625
626 ifeq (solaris,$(findstring solaris,$(PLATFORM)))
627 CFLAGS                  += -D_REENTRANT=1 -D_THREAD_SAFE=1 -D_THREAD_SAFE_ERRNO=1
628 CXXFLAGS                += -D_REENTRANT=1 -D_THREAD_SAFE=1 -D_THREAD_SAFE_ERRNO=1
629 KFLAGS                  += -D_REENTRANT=1 -D_THREAD_SAFE=1 -D_THREAD_SAFE_ERRNO=1
630 TFLAGS                  += -D_REENTRANT=1 -D_THREAD_SAFE=1 -D_THREAD_SAFE_ERRNO=1
631 endif
632
633 endif
634
635 # System build constraints
636 #Build the MT daemon on AIX, Solaris, and Linux/x86
637 DONT_BUILD_PD_MT = true
638 ifeq (ibm-aix,$(findstring ibm-aix,$(PLATFORM)))
639 DONT_BUILD_PD_MT =
640 endif
641 ifeq (sparc-sun-solaris,$(findstring sparc-sun-solaris,$(PLATFORM)))
642 DONT_BUILD_PD_MT =
643 endif
644 ifeq (i386-unknown-linux2.4,$(findstring i386-unknown-linux2.4,$(PLATFORM)))
645 DONT_BUILD_PD_MT =
646 endif
647
648 # Build newtestsuite on i386, x86_64 and ia64 linux
649 #DONT_BUILD_NEWTESTSUITE = true
650 #ifeq (i386-unknown-linux,$(findstring i386-unknown-linux,$(PLATFORM)))
651 #DONT_BUILD_NEWTESTSUITE = false
652 #endif
653 #ifeq (ia64-unknown-linux,$(findstring ia64-unknown-linux,$(PLATFORM)))
654 #DONT_BUILD_NEWTESTSUITE = false
655 #endif
656 #ifeq (x86_64-unknown-linux,$(findstring x86_64-unknown-linux,$(PLATFORM)))
657 #DONT_BUILD_NEWTESTSUITE = false
658 #endif
659 #ifeq (ppc32_linux,$(findstring ppc32_linux,$(PLATFORM)))
660 #DONT_BUILD_NEWTESTSUITE = false
661 #endif
662 #ifeq (sparc-sun-solaris,$(findstring sparc-sun-solaris,$(PLATFORM)))
663 #DONT_BUILD_NEWTESTSUITE = false
664 #endif
665 #ifeq (rs6000-ibm-aix,$(findstring rs6000-ibm-aix,$(PLATFORM)))
666 #DONT_BUILD_NEWTESTSUITE = false
667 #endif
668
669 ifdef USES_MMTIMER
670 CFLAGS             += -Dcap_mmtimer
671 CXXFLAGS           += -Dcap_mmtimer
672 endif
673
674 ifdef USES_TCLTK
675 ifndef TCLTK_DIR
676 $(error error: TCLTK_DIR is not set.  Please set in make.config.local)
677 endif
678 TCLTK_LIB_DIR  ?= $(TCLTK_DIR)/lib
679 TCLTK_INC_DIR  ?= $(TCLTK_DIR)/include
680 endif
681
682 ifdef USES_UNWIND_LIB
683 CFLAGS         += -Dcap_unwind
684 CXXFLAGS       += -Dcap_unwind 
685 LIBUNWIND_LIB  ?= $(LIBUNWINDDIR)/lib
686 LIBUNWIND_INC  ?= $(LIBUNWINDDIR)/include
687 endif
688
689 ifdef USES_DWARF_DEBUG
690 LIBDWARF_INC   ?= $(LIBDWARFDIR)/include
691 LIBDWARF_LIB   ?= $(LIBDWARFDIR)/lib
692 endif
693
694 ifdef USES_LIBELF
695 LIBELF_INC     ?= $(LIBELFDIR)/include
696 LIBELF_LIB     ?= $(LIBELFDIR)/lib
697 endif
698
699 ifdef USES_FLEX
700 ifdef FLEX_DIR
701 WITHLIBFL       = --with-libfldir=$(FLEX_DIR)
702 else
703 WITHLIBFL       =
704 endif
705 endif
706
707 #Build other variables based off of the above defaults
708
709 ifdef USES_TCLTK
710 # use the first set if using tcl8.4,
711 # use the second set if still using tcl8.3
712 ifndef USE_TCL83
713
714 TCLTK_LIBVER_ID = 8.4
715 CFLAGS      += -DTCLCONST=const
716 CXXFLAGS    += -DTCLCONST=const
717 KFLAGS      += -DTCLCONST=const
718 TFLAGS      += -DTCLCONST=const
719
720 else
721
722 TCLTK_LIBVER_ID = 8.3
723 CFLAGS      += -DTCLCONST=""
724 CXXFLAGS    += -DTCLCONST=""
725 KFLAGS      += -DTCLCONST=""
726 TFLAGS      += -DTCLCONST=""
727
728 endif
729
730 TCL_LIB         = -ltcl$(TCLTK_LIBVER_ID)
731 TK_LIB          = -ltk$(TCLTK_LIBVER_ID)
732
733 ifdef LIBTCLTKSTATIC
734 TCLTK_LIBS      += -Wl,-Bstatic $(TCL_LIB) $(TK_LIB) -Wl,-Bdynamic
735 else
736 TCLTK_LIBS      += $(TCL_LIB) $(TK_LIB)
737 endif
738
739 # TCL2C is used to generate compilable sources from tcl files
740 TCL2C           = $(TO_CORE)/../scripts/tcl2c
741 TCL2C_GEN_SRCS  = tcl2c.C
742
743 IFLAGS          += -I$(TCLTK_INC_DIR)
744 ifdef CROSSCOMPILER
745 LIBDIR          += $(patsubst %,-L%/rs_aix41/lib,$(TCLTK_DIR))
746 else
747 LIBDIR      += $(patsubst %,-L%,$(TCLTK_LIB_DIR))
748 endif
749
750 endif # USES_TCLTK
751
752 ifdef USES_PAPI
753 PAPI_INCDIR     = $(PAPI_ROOT)
754 PAPI_LIBDIR     = $(PAPI_ROOT)
755 #PAPI_LIB       = -Wl,-static -lpapi -Wl,-Bdynamic
756 #PAPI_LIB       = $(PAPI_LIBDIR)/libpapi.a
757 PAPI_LIB        = -Wl,-rpath=$(PAPI_LIBDIR) -L$(PAPI_LIBDIR) -lpapi  
758 IFLAGS          += -I$(PAPI_INCDIR)
759 LIBDIR          += $(patsubst %,-L%,$(PAPI_LIBDIR))
760 CFLAGS          += -DPAPI 
761 CXXFLAGS        += -DPAPI
762 TFLAGS          += -DPAPI 
763 endif
764
765 ifdef USES_FLEX
766 FLEX_LIB        = -lfl
767 ifdef FLEX_DIR
768 LIBDIR          += $(patsubst %,-L%,$(FLEX_DIR))
769 VPATH           += $(FLEX_DIR)
770 endif
771 endif
772
773 ifdef CROSSCOMPILER
774 # no /s or /p allowed here
775 #FLEX_DIR       = /s/flex/rs_aix41/lib
776 #LIBDIR         += -L/p/sp2/gcc/lib 
777 endif
778
779 ifdef USES_LIBERTY
780 # Since libiberty.a is in the same g++ directory as libstdc++.a and
781 # libg++.a, no need for a "-L$(LIBERTY_DIR)" entry -at
782 endif
783
784 ifdef LIBDWARF_HASSETFRAME
785         CAP_DEF += -Ddwarf_has_setframe
786 endif
787
788 ifdef USES_X11
789 X11_LIB         = -lX11
790
791 ifeq (solaris,$(findstring solaris,$(PLATFORM)))
792 X11DIR          = /usr/openwin
793 CFLAGS          += -I$(X11DIR)/include
794 CXXFLAGS        += -I$(X11DIR)/include
795 TFLAGS          += -I$(X11DIR)/include
796 LIBDIR          += -R$(X11DIR)/lib -L$(X11DIR)/lib
797 endif
798
799 ifeq (linux,$(findstring linux,$(PLATFORM)))
800 X11DIR          = /usr/X11R6
801 CFLAGS          += -I$(X11DIR)/include/X11
802 CXXFLAGS        += -I$(X11DIR)/include/X11
803 TFLAGS          += -I$(X11DIR)/include/X11
804 LIBDIR          += -L$(X11DIR)/lib
805 endif
806
807 ifeq (x86_64,$(findstring x86_64,$(PLATFORM)))
808 LIBDIR          += -L$(X11DIR)/lib64
809 endif
810 ifeq (ibm-aix,$(findstring ibm-aix,$(PLATFORM)))
811 X11DIR          = /usr
812 endif
813
814 endif # USES_X11