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