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