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