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