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