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