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