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