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