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