More work to port ProcControlAPI to FreeBSD.
[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_stackwalker_use_symtab -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_stackwalker_use_symtab -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_stackwalker_use_symtab -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 -Dcap_stackwalker_use_symtab
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_32_64 -Dcap_liveness -Dcap_use_pdvector -Dcap_serialization -Dcap_registers -Dcap_instruction_replacement
232 BUG_DEF     = 
233 endif
234
235 ifeq ($(PLATFORM),ppc64_linux)
236 OLD_DEF     = -Dppc64_linux
237 ARCH_DEF    = -Darch_power -Darch_64bit
238 OS_DEF      = -Dos_linux
239 CAP_DEF     = -Dcap_ptrace -Dcap_relocation -Dcap_async_events -Dcap_threads -Dcap_dynamic_heap -Dcap_dwarf -Dcap_liveness \
240 -Dcap_32_64 -Dcap_serialization -Dcap_registers -Dcap_instruction_replacement -Dcap_binary_rewriter
241 BUG_DEF     = -Dbug_syscall_changepc_rewind
242 endif
243
244 ifeq ($(PLATFORM),ppc32_linux)
245 OLD_DEF     = -Dppc32_linux
246 ARCH_DEF    = -Darch_power
247 OS_DEF      = -Dos_linux
248 CAP_DEF     = -Dcap_ptrace -Dcap_relocation -Dcap_async_events -Dcap_threads -Dcap_dynamic_heap -Dcap_dwarf -Dcap_liveness \
249 -Dcap_serialization -Dcap_registers -Dcap_stackwalker_use_symtab -Dcap_instruction_replacement -Dcap_instruction_api \
250 -Dcap_binary_rewriter
251 BUG_DEF     = -Dbug_syscall_changepc_rewind
252 endif
253
254 ifeq ($(PLATFORM),ppc32_bgl_ion)
255 OLD_DEF     = -Dppc32_bluegene
256 ARCH_DEF    = -Darch_power
257 OS_DEF      = -Dos_bg -Dos_bgl -Dos_bg_ion
258 CAP_DEF     = -Dcap_dwarf -Dcap_stackwalker_use_symtab
259 BUG_DEF     = 
260 endif
261
262 ifeq ($(PLATFORM),ppc32_bgl_compute)
263 OLD_DEF     = -Dppc32_bluegene
264 ARCH_DEF    = -Darch_powerO
265 OS_DEF      = -Dos_bg -Dos_bgl -Dos_bg_compute
266 CAP_DEF     = -Dcap_dwarf
267 BUG_DEF     = 
268 endif
269
270 ifeq ($(PLATFORM),ppc32_bgp_ion)
271 OLD_DEF     = -Dppc32_bluegene
272 ARCH_DEF    = -Darch_power
273 OS_DEF      = -Dos_bg -Dos_bgp -Dos_bg_ion
274 CAP_DEF     = -Dcap_dwarf -Dcap_stackwalker_use_symtab
275 BUG_DEF     = 
276 endif
277
278 ifeq ($(PLATFORM),ppc32_bgp_compute)
279 OLD_DEF     = -Dppc32_bluegene
280 ARCH_DEF    = -Darch_power
281 OS_DEF      = -Dos_bg -Dos_bgp -Dos_bg_compute
282 CAP_DEF     = -Dcap_dwarf
283 BUG_DEF     = 
284 endif
285
286 ifeq ($(PLATFORM),x86_64_catamount)
287 OLD_DEF     = -Dx86_64_catamount
288 ARCH_DEF    = -Darch_x86_64 -Darch_64bit
289 OS_DEF      = -Dos_catamount
290 CAP_DEF     = -Dcap_dwarf
291 BUG_DEF     = 
292 endif
293 ifeq ($(PLATFORM),x86_64_cnl)
294 OLD_DEF     = -Dx86_64_cnl
295 ARCH_DEF    = -Darch_x86_64 -Darch_64bit
296 OS_DEF      = -Dos_linux -Dos_cnl
297 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
298 BUG_DEF     = -Dbug_syscall_changepc_rewind
299 endif
300 #
301
302 ifeq ($(PLATFORM),i386-unknown-freebsd8.0)
303 OLD_DEF     = -Di386_unknown_freebsd8_0
304 ARCH_DEF    = -Darch_x86
305 OS_DEF      = -Dos_freebsd
306 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
307 BUG_DEF     = -Dbug_syscall_changepc_rewind
308 endif
309
310 ifeq ($(PLATFORM),i386-unknown-freebsd7.2)
311 OLD_DEF     = -Di386_unknown_freebsd7_0
312 ARCH_DEF    = -Darch_x86
313 OS_DEF      = -Dos_freebsd
314 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
315 BUG_DEF     = -Dbug_syscall_changepc_rewind
316 endif
317
318 # Combine all the #defines for ease of use
319 UNIFIED_DEF     = $(ARCH_DEF) $(OS_DEF) $(VER_DEF) $(CAP_DEF) $(BUG_DEF) $(OLD_DEF) $(AC_DEF)
320 UNIFIED_TEST_DEF        = $(ARCH_DEF) $(OS_DEF) $(VER_DEF) $(CAP_DEF) $(BUG_DEF) $(OLD_DEF)
321
322 #ifeq (solaris,$(findstring solaris,$(PLATFORM)))
323 ifeq (solaris,$(findstring solaris,$(OS_DEF)))
324 AS              = /usr/ccs/bin/as
325 RANLIB          = true
326 endif
327
328 ifeq (linux,$(findstring linux,$(OS_DEF)))
329 AS              = /usr/bin/as
330 RANLIB          = true 
331 ASFLAGS         =
332 else
333 ASFLAGS         = -P $(UNIFIED_DEF) 
334 endif 
335
336 # set the macros that control whether the stdint limit and constant
337 # macros are defined for C++ on the compilers command line so that
338 # we don't have to worry about the ordering of #includes.
339 ifeq (linux,$(findstring linux,$(PLATFORM)))
340 STDINT_MACROS   = -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS
341 else
342 ifeq (freebsd,$(findstring freebsd,$(PLATFORM)))
343 STDINT_MACROS   = -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS
344 else
345 ifeq (bluegene,$(findstring bluegene,$(PLATFORM)))
346 STDINT_MACROS   = -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS
347 else
348 STDINT_MACROS   = 
349 endif
350 endif
351 endif
352
353 # Default module compiler; modules which want $(CC) should redefine
354 # this, **NOT** CC
355
356 MODCC           = $(CXX)
357 MODCFLAGS       = $(CXXFLAGS)
358 DEPCC       = $(MODCC)
359
360 .SUFFIXES:      .I
361
362 # Added dyninst/external for included external dependencies - bernat, 11JUN07
363 IFLAGS          = $(FIRST_INCLUDE) -I../h -I. -I$(TO_CORE) -I$(TO_CORE)/dynutil/h -I$(TO_CORE)/external
364
365 # uncomment/comment the line below to build with/without compilation warnings
366 # SILENCE_WARNINGS=true
367
368 ifndef SILENCE_WARNINGS
369 BASICWARNINGS   = -W -Wall
370
371 COMMONWARNINGS  = -W -Wall -Wshadow -Wpointer-arith       \
372                 -Wcast-qual            \
373                 -Wredundant-decls -Woverloaded-virtual
374
375 # not as strict as above, but can actually be used -- mdc
376 USEFULWARNINGS  = -W -Wall -Wpointer-arith       \
377                 -Wcast-qual            \
378                 -Woverloaded-virtual
379
380 # being nice to poor old pathetic tcl/tk header files --ari
381 TCLFRIENDLYWARNINGS = -W -Wall -Wpointer-arith \
382                 -Wcast-qual \
383                 -Woverloaded-virtual
384
385 ifeq (solaris,$(findstring solaris,$(PLATFORM)))
386 COMMONWARNINGS       += -Wno-unknown-pragmas
387 USEFULWARNINGS       += -Wno-unknown-pragmas
388 TCLFRIENDLYWARNINGS  += -Wno-unknown-pragmas
389 else   # STL on Solaris with cast-align generates a warning with much output
390 COMMONWARNINGS       += -Wcast-align
391 USEFULWARNINGS       += -Wcast-align
392 endif
393 endif # SILENCE_WARNINGS
394
395
396 ifndef GCC_2_95
397 GCC_VER := $(shell gcc --version)
398 ifneq (,$(findstring 2.95,$(GCC_VER)))
399 GCC_2_95 = true
400 endif
401 endif
402
403 ifndef OLD_GCC
404 GCC_VER := $(shell gcc --version | head -n 1 | perl -ane 'print pop(@F)')
405 versionNumbers = $(sort $(GCC_VER) 2.95)
406 versionNumber  = $(firstword $(versionNumbers))
407 ifneq (2.95, $(versionNumber))
408 OLD_GCC = true
409 endif
410 endif
411
412 ifndef OLD_GCC
413 COMMONWARNINGS += -Wno-non-template-friend
414 USEFULWARNINGS += -Wno-non-template-friend
415 TCLFRIENDLYWARNINGS += -Wno-non-template-friend
416 endif
417
418 #don't inline -- for the files that won't emit template code
419 INLINE_DEFINES = 
420
421 #inline the private members of the class -- templates.o can use this
422 TEMP_INLINE_DEFINES = -DDO_INLINE_P="inline"
423
424 # inline everything -- the way things should be
425 ALL_INLINE_DEFINES = -DDO_INLINE_F="inline" -DDO_INLINE_P="inline"
426
427
428 ifeq (solaris,$(findstring solaris,$(PLATFORM)))
429 USES_LIBDYNINST_SO = true
430 endif
431 ifeq (linux,$(findstring linux,$(PLATFORM)))
432 USES_LIBDYNINST_SO = true
433 endif
434
435 # Set this variable if it's desired that dyninst be built with the native
436 # compiler on Solaris
437 SOLARIS_NATIVE =  #1
438
439 ifdef SOLARIS_NATIVE
440 ifeq (solaris,$(findstring solaris,$(PLATFORM)))
441 USES_LIBDYNINST_SO = true
442 USES_NATIVE_CC = true
443 NATIVE_CC      = cc
444 NATIVE_CXX     = CC
445 endif
446 endif
447
448 ifeq (ibm-aix,$(findstring ibm-aix,$(PLATFORM)))
449 ifndef IBM_BPATCH_COMPAT
450   USES_LIBDYNINST_SO = true
451 endif
452
453 USES_PERF_LIBRARY = true
454 # No longer used, because of relocation.
455 #USES_LIB_TEXT_HEAP = true
456
457 ifdef IBM_BPATCH_COMPAT
458   ifeq (ibm-aix, $(findstring ibm-aix, $(PLATFORM)))
459     USES_NATIVE_CC = true
460     NATIVE_CC = xlc
461     NATIVE_CXX = xlC
462     DEPCC = xlC
463     DEPENDFLAGS = -M -E -qhalt=E -qro -qtbtable=full -DCOMPILER="xlC"
464   endif
465 endif
466
467 # As of AIX 5, the pm_init function in libpmapi takes more
468 # parameters. This is keyed by the USES_PMAPI_GROUPS define,
469 # and handled in the paradyn runtime library
470 PMAPI_VERSION := $(shell uname -v )
471 ifeq (5, $(findstring 5,$(PMAPI_VERSION)))
472 USES_PMAPI_GROUPS = true
473 endif
474 endif
475
476 # if we don't want OPT_FLAG defined for a particular part of the code
477 # (e.g. rtinst for aix), we just need to define NO_OPT_FLAG before doing
478 # the include of make.config - naim
479 ifndef NO_OPT_FLAG
480 OPT_FLAG        = -O2
481 endif
482
483 ifeq (ibm-aix64-, $(findstring ibm-aix64-, $(PLATFORM)))
484     ARCH_FLAGS   = -maix64 -Drs6000_ibm_aix64
485 endif
486
487 ifeq (ppc64_linux, $(findstring ppc64_linux, $(PLATFORM)))
488     ARCH_FLAGS = -m64
489 endif
490
491 # flags for normal (non-kludge) files, with common warnings
492 CFLAGS          = $(IFLAGS) $(UNIFIED_DEF) $(OPT_FLAG) $(COMMON_WARNINGS) $(ARCH_FLAGS)
493 CXXFLAGS        = $(IFLAGS) $(UNIFIED_DEF) $(OPT_FLAG) $(COMMON_WARNINGS) $(STDINT_MACROS) $(ARCH_FLAGS)
494 LDFLAGS         = $(ARCH_FLAGS)
495
496 # flags for kludge files, won't have warnings generated
497 KFLAGS          = $(IFLAGS) $(UNIFIED_DEF) $(BASICWARNINGS)
498
499 ifdef COVERAGE
500
501 CFLAGS += -fprofile-arcs -ftest-coverage
502 CXXFLAGS += -fprofile-arcs -ftest-coverage
503 LDFLAGS += -fprofile-arcs -ftest-coverage
504
505 endif
506
507 ifdef USING_PURIFY
508 CFLAGS          += -DPURE_BUILD
509 CXXFLAGS        += -DPURE_BUILD
510 endif
511
512 ifdef USES_PERF_LIBRARY
513 # Add any platform-specific performance libraries here
514 ifeq (ibm-aix,$(findstring ibm-aix,$(PLATFORM)))
515 USES_PMAPI = true
516 CFLAGS          += -DUSES_PMAPI
517 CXXFLAGS        += -DUSES_PMAPI
518 LDFLAGS         += -lpmapi
519 ifdef USES_PMAPI_GROUPS
520 CFLAGS          += -DPMAPI_GROUPS
521 CXXFLAGS        += -DPMAPI_GROUPS
522 endif # USES_PMAPI_GROUPS
523 endif # ibm-aix
524 endif # perf_library
525
526 ifdef USE_DEPRECATED_BPATCH_VECTOR
527 CXXFLAGS        += -DUSE_DEPRECATED_BPATCH_VECTOR
528 CFLAGS          += -DUSE_DEPRECATED_BPATCH_VECTOR
529 TFLAGS          += -DUSE_DEPRECATED_BPATCH_VECTOR
530 else
531 #CFLAGS        += -fimplicit-templates
532 CXXFLAGS        += -fimplicit-templates
533 TFLAGS        += -fimplicit-templates
534 endif
535
536 ifdef IBM_BPATCH_COMPAT
537 CXXFLAGS        += -DIBM_BPATCH_COMPAT
538 CFLAGS          += -DIBM_BPATCH_COMPAT
539 endif
540
541 ifndef OPT_FLAG
542 KFLAGS          += -g
543 DEBUG_FLAG = -g
544 endif
545
546 ifeq ($(DEBUG_FLAG),none)
547 DEBUG_FLAG =
548 endif
549
550 ifdef DEBUG_FLAG
551 CFLAGS   += $(DEBUG_FLAG)
552 CXXFLAGS += $(DEBUG_FLAG)
553 KFLAGS   += $(DEBUG_FLAG)
554 endif
555
556 # flags for template files, don't define external template flags
557 # -g is optional in this case -- should be defined at module level
558 TFLAGS          = $(IFLAGS) $(TEMP_INLINE_DEFINES) $(UNIFIED_DEF) $(OPT_FLAG) $(BASICWARNINGS) $(STDINT_MACROS) $(ARCH_FLAGS)
559
560 ifdef DO_INLINE_ALL
561 CFLAGS         += $(ALL_INLINE_DEFINES)
562 CXXFLAGS       += $(ALL_INLINE_DEFINES)
563 endif
564
565 # Start off LIBDIR to point to the user's devel area's paradyn lib directory.
566 # As a backup, in case the user hasn't checked out & compiled some paradyn lib,
567 LIBDIR          = $(FIRST_LIBDIR) \
568                  -L$(TO_CORE)/../$(PLATFORM)/lib 
569
570 # Set IGEN to point to $(TO_CORE)/../bin/$(PLATFORM)/igen, if it exists,
571 # else set it to just "igen" (i.e. assume it's in the user's path)
572 ifdef CROSSCOMPILER
573 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 )
574 else
575 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 )
576 endif
577
578 ifdef NO_IMPLICIT_TEMPLATES
579 ifdef USE_DEPRECATED_BPATCH_VECTOR
580 #  CFLAGS               += -fno-implicit-templates
581   CXXFLAGS      += -fno-implicit-templates
582   KFLAGS                += -fno-implicit-templates
583 endif
584 endif
585
586 ifndef INSTANTIATE_TEMPLATES
587 ifndef NO_IMPLICIT_TEMPLATES
588 # -fexternal-templates and -Dexternal_templates should both be used or
589 # neither should be used; add them to CFLAGS, CXXFLAGS, and KFLAGS
590 # (but not to TFLAGS).
591 #
592 #CFLAGS         +=  -fexternal-templates -Dexternal_templates
593 #CXXFLAGS       +=  -fexternal-templates -Dexternal_templates
594 #KFLAGS         +=  -fexternal-templates -Dexternal_templates
595 endif
596 endif
597
598 THREADSLIB      =
599 USE_PTHREADS    = yes
600
601 ifeq (xyes,x$(USE_PTHREADS))
602 THREADSLIB      += -lpthread
603
604 # On Linux, programs using pthreads are supposed to define _REENTRANT
605 ifeq (linux,$(findstring linux,$(PLATFORM)))
606 CFLAGS                  += -D_REENTRANT=1
607 CXXFLAGS                += -D_REENTRANT=1
608 KFLAGS                  += -D_REENTRANT=1
609 TFLAGS                  += -D_REENTRANT=1
610 endif
611
612 # Ditto for FreeBSD
613 ifeq (freebsd,$(findstring freebsd,$(PLATFORM)))
614 CFLAGS                  += -D_REENTRANT=1
615 CXXFLAGS                += -D_REENTRANT=1
616 KFLAGS                  += -D_REENTRANT=1
617 TFLAGS                  += -D_REENTRANT=1
618 endif
619
620 ifeq (ibm-aix,$(findstring ibm-aix,$(PLATFORM)))
621 #CFLAGS                 += -D_REENTRANT=1 -D_THREAD_SAFE=1 -D_THREAD_SAFE_ERRNO=1
622 #CXXFLAGS               += -D_REENTRANT=1 -D_THREAD_SAFE=1 -D_THREAD_SAFE_ERRNO=1
623 #KFLAGS                 += -D_REENTRANT=1 -D_THREAD_SAFE=1 -D_THREAD_SAFE_ERRNO=1
624 #TFLAGS                 += -D_REENTRANT=1 -D_THREAD_SAFE=1 -D_THREAD_SAFE_ERRNO=1
625 endif
626
627 ifeq (solaris,$(findstring solaris,$(PLATFORM)))
628 CFLAGS                  += -D_REENTRANT=1 -D_THREAD_SAFE=1 -D_THREAD_SAFE_ERRNO=1
629 CXXFLAGS                += -D_REENTRANT=1 -D_THREAD_SAFE=1 -D_THREAD_SAFE_ERRNO=1
630 KFLAGS                  += -D_REENTRANT=1 -D_THREAD_SAFE=1 -D_THREAD_SAFE_ERRNO=1
631 TFLAGS                  += -D_REENTRANT=1 -D_THREAD_SAFE=1 -D_THREAD_SAFE_ERRNO=1
632 endif
633
634 endif
635
636 # System build constraints
637 #Build the MT daemon on AIX, Solaris, and Linux/x86
638 DONT_BUILD_PD_MT = true
639 ifeq (ibm-aix,$(findstring ibm-aix,$(PLATFORM)))
640 DONT_BUILD_PD_MT =
641 endif
642 ifeq (sparc-sun-solaris,$(findstring sparc-sun-solaris,$(PLATFORM)))
643 DONT_BUILD_PD_MT =
644 endif
645 ifeq (i386-unknown-linux2.4,$(findstring i386-unknown-linux2.4,$(PLATFORM)))
646 DONT_BUILD_PD_MT =
647 endif
648
649 # Build newtestsuite on i386, x86_64 and ia64 linux
650 #DONT_BUILD_NEWTESTSUITE = true
651 #ifeq (i386-unknown-linux,$(findstring i386-unknown-linux,$(PLATFORM)))
652 #DONT_BUILD_NEWTESTSUITE = false
653 #endif
654 #ifeq (ia64-unknown-linux,$(findstring ia64-unknown-linux,$(PLATFORM)))
655 #DONT_BUILD_NEWTESTSUITE = false
656 #endif
657 #ifeq (x86_64-unknown-linux,$(findstring x86_64-unknown-linux,$(PLATFORM)))
658 #DONT_BUILD_NEWTESTSUITE = false
659 #endif
660 #ifeq (ppc32_linux,$(findstring ppc32_linux,$(PLATFORM)))
661 #DONT_BUILD_NEWTESTSUITE = false
662 #endif
663 #ifeq (sparc-sun-solaris,$(findstring sparc-sun-solaris,$(PLATFORM)))
664 #DONT_BUILD_NEWTESTSUITE = false
665 #endif
666 #ifeq (rs6000-ibm-aix,$(findstring rs6000-ibm-aix,$(PLATFORM)))
667 #DONT_BUILD_NEWTESTSUITE = false
668 #endif
669
670 ifdef USES_MMTIMER
671 CFLAGS             += -Dcap_mmtimer
672 CXXFLAGS           += -Dcap_mmtimer
673 endif
674
675 ifdef USES_TCLTK
676 ifndef TCLTK_DIR
677 $(error error: TCLTK_DIR is not set.  Please set in make.config.local)
678 endif
679 TCLTK_LIB_DIR  ?= $(TCLTK_DIR)/lib
680 TCLTK_INC_DIR  ?= $(TCLTK_DIR)/include
681 endif
682
683 ifdef USES_UNWIND_LIB
684 CFLAGS         += -Dcap_unwind
685 CXXFLAGS       += -Dcap_unwind 
686 LIBUNWIND_LIB  ?= $(LIBUNWINDDIR)/lib
687 LIBUNWIND_INC  ?= $(LIBUNWINDDIR)/include
688 endif
689
690 ifdef USES_DWARF_DEBUG
691 LIBDWARF_INC   ?= $(LIBDWARFDIR)/include
692 LIBDWARF_LIB   ?= $(LIBDWARFDIR)/lib
693 endif
694
695 ifdef USES_LIBELF
696 LIBELF_INC     ?= $(LIBELFDIR)/include
697 LIBELF_LIB     ?= $(LIBELFDIR)/lib
698 endif
699
700 ifdef USES_FLEX
701 ifdef FLEX_DIR
702 WITHLIBFL       = --with-libfldir=$(FLEX_DIR)
703 else
704 WITHLIBFL       =
705 endif
706 endif
707
708 #Build other variables based off of the above defaults
709
710 ifdef USES_TCLTK
711 # use the first set if using tcl8.4,
712 # use the second set if still using tcl8.3
713 ifndef USE_TCL83
714
715 TCLTK_LIBVER_ID = 8.4
716 CFLAGS      += -DTCLCONST=const
717 CXXFLAGS    += -DTCLCONST=const
718 KFLAGS      += -DTCLCONST=const
719 TFLAGS      += -DTCLCONST=const
720
721 else
722
723 TCLTK_LIBVER_ID = 8.3
724 CFLAGS      += -DTCLCONST=""
725 CXXFLAGS    += -DTCLCONST=""
726 KFLAGS      += -DTCLCONST=""
727 TFLAGS      += -DTCLCONST=""
728
729 endif
730
731 TCL_LIB         = -ltcl$(TCLTK_LIBVER_ID)
732 TK_LIB          = -ltk$(TCLTK_LIBVER_ID)
733
734 ifdef LIBTCLTKSTATIC
735 TCLTK_LIBS      += -Wl,-Bstatic $(TCL_LIB) $(TK_LIB) -Wl,-Bdynamic
736 else
737 TCLTK_LIBS      += $(TCL_LIB) $(TK_LIB)
738 endif
739
740 # TCL2C is used to generate compilable sources from tcl files
741 TCL2C           = $(TO_CORE)/../scripts/tcl2c
742 TCL2C_GEN_SRCS  = tcl2c.C
743
744 IFLAGS          += -I$(TCLTK_INC_DIR)
745 ifdef CROSSCOMPILER
746 LIBDIR          += $(patsubst %,-L%/rs_aix41/lib,$(TCLTK_DIR))
747 else
748 LIBDIR      += $(patsubst %,-L%,$(TCLTK_LIB_DIR))
749 endif
750
751 endif # USES_TCLTK
752
753 ifdef USES_PAPI
754 PAPI_INCDIR     = $(PAPI_ROOT)
755 PAPI_LIBDIR     = $(PAPI_ROOT)
756 #PAPI_LIB       = -Wl,-static -lpapi -Wl,-Bdynamic
757 #PAPI_LIB       = $(PAPI_LIBDIR)/libpapi.a
758 PAPI_LIB        = -Wl,-rpath=$(PAPI_LIBDIR) -L$(PAPI_LIBDIR) -lpapi  
759 IFLAGS          += -I$(PAPI_INCDIR)
760 LIBDIR          += $(patsubst %,-L%,$(PAPI_LIBDIR))
761 CFLAGS          += -DPAPI 
762 CXXFLAGS        += -DPAPI
763 TFLAGS          += -DPAPI 
764 endif
765
766 ifdef USES_FLEX
767 FLEX_LIB        = -lfl
768 ifdef FLEX_DIR
769 LIBDIR          += $(patsubst %,-L%,$(FLEX_DIR))
770 VPATH           += $(FLEX_DIR)
771 endif
772 endif
773
774 ifdef CROSSCOMPILER
775 # no /s or /p allowed here
776 #FLEX_DIR       = /s/flex/rs_aix41/lib
777 #LIBDIR         += -L/p/sp2/gcc/lib 
778 endif
779
780 ifdef USES_LIBERTY
781 # Since libiberty.a is in the same g++ directory as libstdc++.a and
782 # libg++.a, no need for a "-L$(LIBERTY_DIR)" entry -at
783 endif
784
785 ifdef USES_X11
786 X11_LIB         = -lX11
787
788 ifeq (solaris,$(findstring solaris,$(PLATFORM)))
789 X11DIR          = /usr/openwin
790 CFLAGS          += -I$(X11DIR)/include
791 CXXFLAGS        += -I$(X11DIR)/include
792 TFLAGS          += -I$(X11DIR)/include
793 LIBDIR          += -R$(X11DIR)/lib -L$(X11DIR)/lib
794 endif
795
796 ifeq (linux,$(findstring linux,$(PLATFORM)))
797 X11DIR          = /usr/X11R6
798 CFLAGS          += -I$(X11DIR)/include/X11
799 CXXFLAGS        += -I$(X11DIR)/include/X11
800 TFLAGS          += -I$(X11DIR)/include/X11
801 LIBDIR          += -L$(X11DIR)/lib
802 endif
803
804 ifeq (x86_64,$(findstring x86_64,$(PLATFORM)))
805 LIBDIR          += -L$(X11DIR)/lib64
806 endif
807 ifeq (ibm-aix,$(findstring ibm-aix,$(PLATFORM)))
808 X11DIR          = /usr
809 endif
810
811 endif # USES_X11