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