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