Merge branch 'master' of legendre@git.dyninst.org:/pub/dyninst
[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 -Dcap_liveness -Dcap_use_pdvector -Dcap_serialization -Dcap_registers -Dcap_instruction_replacement -Dcap_instruction_api_liveness -Dcap_stackwalker_use_symtab
219 BUG_DEF     = 
220 endif
221
222 ifeq ($(PLATFORM),rs6000-ibm-aix64-5.2)
223 OLD_DEF     = -Drs6000_ibm_aix5_1 -Drs6000_ibm_aix4_1
224 ARCH_DEF    = -Darch_power -Darch_64bit
225 OS_DEF      = -Dos_aix
226 CAP_DEF     = -Dcap_proc -Dcap_proc_fd -Dcap_async_events -Dcap_relocation -Dcap_threads -Dcap_dynamic_heap -Dcap_syscall_trap \
227 -Dcap_32_64 -Dcap_liveness -Dcap_use_pdvector -Dcap_serialization -Dcap_registers -Dcap_instruction_replacement -Dcap_stackwalker_use_symtab
228 BUG_DEF     = 
229 endif
230
231 ifeq ($(PLATFORM),ppc64_linux)
232 OLD_DEF     = -Dppc64_linux
233 ARCH_DEF    = -Darch_power -Darch_64bit
234 OS_DEF      = -Dos_linux
235 CAP_DEF     = -Dcap_ptrace -Dcap_relocation -Dcap_async_events -Dcap_threads -Dcap_dynamic_heap -Dcap_dwarf -Dcap_liveness \
236 -Dcap_32_64 -Dcap_serialization -Dcap_registers -Dcap_instruction_replacement
237 BUG_DEF     = -Dbug_syscall_changepc_rewind
238 endif
239
240 ifeq ($(PLATFORM),ppc32_linux)
241 OLD_DEF     = -Dppc32_linux
242 ARCH_DEF    = -Darch_power
243 OS_DEF      = -Dos_linux
244 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 -Dcap_instruction_api_liveness
245 BUG_DEF     = -Dbug_syscall_changepc_rewind
246 endif
247
248 ifeq ($(PLATFORM),ppc32_bgl_ion)
249 OLD_DEF     = -Dppc32_bluegene
250 ARCH_DEF    = -Darch_power
251 OS_DEF      = -Dos_bg -Dos_bgl -Dos_bg_ion
252 CAP_DEF     = -Dcap_dwarf -Dcap_stackwalker_use_symtab
253 BUG_DEF     = 
254 endif
255
256 ifeq ($(PLATFORM),ppc32_bgl_compute)
257 OLD_DEF     = -Dppc32_bluegene
258 ARCH_DEF    = -Darch_powerO
259 OS_DEF      = -Dos_bg -Dos_bgl -Dos_bg_compute
260 CAP_DEF     = -Dcap_dwarf
261 BUG_DEF     = 
262 endif
263
264 ifeq ($(PLATFORM),ppc32_bgp_ion)
265 OLD_DEF     = -Dppc32_bluegene
266 ARCH_DEF    = -Darch_power
267 OS_DEF      = -Dos_bg -Dos_bgp -Dos_bg_ion
268 CAP_DEF     = -Dcap_dwarf -Dcap_stackwalker_use_symtab
269 BUG_DEF     = 
270 endif
271
272 ifeq ($(PLATFORM),ppc32_bgp_compute)
273 OLD_DEF     = -Dppc32_bluegene
274 ARCH_DEF    = -Darch_power
275 OS_DEF      = -Dos_bg -Dos_bgp -Dos_bg_compute
276 CAP_DEF     = -Dcap_dwarf
277 BUG_DEF     = 
278 endif
279
280 ifeq ($(PLATFORM),x86_64_catamount)
281 OLD_DEF     = -Dx86_64_catamount
282 ARCH_DEF    = -Darch_x86_64 -Darch_64bit
283 OS_DEF      = -Dos_catamount
284 CAP_DEF     = -Dcap_dwarf
285 BUG_DEF     = 
286 endif
287 ifeq ($(PLATFORM),x86_64_cnl)
288 OLD_DEF     = -Dx86_64_cnl
289 ARCH_DEF    = -Darch_x86_64 -Darch_64bit
290 OS_DEF      = -Dos_linux -Dos_cnl
291 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
292 BUG_DEF     = -Dbug_syscall_changepc_rewind
293 endif
294 #
295
296 # Combine all the #defines for ease of use
297 UNIFIED_DEF     = $(ARCH_DEF) $(OS_DEF) $(VER_DEF) $(CAP_DEF) $(BUG_DEF) $(OLD_DEF) $(AC_DEF)
298 UNIFIED_TEST_DEF        = $(ARCH_DEF) $(OS_DEF) $(VER_DEF) $(CAP_DEF) $(BUG_DEF) $(OLD_DEF)
299
300 #ifeq (solaris,$(findstring solaris,$(PLATFORM)))
301 ifeq (solaris,$(findstring solaris,$(OS_DEF)))
302 AS              = /usr/ccs/bin/as
303 RANLIB          = true
304 endif
305
306 ifeq (linux,$(findstring linux,$(OS_DEF)))
307 AS              = /usr/bin/as
308 RANLIB          = true 
309 ASFLAGS         =
310 else
311 ASFLAGS         = -P $(UNIFIED_DEF) 
312 endif 
313
314 # set the macros that control whether the stdint limit and constant
315 # macros are defined for C++ on the compilers command line so that
316 # we don't have to worry about the ordering of #includes.
317 ifeq (linux,$(findstring linux,$(PLATFORM)))
318 STDINT_MACROS   = -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS
319 else
320 ifeq (bluegene,$(findstring bluegene,$(PLATFORM)))
321 STDINT_MACROS   = -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS
322 else
323 STDINT_MACROS   = 
324 endif
325 endif
326
327 # Default module compiler; modules which want $(CC) should redefine
328 # this, **NOT** CC
329
330 MODCC           = $(CXX)
331 MODCFLAGS       = $(CXXFLAGS)
332 DEPCC       = $(MODCC)
333
334 .SUFFIXES:      .I
335
336 # Added dyninst/external for included external dependencies - bernat, 11JUN07
337 IFLAGS          = $(FIRST_INCLUDE) -I../h -I. -I$(TO_CORE) -I$(TO_CORE)/dynutil/h -I$(TO_CORE)/external
338
339 # uncomment/comment the line below to build with/without compilation warnings
340 # SILENCE_WARNINGS=true
341
342 ifndef SILENCE_WARNINGS
343 BASICWARNINGS   = -W -Wall
344
345 COMMONWARNINGS  = -W -Wall -Wshadow -Wpointer-arith       \
346                 -Wcast-qual            \
347                 -Wredundant-decls -Woverloaded-virtual
348
349 # not as strict as above, but can actually be used -- mdc
350 USEFULWARNINGS  = -W -Wall -Wpointer-arith       \
351                 -Wcast-qual            \
352                 -Woverloaded-virtual
353
354 # being nice to poor old pathetic tcl/tk header files --ari
355 TCLFRIENDLYWARNINGS = -W -Wall -Wpointer-arith \
356                 -Wcast-qual \
357                 -Woverloaded-virtual
358
359 ifeq (solaris,$(findstring solaris,$(PLATFORM)))
360 COMMONWARNINGS       += -Wno-unknown-pragmas
361 USEFULWARNINGS       += -Wno-unknown-pragmas
362 TCLFRIENDLYWARNINGS  += -Wno-unknown-pragmas
363 else   # STL on Solaris with cast-align generates a warning with much output
364 COMMONWARNINGS       += -Wcast-align
365 USEFULWARNINGS       += -Wcast-align
366 endif
367 endif # SILENCE_WARNINGS
368
369
370 ifndef GCC_2_95
371 GCC_VER := $(shell gcc --version)
372 ifneq (,$(findstring 2.95,$(GCC_VER)))
373 GCC_2_95 = true
374 endif
375 endif
376
377 ifndef OLD_GCC
378 GCC_VER := $(shell gcc --version | head -n 1 | perl -ane 'print pop(@F)')
379 versionNumbers = $(sort $(GCC_VER) 2.95)
380 versionNumber  = $(firstword $(versionNumbers))
381 ifneq (2.95, $(versionNumber))
382 OLD_GCC = true
383 endif
384 endif
385
386 ifndef OLD_GCC
387 COMMONWARNINGS += -Wno-non-template-friend
388 USEFULWARNINGS += -Wno-non-template-friend
389 TCLFRIENDLYWARNINGS += -Wno-non-template-friend
390 endif
391
392 #don't inline -- for the files that won't emit template code
393 INLINE_DEFINES = 
394
395 #inline the private members of the class -- templates.o can use this
396 TEMP_INLINE_DEFINES = -DDO_INLINE_P="inline"
397
398 # inline everything -- the way things should be
399 ALL_INLINE_DEFINES = -DDO_INLINE_F="inline" -DDO_INLINE_P="inline"
400
401 # Set this variable if it's desired that dyninst be built with the native
402 # compiler on Solaris
403 SOLARIS_NATIVE =  #1
404
405 ifdef SOLARIS_NATIVE
406 ifeq (solaris,$(findstring solaris,$(PLATFORM)))
407 USES_NATIVE_CC = true
408 NATIVE_CC      = cc
409 NATIVE_CXX     = CC
410 endif
411 endif
412
413 ifeq (ibm-aix,$(findstring ibm-aix,$(PLATFORM)))
414
415 ifdef XLC_BUILD
416   USES_NATIVE_CC = true
417   NATIVE_CC = xlc
418   NATIVE_CXX = xlC
419   DEPCC = xlC
420   DEPENDFLAGS = -M -E -qrtti=all -qro -DCOMPILER="xlC"
421   AUTO_TEMPLATES = true
422 endif
423
424 endif
425
426 # if we don't want OPT_FLAG defined for a particular part of the code
427 # (e.g. rtinst for aix), we just need to define NO_OPT_FLAG before doing
428 # the include of make.config - naim
429 ifndef NO_OPT_FLAG
430 OPT_FLAG        = -O2
431 endif
432
433 ifeq (ibm-aix64-, $(findstring ibm-aix64-, $(PLATFORM)))
434     ARCH_FLAGS   = -maix64 -Drs6000_ibm_aix64
435 endif
436
437 ifeq (ppc64_linux, $(findstring ppc64_linux, $(PLATFORM)))
438     ARCH_FLAGS = -m64
439 endif
440
441 # flags for normal (non-kludge) files, with common warnings
442 CFLAGS          = $(IFLAGS) $(UNIFIED_DEF) $(OPT_FLAG) $(COMMON_WARNINGS) $(ARCH_FLAGS)
443 CXXFLAGS        += $(IFLAGS) $(UNIFIED_DEF) $(OPT_FLAG) $(COMMON_WARNINGS) $(STDINT_MACROS) $(ARCH_FLAGS)
444 LDFLAGS         += $(ARCH_FLAGS)
445
446 # flags for kludge files, won't have warnings generated
447 KFLAGS          = $(IFLAGS) $(UNIFIED_DEF) $(BASICWARNINGS)
448
449 ifdef COVERAGE
450
451 CFLAGS += -fprofile-arcs -ftest-coverage
452 CXXFLAGS += -fprofile-arcs -ftest-coverage
453 LDFLAGS += -fprofile-arcs -ftest-coverage
454
455 endif
456
457 ifdef USES_PERF_LIBRARY
458 # Add any platform-specific performance libraries here
459 ifeq (ibm-aix,$(findstring ibm-aix,$(PLATFORM)))
460 USES_PMAPI = true
461 CFLAGS          += -DUSES_PMAPI
462 CXXFLAGS        += -DUSES_PMAPI
463 LDFLAGS         += -lpmapi
464 ifdef USES_PMAPI_GROUPS
465 CFLAGS          += -DPMAPI_GROUPS
466 CXXFLAGS        += -DPMAPI_GROUPS
467 endif # USES_PMAPI_GROUPS
468 endif # ibm-aix
469 endif # perf_library
470
471 ifdef USE_DEPRECATED_BPATCH_VECTOR
472 CXXFLAGS        += -DUSE_DEPRECATED_BPATCH_VECTOR
473 CFLAGS          += -DUSE_DEPRECATED_BPATCH_VECTOR
474 TFLAGS          += -DUSE_DEPRECATED_BPATCH_VECTOR
475 else
476 #CFLAGS        += -fimplicit-templates
477 CXXFLAGS        += -fimplicit-templates
478 TFLAGS        += -fimplicit-templates
479 endif
480
481 ifndef OPT_FLAG
482 KFLAGS          += -g
483 DEBUG_FLAG = -g
484 endif
485
486 ifeq ($(DEBUG_FLAG),none)
487 DEBUG_FLAG =
488 endif
489
490 ifdef DEBUG_FLAG
491 CFLAGS   += $(DEBUG_FLAG)
492 CXXFLAGS += $(DEBUG_FLAG)
493 KFLAGS   += $(DEBUG_FLAG)
494 endif
495
496 # flags for template files, don't define external template flags
497 # -g is optional in this case -- should be defined at module level
498 TFLAGS          = $(IFLAGS) $(TEMP_INLINE_DEFINES) $(UNIFIED_DEF) $(OPT_FLAG) $(BASICWARNINGS) $(STDINT_MACROS) $(ARCH_FLAGS)
499
500 ifdef DO_INLINE_ALL
501 CFLAGS         += $(ALL_INLINE_DEFINES)
502 CXXFLAGS       += $(ALL_INLINE_DEFINES)
503 endif
504
505 # Start off LIBDIR to point to the user's devel area's paradyn lib directory.
506 # As a backup, in case the user hasn't checked out & compiled some paradyn lib,
507 LIBDIR          = $(FIRST_LIBDIR) \
508                  -L$(TO_CORE)/../$(PLATFORM)/lib 
509
510 # Set IGEN to point to $(TO_CORE)/../bin/$(PLATFORM)/igen, if it exists,
511 # else set it to just "igen" (i.e. assume it's in the user's path)
512 ifdef CROSSCOMPILER
513 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 )
514 else
515 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 )
516 endif
517
518 ifdef NO_IMPLICIT_TEMPLATES
519 ifdef USE_DEPRECATED_BPATCH_VECTOR
520 #  CFLAGS               += -fno-implicit-templates
521   CXXFLAGS      += -fno-implicit-templates
522   KFLAGS                += -fno-implicit-templates
523 endif
524 endif
525
526 ifndef INSTANTIATE_TEMPLATES
527 ifndef NO_IMPLICIT_TEMPLATES
528 # -fexternal-templates and -Dexternal_templates should both be used or
529 # neither should be used; add them to CFLAGS, CXXFLAGS, and KFLAGS
530 # (but not to TFLAGS).
531 #
532 #CFLAGS         +=  -fexternal-templates -Dexternal_templates
533 #CXXFLAGS       +=  -fexternal-templates -Dexternal_templates
534 #KFLAGS         +=  -fexternal-templates -Dexternal_templates
535 endif
536 endif
537
538 THREADSLIB      =
539 USE_PTHREADS    = yes
540
541 ifeq (xyes,x$(USE_PTHREADS))
542 THREADSLIB      += -lpthread
543
544 # On Linux, programs using pthreads are supposed to define _REENTRANT
545 ifeq (linux,$(findstring linux,$(PLATFORM)))
546 CFLAGS                  += -D_REENTRANT=1
547 CXXFLAGS                += -D_REENTRANT=1
548 KFLAGS                  += -D_REENTRANT=1
549 TFLAGS                  += -D_REENTRANT=1
550 endif
551
552 ifeq (ibm-aix,$(findstring ibm-aix,$(PLATFORM)))
553 #CFLAGS                 += -D_REENTRANT=1 -D_THREAD_SAFE=1 -D_THREAD_SAFE_ERRNO=1
554 #CXXFLAGS               += -D_REENTRANT=1 -D_THREAD_SAFE=1 -D_THREAD_SAFE_ERRNO=1
555 #KFLAGS                 += -D_REENTRANT=1 -D_THREAD_SAFE=1 -D_THREAD_SAFE_ERRNO=1
556 #TFLAGS                 += -D_REENTRANT=1 -D_THREAD_SAFE=1 -D_THREAD_SAFE_ERRNO=1
557 endif
558
559 ifeq (solaris,$(findstring solaris,$(PLATFORM)))
560 CFLAGS                  += -D_REENTRANT=1 -D_THREAD_SAFE=1 -D_THREAD_SAFE_ERRNO=1
561 CXXFLAGS                += -D_REENTRANT=1 -D_THREAD_SAFE=1 -D_THREAD_SAFE_ERRNO=1
562 KFLAGS                  += -D_REENTRANT=1 -D_THREAD_SAFE=1 -D_THREAD_SAFE_ERRNO=1
563 TFLAGS                  += -D_REENTRANT=1 -D_THREAD_SAFE=1 -D_THREAD_SAFE_ERRNO=1
564 endif
565
566 endif
567
568 # System build constraints
569 #Build the MT daemon on AIX, Solaris, and Linux/x86
570 DONT_BUILD_PD_MT = true
571 ifeq (ibm-aix,$(findstring ibm-aix,$(PLATFORM)))
572 DONT_BUILD_PD_MT =
573 endif
574 ifeq (sparc-sun-solaris,$(findstring sparc-sun-solaris,$(PLATFORM)))
575 DONT_BUILD_PD_MT =
576 endif
577 ifeq (i386-unknown-linux2.4,$(findstring i386-unknown-linux2.4,$(PLATFORM)))
578 DONT_BUILD_PD_MT =
579 endif
580
581 # Build newtestsuite on i386, x86_64 and ia64 linux
582 #DONT_BUILD_NEWTESTSUITE = true
583 #ifeq (i386-unknown-linux,$(findstring i386-unknown-linux,$(PLATFORM)))
584 #DONT_BUILD_NEWTESTSUITE = false
585 #endif
586 #ifeq (ia64-unknown-linux,$(findstring ia64-unknown-linux,$(PLATFORM)))
587 #DONT_BUILD_NEWTESTSUITE = false
588 #endif
589 #ifeq (x86_64-unknown-linux,$(findstring x86_64-unknown-linux,$(PLATFORM)))
590 #DONT_BUILD_NEWTESTSUITE = false
591 #endif
592 #ifeq (ppc32_linux,$(findstring ppc32_linux,$(PLATFORM)))
593 #DONT_BUILD_NEWTESTSUITE = false
594 #endif
595 #ifeq (sparc-sun-solaris,$(findstring sparc-sun-solaris,$(PLATFORM)))
596 #DONT_BUILD_NEWTESTSUITE = false
597 #endif
598 #ifeq (rs6000-ibm-aix,$(findstring rs6000-ibm-aix,$(PLATFORM)))
599 #DONT_BUILD_NEWTESTSUITE = false
600 #endif
601
602 ifdef USES_MMTIMER
603 CFLAGS             += -Dcap_mmtimer
604 CXXFLAGS           += -Dcap_mmtimer
605 endif
606
607 ifdef USES_TCLTK
608 ifndef TCLTK_DIR
609 $(error error: TCLTK_DIR is not set.  Please set in make.config.local)
610 endif
611 TCLTK_LIB_DIR  ?= $(TCLTK_DIR)/lib
612 TCLTK_INC_DIR  ?= $(TCLTK_DIR)/include
613 endif
614
615 ifdef USES_UNWIND_LIB
616 CFLAGS         += -Dcap_unwind
617 CXXFLAGS       += -Dcap_unwind 
618 LIBUNWIND_LIB  ?= $(LIBUNWINDDIR)/lib
619 LIBUNWIND_INC  ?= $(LIBUNWINDDIR)/include
620 endif
621
622 ifdef USES_DWARF_DEBUG
623 LIBDWARF_INC   ?= $(LIBDWARFDIR)/include
624 LIBDWARF_LIB   ?= $(LIBDWARFDIR)/lib
625 endif
626
627 ifdef LIBDWARF_HASSETFRAME
628 CFLAGS         += -Ddwarf_has_setframe
629 CXXFLAGS       += -Ddwarf_has_setframe
630 endif
631
632
633 ifdef USES_LIBELF
634 LIBELF_INC     ?= $(LIBELFDIR)/include
635 LIBELF_LIB     ?= $(LIBELFDIR)/lib
636 endif
637
638 ifdef USES_FLEX
639 ifdef FLEX_DIR
640 WITHLIBFL       = --with-libfldir=$(FLEX_DIR)
641 else
642 WITHLIBFL       =
643 endif
644 endif
645
646 #Build other variables based off of the above defaults
647
648 ifdef USES_TCLTK
649 # use the first set if using tcl8.4,
650 # use the second set if still using tcl8.3
651 ifndef USE_TCL83
652
653 TCLTK_LIBVER_ID = 8.4
654 CFLAGS      += -DTCLCONST=const
655 CXXFLAGS    += -DTCLCONST=const
656 KFLAGS      += -DTCLCONST=const
657 TFLAGS      += -DTCLCONST=const
658
659 else
660
661 TCLTK_LIBVER_ID = 8.3
662 CFLAGS      += -DTCLCONST=""
663 CXXFLAGS    += -DTCLCONST=""
664 KFLAGS      += -DTCLCONST=""
665 TFLAGS      += -DTCLCONST=""
666
667 endif
668
669 TCL_LIB         = -ltcl$(TCLTK_LIBVER_ID)
670 TK_LIB          = -ltk$(TCLTK_LIBVER_ID)
671
672 ifdef LIBTCLTKSTATIC
673 TCLTK_LIBS      += -Wl,-Bstatic $(TCL_LIB) $(TK_LIB) -Wl,-Bdynamic
674 else
675 TCLTK_LIBS      += $(TCL_LIB) $(TK_LIB)
676 endif
677
678 # TCL2C is used to generate compilable sources from tcl files
679 TCL2C           = $(TO_CORE)/../scripts/tcl2c
680 TCL2C_GEN_SRCS  = tcl2c.C
681
682 IFLAGS          += -I$(TCLTK_INC_DIR)
683 ifdef CROSSCOMPILER
684 LIBDIR          += $(patsubst %,-L%/rs_aix41/lib,$(TCLTK_DIR))
685 else
686 LIBDIR      += $(patsubst %,-L%,$(TCLTK_LIB_DIR))
687 endif
688
689 endif # USES_TCLTK
690
691 ifdef USES_PAPI
692 PAPI_INCDIR     = $(PAPI_ROOT)
693 PAPI_LIBDIR     = $(PAPI_ROOT)
694 #PAPI_LIB       = -Wl,-static -lpapi -Wl,-Bdynamic
695 #PAPI_LIB       = $(PAPI_LIBDIR)/libpapi.a
696 PAPI_LIB        = -Wl,-rpath=$(PAPI_LIBDIR) -L$(PAPI_LIBDIR) -lpapi  
697 IFLAGS          += -I$(PAPI_INCDIR)
698 LIBDIR          += $(patsubst %,-L%,$(PAPI_LIBDIR))
699 CFLAGS          += -DPAPI 
700 CXXFLAGS        += -DPAPI
701 TFLAGS          += -DPAPI 
702 endif
703
704 ifdef USES_FLEX
705 FLEX_LIB        = -lfl
706 ifdef FLEX_DIR
707 LIBDIR          += $(patsubst %,-L%,$(FLEX_DIR))
708 VPATH           += $(FLEX_DIR)
709 endif
710 endif
711
712 ifdef CROSSCOMPILER
713 # no /s or /p allowed here
714 #FLEX_DIR       = /s/flex/rs_aix41/lib
715 #LIBDIR         += -L/p/sp2/gcc/lib 
716 endif
717
718 ifdef USES_LIBERTY
719 # Since libiberty.a is in the same g++ directory as libstdc++.a and
720 # libg++.a, no need for a "-L$(LIBERTY_DIR)" entry -at
721 endif
722
723 ifdef USES_X11
724 X11_LIB         = -lX11
725
726 ifeq (solaris,$(findstring solaris,$(PLATFORM)))
727 X11DIR          = /usr/openwin
728 CFLAGS          += -I$(X11DIR)/include
729 CXXFLAGS        += -I$(X11DIR)/include
730 TFLAGS          += -I$(X11DIR)/include
731 LIBDIR          += -R$(X11DIR)/lib -L$(X11DIR)/lib
732 endif
733
734 ifeq (linux,$(findstring linux,$(PLATFORM)))
735 X11DIR          = /usr/X11R6
736 CFLAGS          += -I$(X11DIR)/include/X11
737 CXXFLAGS        += -I$(X11DIR)/include/X11
738 TFLAGS          += -I$(X11DIR)/include/X11
739 LIBDIR          += -L$(X11DIR)/lib
740 endif
741
742 ifeq (x86_64,$(findstring x86_64,$(PLATFORM)))
743 LIBDIR          += -L$(X11DIR)/lib64
744 endif
745 ifeq (ibm-aix,$(findstring ibm-aix,$(PLATFORM)))
746 X11DIR          = /usr
747 endif
748
749 endif # USES_X11