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