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