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