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