Compilation fixes for gcc 3.1, MSVC 6.0 & 7.0
[dyninst.git] / make.config
1 # Paradyn overall build configuration (unix)
2 #
3 # $Id: make.config,v 1.113 2002/06/17 17:04:03 gaburici Exp $
4 #
5
6 SUITE_NAME      = Paradyn
7 RELEASE_NUM     = 3.3
8 #BUILD_MARK     =
9 EXPLICIT_DEPENDS = 1
10 #USE_STL_VECTOR = 1
11 #IBM_BPATCH_COMPAT = 1
12 # Apart from actual "full" releases, don't modify these build Id components.
13 # For personal/experimental builds, feel free to use your core/make.config.local
14 # file to (re-)define BUILD_MARK as you desire.
15
16 # ***** IMPORTANT INSTALLATION/CONFIGURATION INSTRUCTIONS *****
17 # Unless your site is set-up identically to that of the Paradyn/DyninstAPI
18 # developers, you should carefully examine the (GNU)make configuration
19 # parameters defined in this file, particularly utilities such as the C/C++
20 # compilers, perl, flex and bison, and the installed locations and names
21 # for FLEX, TCL/TK, X11 and PVM (which is optional).
22
23 ifdef USES_PVM
24 # (PVM support only potentially relevant for paradynd)
25 # uncomment/comment the following line to build with/without PVM support
26 #INCLUDE_PVM_SUPPORT=true
27 endif
28
29 # most "main" modules are only two levels deep, but we need to be able to
30 # change this for those that are deeper in the tree
31 ifndef TO_CORE
32 TO_CORE         = ../..
33 endif
34
35 # Destinations for library and executable installation (relative to core!)
36 # Warning: modification of the build/install structure is not recommended!
37 LIBRARY_DEST    = ../lib/$(PLATFORM)
38 PROGRAM_DEST    = ../bin/$(PLATFORM)
39
40 # Usually, we look for files, binaries, libs in $(TO_CORE)/....<something>.
41 # But if the file doesn't exist there (i.e. if the user hasn't checked them out
42 # with cvs), then we should look in a backup location.  That's what this vrble
43 # is about.  It's used several times below in this file.
44 BACKUP_CORE = /p/paradyn/core
45
46 AS              = /bin/as
47 CC              = gcc
48 CXX             = g++
49 LEX             = flex
50 RANLIB          = ranlib
51 AR              = ar
52 YFLAGS          = -d -y
53 YACC            = bison
54 MV              = mv
55 CP              = cp
56 RM              = rm -f
57 MKDIR           = mkdir -p
58 PERL            = perl          # NB: perl v5 or higher required!
59
60 # COLLECTOR is only used by purify & quantify
61 COLLECTOR       = /s/gcc-2.7.2/bin/../lib/gcc-lib/$(PLATFORM)/2.7.2/ld
62 # BUILDSTAMP is used to generate local build vouchers
63 BUILDSTAMP      = $(TO_CORE)/../scripts/buildstamp
64
65 ifdef PLATFORM
66 ARCH_DEF        = -D$(shell echo $$PLATFORM | $(PERL) -pe 's/\./_/g;s/-/_/g')
67 else
68 BUILDERROR: PLATFORM must be defined in environment to build (and run) Paradyn
69 endif
70
71 # temporary hack overrides to provide "grand migration illusion"
72 # (these should be removed once definitions in sources are updated)
73 ifeq ($(PLATFORM),mips-sgi-irix6.5)
74 ARCH_DEF        = -Dmips_sgi_irix6_4
75 endif
76 ifeq ($(PLATFORM),i386-unknown-linux2.4)
77 ARCH_DEF        = -Di386_unknown_linux2_0
78 endif
79 ifeq ($(PLATFORM),ia64-unknown-linux2.4)
80 ARCH_DEF        = -Dia64_unknown_linux2_4
81 endif
82 ifeq ($(PLATFORM),sparc-sun-solaris2.7)
83 ARCH_DEF        = -Dsparc_sun_solaris2_4
84 endif
85 ifeq ($(PLATFORM),rs6000-ibm-aix4.3)
86 ARCH_DEF        = -Drs6000_ibm_aix4_1
87 endif
88 ifeq ($(PLATFORM),rs6000-ibm-aix4.2)
89 ARCH_DEF        = -Drs6000_ibm_aix4_1
90 endif
91 # [temporary hack overrides]
92
93 ifdef CROSSCOMPILER
94 AS              = /p/sp2/gcc/bin/rs6000-gcc
95 CC              = /p/sp2/gcc/bin/rs6000-gcc
96 CXX             = /p/sp2/gcc/bin/rs6000-gcc
97 AR              = /p/sp2/gcc/rs6000/bin/ar
98 RANLIB          = /p/sp2/gcc/rs6000/bin/ranlib
99 endif
100
101 ifeq (solaris,$(findstring solaris,$(PLATFORM)))
102 AS              = /usr/ccs/bin/as
103 RANLIB          = true
104 endif
105
106 ifeq (linux,$(findstring linux,$(PLATFORM)))
107 AS              = /usr/bin/as
108 RANLIB          = true 
109 endif
110
111
112 # Default module compiler; modules which want $(CC) should redefine
113 # this, **NOT** CC
114
115 MODCC           = $(CXX)
116 MODCFLAGS       = $(CXXFLAGS)
117
118 .SUFFIXES:      .I
119
120 IFLAGS          = -I. -I$(TO_CORE)
121
122 ASFLAGS         = -P $(ARCH_DEF)
123
124 # uncomment/comment the line below to build with/without compilation warnings
125 # SILENCE_WARNINGS=true
126
127 ifndef SILENCE_WARNINGS
128 BASICWARNINGS   = -W -Wall -Wno-deprecated
129
130 COMMONWARNINGS  = -W -Wall -Wshadow -Wpointer-arith       \
131                 -Wcast-qual            \
132                 -Wconversion        \
133                 -Wmissing-prototypes             \
134                 -Wredundant-decls -Woverloaded-virtual
135
136 # not as strict as above, but can actually be used -- mdc
137 USEFULWARNINGS  = -W -Wall -Wpointer-arith       \
138                 -Wcast-qual            \
139                 -Wconversion        \
140                 -Wmissing-prototypes             \
141                 -Woverloaded-virtual \
142                 -Wno-deprecated
143
144 # being nice to poor old pathetic tcl/tk header files --ari
145 TCLFRIENDLYWARNINGS = -W -Wall -Wpointer-arith \
146                 -Wcast-qual \
147                 -Wconversion \
148                 -Wmissing-prototypes \
149                 -Woverloaded-virtual
150
151 ifeq (solaris,$(findstring solaris,$(PLATFORM)))
152 COMMONWARNINGS       += -Wno-unknown-pragmas
153 USEFULWARNINGS       += -Wno-unknown-pragmas
154 TCLFRIENDLYWARNINGS  += -Wno-unknown-pragmas
155 else   # STL on Solaris with cast-align generates a warning with much output
156 COMMONWARNINGS       += -Wcast-align
157 USEFULWARNINGS       += -Wcast-align
158 endif
159 endif # SILENCE_WARNINGS
160
161
162 ifndef GCC_2_95
163 GCC_VER := $(shell gcc --version)
164 ifneq (,$(findstring 2.95,$(GCC_VER)))
165 GCC_2_95 = true
166 endif
167 endif
168
169 ifndef OLD_GCC
170 GCC_VER := $(shell gcc --version)
171 versionNumbers = $(sort $(GCC_VER), 2.95)
172 versionNumber  = $(firstword $(versionNumbers))
173 ifneq (2.95, $(versionNumber))
174 OLD_GCC = true
175 endif
176 endif
177
178 ifndef OLD_GCC
179 COMMONWARNINGS += -Wno-non-template-friend
180 USEFULWARNINGS += -Wno-non-template-friend
181 TCLFRIENDLYWARNINGS += -Wno-non-template-friend
182 endif
183
184 #don't inline -- for the files that won't emit template code
185 INLINE_DEFINES = 
186
187 #inline the private members of the class -- templates.o can use this
188 TEMP_INLINE_DEFINES = -DDO_INLINE_P="inline"
189
190 # inline everything -- the way things should be
191 ALL_INLINE_DEFINES = -DDO_INLINE_F="inline" -DDO_INLINE_P="inline"
192
193 USES_MT_THREAD =
194
195 ifeq (solaris,$(findstring solaris,$(PLATFORM)))
196 USES_LIBDYNINST_SO = true
197 USES_DYNAMIC_INF_HEAP = true
198 endif
199 ifeq (linux,$(findstring linux,$(PLATFORM)))
200 USES_LIBDYNINST_SO = true
201 USES_DYNAMIC_INF_HEAP = true
202   ifndef IBM_BPATCH_COMPAT
203     DETACH_ON_THE_FLY = true
204   endif
205 endif
206 ifeq (irix,$(findstring irix,$(PLATFORM)))
207 USES_LIBDYNINST_SO = true
208 USES_DYNAMIC_INF_HEAP = true
209 USES_NATIVE_CC = true
210 USE_IRIX_FIXES = true
211 endif
212 ifeq (osf,$(findstring osf,$(PLATFORM)))
213 USES_LIBDYNINST_SO = true
214 USES_DYNAMIC_INF_HEAP = true
215 endif
216 ifeq (rs6000,$(findstring rs6000,$(PLATFORM)))
217 USES_LIBDYNINST_SO = true
218 USES_DYNAMIC_INF_HEAP = true
219 USES_PERF_LIBRARY = true
220 #USES_LIB_TEXT_HEAP = true
221 # Uncomment if you want to use cc to build the RT libraries
222 #USES_NATIVE_CC = true
223 endif
224
225 # if we don't want OPT_FLAG defined for a particular part of the code
226 # (e.g. rtinst for aix), we just need to define NO_OPT_FLAG before doing
227 # the include of make.config - naim
228 #ifndef NO_OPT_FLAG
229 #OPT_FLAG       = -O3
230 #endif
231
232 # flags for normal (non-kludge) files, with common warnings
233 CFLAGS          = $(IFLAGS) $(ARCH_DEF) $(OPT_FLAG) $(COMMON_WARNINGS)
234 CXXFLAGS        = $(IFLAGS) $(ARCH_DEF) $(OPT_FLAG) $(COMMON_WARNINGS)
235
236 # flags for kludge files, won't have warnings generated
237 KFLAGS          = $(IFLAGS) $(ARCH_DEF) $(BASICWARNINGS)
238
239 ifdef USING_PURIFY
240 CFLAGS          += -DPURE_BUILD
241 CXXFLAGS        += -DPURE_BUILD
242 endif
243
244 ifdef USES_MT_THREAD
245 CFLAGS          += -DMT_THREAD
246 CXXFLAGS        += -DMT_THREAD
247 endif
248
249 ifdef USES_PERF_LIBRARY
250 # Add any platform-specific performance libraries here
251 ifeq (rs6000,$(findstring rs6000,$(PLATFORM)))
252 USES_PMAPI = true
253 endif
254 endif
255
256 ifdef USES_DYNAMIC_INF_HEAP
257 CFLAGS          += -DUSES_DYNAMIC_INF_HEAP
258 CXXFLAGS        += -DUSES_DYNAMIC_INF_HEAP
259 endif
260
261 ifdef USE_STL_VECTOR
262 CXXFLAGS        += -DUSE_STL_VECTOR
263 CFLAGS          += -fimplicit-templates
264 CXXFLAGS        += -fimplicit-templates
265 endif
266
267 ifdef IBM_BPATCH_COMPAT
268 CXXFLAGS        += -DIBM_BPATCH_COMPAT
269 CFLAGS          += -DIBM_BPATCH_COMPAT
270 endif
271
272 ifdef DETACH_ON_THE_FLY
273 CFLAGS          += -DDETACH_ON_THE_FLY
274 CXXFLAGS        += -DDETACH_ON_THE_FLY
275 endif
276
277 ifndef OPT_FLAG
278 KFLAGS          += -g
279 ifndef DEBUG_FLAG
280 DEBUG_FLAG = -g
281 endif
282 endif
283
284 ifeq ($(DEBUG_FLAG),none)
285 DEBUG_FLAG =
286 endif
287
288 ifdef DEBUG_FLAG
289 CFLAGS   += $(DEBUG_FLAG)
290 CXXFLAGS += $(DEBUG_FLAG)
291 KFLAGS   += $(DEBUG_FLAG)
292 endif
293
294 # flags for template files, don't define external template flags
295 # -g is optional in this case -- should be defined at module level
296 TFLAGS          = $(IFLAGS) $(TEMP_INLINE_DEFINES) $(ARCH_DEF) $(OPT_FLAG) $(BASICWARNINGS)
297
298 ifdef USES_MT_THREAD
299 TFLAGS          += -DMT_THREAD
300 endif
301
302 ifdef USE_STL_VECTOR
303 TFLAGS          += -DUSE_STL_VECTOR
304 TFLAGS          += -fimplicit-templates
305 endif
306
307 ifdef DETACH_ON_THE_FLY
308 TFLAGS          += -DDETACH_ON_THE_FLY
309 endif
310
311 ifdef USE_IRIX_FIXES
312 CFLAGS          += -DUSE_IRIX_FIXES
313 CXXFLAGS        += -DUSE_IRIX_FIXES
314 endif
315
316 ifdef DO_INLINE_ALL
317 CFLAGS         += $(ALL_INLINE_DEFINES)
318 CXXFLAGS       += $(ALL_INLINE_DEFINES)
319 endif
320
321 # Start off LIBDIR to point to the user's devel area's paradyn lib directory.
322 # As a backup, in case the user hasn't checked out & compiled some paradyn lib,
323 # we stick in (BACKUP_CORE)/lib _second_.
324 LIBDIR          = -L$(TO_CORE)/../lib/$(PLATFORM) \
325                         -L$(BACKUP_CORE)/../lib/$(PLATFORM)
326
327 # Set IGEN to point to $(TO_CORE)/../bin/$(PLATFORM)/igen, if it exists,
328 # else set it to $(BACKUP_CORE)/../bin/$(PLATFORM)/igen, if it exists,
329 # else set it to just "igen" (i.e. assume it's in the user's path)
330 ifdef CROSSCOMPILER
331 IGEN = $(shell if [ -f $(TO_CORE)/../bin/$(BASEPLATFORM)/igen ]; then echo $(TO_CORE)/../bin/$(BASEPLATFORM)/igen; else if [ -f $(BACKUP_CORE)/../bin/$(BASEPLATFORM)/igen ]; then echo $(BACKUP_CORE)/../bin/$(BASEPLATFORM)/igen; else echo igen; fi; fi )
332 else
333 IGEN = $(shell if [ -f $(TO_CORE)/../bin/$(PLATFORM)/igen ]; then echo $(TO_CORE)/../bin/$(PLATFORM)/igen; else if [ -f $(BACKUP_CORE)/../bin/$(PLATFORM)/igen ]; then echo $(BACKUP_CORE)/../bin/$(PLATFORM)/igen; else echo igen; fi; fi )
334 endif
335
336 ifdef NO_IMPLICIT_TEMPLATES
337 ifndef USE_STL_VECTOR
338   CFLAGS                += -fno-implicit-templates
339   CXXFLAGS      += -fno-implicit-templates
340   KFLAGS                += -fno-implicit-templates
341 endif
342 endif
343
344 ifndef INSTANTIATE_TEMPLATES
345 ifndef NO_IMPLICIT_TEMPLATES
346 # -fexternal-templates and -Dexternal_templates should both be used or
347 # neither should be used; add them to CFLAGS, CXXFLAGS, and KFLAGS
348 # (but not to TFLAGS).
349 #
350 CFLAGS          +=  -fexternal-templates -Dexternal_templates
351 CXXFLAGS        +=  -fexternal-templates -Dexternal_templates
352 KFLAGS          +=  -fexternal-templates -Dexternal_templates
353 endif
354 endif
355
356 ifdef INCLUDE_CP_PROFILING
357 INCLUDE_PVM_SUPPORT=true
358 USES_PVM=true
359 endif
360
361 # ***** EXTERNAL SOFTWARE CONFIGURATION *****
362
363 ifdef INCLUDE_PVM_SUPPORT
364 ifndef PVM_ROOT
365 BUILDERROR: PVM_ROOT must be defined in environment to build (and run) Paradyn
366 endif
367 ifndef PVM_ARCH
368 BUILDERROR: PVM_ARCH must be defined in environment to build (and run) Paradyn
369 endif
370 ifdef USES_PVM
371 PVM_INCDIR      = $(PVM_ROOT)/include
372 PVM_LIBDIR      = $(PVM_ROOT)/lib/$(PVM_ARCH)
373 PVM_LIB         = -lpvm3
374 IFLAGS          += -I$(PVM_INCDIR)
375 LIBDIR          += $(patsubst %,-L%,$(PVM_LIBDIR))
376 VPATH           += $(PVM_LIBDIR)
377 endif
378 endif
379
380 ifdef USES_LIBHRTIME
381 HRTIME_ROOT     = /p/paradyn/packages/libhrtime-0.6
382 HRTIME_INCDIR   = $(HRTIME_ROOT)/include
383 HRTIME_LIBDIR   = $(HRTIME_ROOT)/lib
384 HRTIME_LIB      = -Wl,-static -lhrtime -Wl,-Bdynamic
385 IFLAGS          += -I$(HRTIME_INCDIR)
386 LIBDIR          += $(patsubst %,-L%,$(HRTIME_LIBDIR))
387 CFLAGS          += -DHRTIME
388 CXXFLAGS        += -DHRTIME
389 TFLAGS          += -DHRTIME
390 endif
391
392
393 ifdef USES_TCLTK
394
395 TCLTK_DIR       = /p/paradyn/packages/tcl8.3.4
396 TCLTK_INCLUDES  = $(TCLTK_DIR)/include
397 TCLTK_LIBVER_ID = 8.3
398 TCL_LIB         = -ltcl$(TCLTK_LIBVER_ID)
399 TK_LIB          = -ltk$(TCLTK_LIBVER_ID)
400 TCLTK_LIBS      += $(TCL_LIB) $(TK_LIB)
401
402 # TCL2C is used to generate compilable sources from tcl files
403 TCL2C           = $(TO_CORE)/../scripts/tcl2c
404 TCL2C_GEN_SRCS  = tcl2c.C
405
406 IFLAGS          += $(patsubst %,-I%,$(TCLTK_INCLUDES))
407 ifdef CROSSCOMPILER
408 LIBDIR          += $(patsubst %,-L%/rs_aix41/lib,$(TCLTK_DIR))
409 else
410 LIBDIR          += $(patsubst %,-L%/lib,$(TCLTK_DIR))
411 endif
412
413 endif # USES_TCLTK
414
415 ifdef USES_FLEX
416 FLEX_LIB        = -lfl
417 FLEX_DIR        = /s/flex/lib
418 #FLEX_DIR       = /usr/imports/flex-2.5.4a/lib/
419 LIBDIR          += $(patsubst %,-L%,$(FLEX_DIR))
420 VPATH           += $(FLEX_DIR)
421 endif
422
423 ifdef CROSSCOMPILER
424 FLEX_DIR        = /s/flex/rs_aix41/lib
425 LIBDIR          += -L/p/sp2/gcc/lib 
426 endif
427
428 ifdef USES_LIBERTY
429 # Since libiberty.a is in the same g++ directory as libstdc++.a and
430 # libg++.a, no need for a "-L$(LIBERTY_DIR)" entry -at
431 endif
432
433 ifdef USES_X11
434 X11_LIB         = -lX11
435
436 ifeq (solaris,$(findstring solaris,$(PLATFORM)))
437 X11DIR          = /usr/openwin
438 CFLAGS          += -I$(X11DIR)/include
439 CXXFLAGS        += -I$(X11DIR)/include
440 TFLAGS          += -I$(X11DIR)/include
441 LIBDIR          += -R$(X11DIR)/lib -L$(X11DIR)/lib
442 endif
443
444 ifeq (linux,$(findstring linux,$(PLATFORM)))
445 X11DIR          = /usr/X11R6
446 CFLAGS          += -I$(X11DIR)/include/X11
447 CXXFLAGS        += -I$(X11DIR)/include/X11
448 TFLAGS          += -I$(X11DIR)/include/X11
449 LIBDIR          += -L$(X11DIR)/lib
450 endif
451
452 ifeq (aix,$(findstring aix,$(PLATFORM)))
453 X11DIR          = /usr
454 endif
455
456 endif # USES_X11
457
458 THREADSLIB      =
459 #USE_PTHREADS    = no
460
461 ifeq (xyes,x$(USE_PTHREADS))
462 THREADSLIB      += -lpthread
463 endif
464
465 # System build constraints
466 # if not on solaris or aix, then don't build the MT daemon
467 ifeq ($(strip $(join $(findstring sparc-sun-solaris,$(PLATFORM)), $(findstring rs6000-ibm-aix,$(PLATFORM)))),)
468         DONT_BUILD_PD_MT=true;
469 endif
470
471
472 # Include any per-user configuration changes; this "local" config file
473 # should *not* be under CVS control, so that it never gets committed.
474
475 -include $(TO_CORE)/make.config.local
476