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