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