first check-in of feisty meow codebase. many things broken still due to recent
[feisty_meow.git] / scripts / clam / cpp / variables.def
1 ###############################################################################
2
3 # CLAM System default variable definitions for C++ compilation.
4
5 ###############################################################################
6
7 ifneq "$(BUILD_PARAMETER_FILE)" ""
8   # define our version of the build parameter file.  this should be set
9   # beforehand so we override the default parameter file for clam.
10   export PARAMETER_FILE = $(BUILD_PARAMETER_FILE)
11 endif
12 ifeq "$(PARAMETER_FILE)" ""
13   # last ditch attempt to get one that will work.
14   export PARAMETER_FILE = $(REPOSITORY_DIR)/build.ini
15 endif
16
17 ###############################################################################
18
19 # Pull in the base support for CLAM.
20 include variables.def
21
22 ###############################################################################
23
24 #no # set the repository directory if it's still set to the base version.
25 #ifeq "$(REPOSITORY_DIR)" ""
26 #  ifeq "$(OP_SYSTEM)" "UNIX"
27 #    export REPOSITORY_DIR = $(HOME)/hoople
28 #  endif
29 #  ifeq "$(OP_SYSTEM)" "WIN32"
30 #    export REPOSITORY_DIR = l:
31 #  endif
32 #endif
33
34 #export CLAM_BIN = $(CLAM_DIR)/../bin
35
36 ###############################################################################
37
38 # BASE_CPU is a flag that distinguishes the type of processor, if necessary.
39 export BASE_CPU
40 #BASE_CPU := m68k = motorola 68000 series | m68340 = motorola 68340
41 #    | x86 = intel x86 | ppc = power pc | arm = ARM core
42
43 # set the CPU to a default if it has not been set previously.
44 ifeq "$(BASE_CPU)" ""
45   ifneq "$(OP_SYSTEM)" "WIN32"
46     BASE_CPU := $(shell machine 2>/dev/null || arch 2>/dev/null || echo i686)
47   endif
48   ifeq "$(BASE_CPU)" ""
49 #    BASE_CPU := $(shell uname -m)
50     BASE_CPU := $(shell arch)
51     ifeq "$(BASE_CPU)" ""
52       # failed to get the cpu type.
53       BASE_CPU := x86
54     endif
55   endif
56 endif
57
58 # COMPILER is a flag that specifies the compiler that will be used to build
59 # code.  It is mainly used within CLAM itself for determining the proper
60 # compiler flags.
61 export COMPILER
62 #COMPILER := GNU_LINUX | GNU_ARM_LINUX | GNU_DARWIN | GNU_WIN32 | VISUAL_CPP
63
64 # choose a default compiler if none was specified.
65 ifeq "$(COMPILER)" ""
66   ifeq "$(OP_SYSTEM)" "UNIX"
67     ifeq "$(OS_SUBCLASS)" "darwin"
68       COMPILER := GNU_DARWIN
69     else
70       COMPILER := GNU_LINUX
71     endif
72   endif
73   ifeq "$(OP_SYSTEM)" "WIN32"
74 #    COMPILER := GNU_WIN32
75     COMPILER := VISUAL_CPP
76   endif
77   ifeq "$(COMPILER)" ""
78     # if we get into this case, we have no idea how to set the default
79     # compiler.  you may need to change the above logic for guessing it
80     # anyhow.  but we will go with our favorite default.
81     COMPILER := GNU_LINUX
82   endif
83 endif
84
85 # COMPILER_VERSION specifies the version of a particular compiler, if this is
86 # needed to distinguish how the code is built.
87 export COMPILER_VERSION
88
89 ###############################################################################
90
91 # "TYPE" is the kind of product being generated by this project.  this is
92 # used to decide where to put the final products of compilation.  this is a
93 # variable in the user's makefile.
94 # Valid Types:
95 #     TYPE = library        (outputs are static or dynamic libraries)
96 #     TYPE = application    (outputs are main-line executables)
97 #     TYPE = test           (outputs are test programs)
98 #     TYPE = hierarchy      (there are no outputs; just invokes other makes)
99 export TYPE
100
101 ###############################################################################
102
103 # "DEFINITIONS" is a list of compiler flags that define the value of c macros.
104 # These usually have the format of -D<flag>, but in this variable, only the
105 # <flag> itself should be listed because the compiler option -D is added
106 # automatically.
107 DEFINITIONS += CLAM_BUILT
108   # simple definition that tells the code that clam is building it.
109
110 ifneq "$(BOOT_STRAPPING)" ""
111   # the software is being built from the ground up, including the binaries
112   # we use for building (like value_tagger and others).
113   DEFINITIONS += BOOT_STRAPPING
114 endif
115
116 # "UNDEFINITIONS" is a list of macros to undefine.
117 #UNDEFINITIONS =
118
119 # GLOBAL_PRODUCT_NAME is an important variable for tagging the entire code base
120 # with some branding.  It is provided as a macro definition to all source
121 # files.  The initial value for the macro should come from the build init
122 # file, but if it does not, we pick a default.
123 ifeq "$(product_name)" ""
124   GLOBAL_PRODUCT_NAME := \\\"HOOPLE\\\"
125 else
126   GLOBAL_PRODUCT_NAME := \\\"$(product_name)\\\"
127 endif
128
129 # *_PRODUCT_VERSION records parts of our version numbers for the code to see.
130 DEFINITIONS += MAJOR_PRODUCT_VERSION=$(major) MINOR_PRODUCT_VERSION=$(minor)
131
132 # TEST_MAKEFILE tells the preconditions to check that the files specified
133 # in the makefile are actually present.
134 export TEST_MAKEFILE =
135
136 ###############################################################################
137
138 # pseudo-boolean variable section.  if these have any value at all, then they
139 # are treated as being true.  note that these are flags that should generally
140 # be passed on the command line to a make.  if they are intended to be used
141 # from inside a makefile, then they must appear before this file is included.
142
143 # "REBUILD" causes a rebuild of all source files if it's true.
144 export REBUILD
145
146 # "DEBUG" is used to specify a debugging build.  the default is for this to
147 # be false, which causes a release build.
148 export DEBUG
149
150 # Add in a macro definition if debugging is turned on.  This allows us to
151 # easily eliminate code from release builds.
152 ifneq "$(DEBUG)" ""
153   DEFINITIONS += __DEBUGGING__
154 endif
155
156 # "CONSOLE_MODE" causes the program to be generated as a console application.
157 # this is relevant in systems where programs are otherwise built with graphical
158 # user interfaces.  these are always built statically.
159 #CONSOLE_MODE =
160
161 # "OPTIMIZE" creates optimized code.
162 export OPTIMIZE
163
164 # "NO_COMPILE" just runs through the targets without compiling.
165 export NO_COMPILE
166
167 # "BUILD_LIST_FILE" is the set of files that need to be recompiled for
168 # visual c++.
169 export BUILD_LIST_FILE = $(CLAM_TMP)/clam_rebuild.$(PROJECT)
170
171 # "BUILD_WHACK_FILE" is the set of object files that should be removed if
172 # a build failure occurs.
173 export BUILD_WHACK_FILE = $(CLAM_TMP)/clam_whack.$(PROJECT)
174
175 # we are adding the build list to the flag files so we know it gets cleaned up.
176 FLAG_FILES += $(BUILD_LIST_FILE) $(BUILD_WHACK_FILE)
177
178 ###############################################################################
179
180 # This section implements the HOOPLE directory scheme.  If your scheme differs,
181 # then you'll want to modify these appropriately.
182
183 # "THIRD_PARTY_DIR" is the root of our support libraries.
184 export THIRD_PARTY_DIR
185 ifeq "$(THIRD_PARTY_DIR)" ""
186   export THIRD_PARTY_DIR := $(shell bash -c '\
187     if [ -d "$(REPOSITORY_DIR)/3rdparty" ]; then \
188       echo "$(REPOSITORY_DIR)/3rdparty"; \
189     elif [ -d "$(REPOSITORY_DIR)/libraries/3rdparty" ]; then \
190       echo "$(REPOSITORY_DIR)/libraries/3rdparty"; \
191     else \
192       echo ""; \
193     fi')
194 endif
195
196 # "OUTPUT_ROOT" is the root of all output directories for objects and other
197 # products being built.
198 export OUTPUT_ROOT = $(CLAM_TMP)/objects
199
200 # "PLATFORM_ADD_IN" is an option discriminator for the intended execution
201 # platform.  it should end in an underscore if it is provided.
202 #PLATFORM_ADD_IN = linux_ | w32_
203
204 # "CPU_BUILD_DIR" distinguishes object directories by including the CPU
205 # name and the type of build.
206 ifneq "$(DEBUG)" ""
207   CPU_BUILD_DIR = $(BASE_CPU)_$(PLATFORM_ADD_IN)dbg
208 else
209   CPU_BUILD_DIR = $(BASE_CPU)_$(PLATFORM_ADD_IN)rel
210 endif
211
212 # "BASE_OUTPUT_PATH" is the parent directory of objects for this type of
213 # CPU and this type of build.
214 export BASE_OUTPUT_PATH = $(OUTPUT_ROOT)/$(CPU_BUILD_DIR)
215
216 # special case when doing arm-linux builds
217 ifeq "$(COMPILER)" "GNU_ARM_LINUX"
218   export TARGETS_DIR = $(REPOSITORY_DIR)/$(CPU_BUILD_DIR)
219   # special output directory for firmware doesn't include CPU name because
220   #  the repository already include the CPU name
221   BASE_OUTPUT_PATH = $(OUTPUT_ROOT)
222 endif
223
224 # "OUTPUT_PATH" is the directory to generate all compiled products into.
225 export OUTPUT_PATH = $(BASE_OUTPUT_PATH)/$(PROJECT)
226
227 # "OBJECT_DIR" is where object files will be stored during compilation for the
228 # target type being produced.
229 export OBJECT_DIR = $(OUTPUT_PATH)
230
231 # These specify where files are to be created or located for our local build.
232 export EXECUTABLE_DIR = $(TARGETS_DIR)
233 export DYNAMIC_LIBRARY_DIR = $(TARGETS_DIR)
234 export STATIC_LIBRARY_DIR = $(TARGETS_DIR)
235 #export TESTS_DIR = $(TARGETS_DIR)/tests
236
237 # "HEADER_SEARCH_PATH" is where the class interface files are to be found.
238 #HEADER_SEARCH_PATH =
239
240 # "HOOPLE_HEADERS" are locations where the HOOPLE headers can be found.
241 ifeq "$(HOOPLE_HEADERS)" ""
242 #seems like some of this is redundant with earlier 3rdparty exploring.
243   LOCUS_LIBRARY_HEADERS = $(shell bash -c '\
244     if [ -d "$(REPOSITORY_DIR)/core" ]; then \
245       echo "$(REPOSITORY_DIR)/core" "$(REPOSITORY_DIR)/octopi" "$(REPOSITORY_DIR)/graphiq" ; \
246     else \
247       echo ""; \
248     fi | sed -e "s/\([a-zA-Z]\):\/\(.*\)/\/\1\/\2/" ')
249   HOOPLE_HEADERS := $(shell $(FIND) $(LOCUS_LIBRARY_HEADERS) -mindepth 1 -maxdepth 1 -type d )
250 endif
251
252 # "LOCAL_HEADERS" are overrides that go first in the header search path.
253 LOCAL_HEADERS = $(THIRD_PARTY_DIR)
254
255 # "CODEBASE_HEADERS" is a list that can be changed for a particular codebase.
256 # it is guaranteed that clam will not interfere with this list, whereas
257 # the LOCAL_HEADERS can be modified by clam.
258 #CODEBASE_HEADERS =
259
260 # "LOCAL_LIBRARIES" are overrides that go first in the library search path.
261 #LOCAL_LIBRARIES =
262
263 # "LIBRARY_SEARCH_PATH" is where the library files are to be found.
264 #LIBRARY_SEARCH_PATH =
265
266 # "HOOPLE_LIBRARIES" is where our local libraries are located.
267 HOOPLE_LIBRARIES =
268
269 # "EXTRA_COPIES" is a list of files that need to be among the files copied
270 # to a project's output folder.
271 export EXTRA_COPIES
272
273 # "EXTRA_VERSIONS" is a list of version files to synchronize with the main
274 # library version for this build.  if a file called "version.ini" exists in
275 # the project directory, then it will automatically be upgraded, so the
276 # extra version files are mainly useful when you have a project with multiple
277 # programs in it and you want them to have independent version files (as you
278 # should perhaps want).
279 export EXTRA_VERSIONS
280
281 # "DEPS_FILE" is where the auto-dependency information is stored.
282 export DEPS_FILE = $(OUTPUT_PATH)/$(PROJECT).deps
283
284 # "NO_DEPS" is an exclusion flag.  if it is defined, then no auto-dependency
285 # files will be generated.  this is useful if you're missing makedep or trying
286 # to compile it...
287 #NO_DEPS = t
288
289 # "OMIT_VERSIONS" is another exclusion flag.  this one turns off the creation
290 # of version resource files and eliminates any references that would include
291 # such files.  this is needed when rebuilding version_stamper.
292 #OMIT_VERSIONS = t
293
294 # Add the obligatory junk to be cleaned up.  Individual compiler sections
295 # should customize this by adding their object output directories.
296 CLEANUPS += $(ACTUAL_TARGETS) $(OUTPUT_PATH)
297
298 # "GENDEPS" is a flag that causes dependencies to be generated into
299 # statically built applications.
300 export GENDEPS
301
302 ###############################################################################
303
304 # "SEARCH_DIRS" is a list of directories that should be searched for both C++
305 # header files and for C++ code libraries.  The items placed in SEARCH_DIRS
306 # are fed into both the LIBRARY_SEARCH_PATH and the HEADER_SEARCH_PATH.
307 #SEARCH_DIRS =
308
309 # "DEPENDENCY_DEFINITIONS" is a list of extra definitions that only get passed
310 # to the makedep tool.  this can vary for each compiler.
311 #DEPENDENCY_DEFINITIONS =
312
313 # "DEPENDENCY_ADDITIONS" is a set of parameters passed directly to makedep.
314 #DEPENDENCY_ADDITIONS =
315
316 # "DEBUG_FLAGS" these flags are used for generating specialized versions of
317 # object files, such as ones that include debugging code or that add code for
318 # profiling.
319 # Possible values are -g for adding GDB debugging code and -pg for adding
320 # gprof profiling code.
321 #DEBUG_FLAGS = -g
322 #DEBUG_FLAGS = -pg
323 #DEBUG_FLAGS =
324
325 # "COMPILER_FLAGS" are the flags for the pre-processor and compiler.
326 #COMPILER_FLAGS =
327
328 # "STRICT_WARNINGS" turns on all warnings and forces them to be considered
329 # as errors when encountered.
330 #STRICT_WARNINGS = 
331
332 # "LIBRARIAN_FLAGS" are flags that need to be passed to the library tool
333 # that creates static code libraries.
334 #LIBRARIAN_FLAGS =
335
336 # "SOURCE" is the list of files that are turned into objects.
337 #SOURCE=
338
339 # "OBJECTS" are the files to be created by compilation and added to any
340 # libraries or executables that are made.
341 #OBJECTS =
342
343 # "EXTRA_OBJECTS" are files that are created elsewhere but need to be bound
344 # into the target.
345 #EXTRA_OBJECTS =
346
347 # "LIBS_USED" are system or compiler code libraries that the targets to be
348 # created depend upon.
349 LIBS_USED =
350
351 # "LOCAL_LIBS_USED" is very similar to the LIBS_USED, but these libraries
352 # actually cause executables and object files to be recompiled when the
353 # libraries specified have changed.  To accomplish this, these libraries MUST
354 # be located in the STATIC_LIBRARY_DIR rather than at some arbitrary place
355 # on the LIBRARY_SEARCH_PATH.
356 #LOCAL_LIBS_USED=
357
358 # Load flags tell the linker and loader how to deal with the files and where
359 # to locate library components.  The prefix goes before object files are
360 # listed, and the suffix after.  The prefix should have things like the
361 # directories to be searched for code libraries (although they should be added
362 # to LIBRARY_SEARCH_PATH) and the loading mode for functions (static/dynamic).
363 # In the suffix, actual library loading statements (like -lmath) can be
364 # included (although they should be listed in a different form in LIBS_USED).
365 # Remember that the unix loader looks for functions in libraries in a bizarre
366 # way: ld searches for a function only when it has already been asked for it.
367 # This means that it doesn't remember what functions it has already been
368 # provided with in the libraries and object files, and it will fail if those
369 # functions are only asked for after they have already been encountered.
370 #LOAD_FLAG_PREFIX =
371 #LOAD_FLAG_SUFFIX =
372
373 # The prefix used on library names, mostly for unix.
374 export LIB_PREFIX
375 # The standard suffix for static or import libraries on this operating system.
376 export LIB_ENDING
377
378 # The dynamic library ending differs between platforms.
379 export DYNLIB_ENDING
380
381 # Flag for specifying the library name to create.
382 #CREATE_LIBRARY_FLAG =
383
384 # Flag for specifying a library to include in linking.
385 LIBRARY_NAME_FLAG = -l
386
387 # Flag for specifying the name of an object file to include in a library or exe.
388 OBJECT_NAME_FLAG = -o
389
390 # Flag for specifying a directory to add to the search path for libs.
391 LIBRARY_PATH_FLAG = -L
392
393 # Flag for specifying the name of an output from the linker.
394 #LINKER_OUTPUT_FLAG =
395
396 # Flag for separating linker options from compilation options for a combined
397 # compiler / linker.
398 #LINKER_OPTION_SEPARATOR =
399
400 # Flag that passes special options when building executable programs.  It is
401 # passed just before the LOAD_FLAG_PREFIX.
402 #EXE_FLAGS = 
403
404 # The name of the compiler tool.
405 #CC =
406
407 # The name of the library creator tool.
408 #LIBRARY_TOOL =
409
410 # the root name of the version file.  This is currently irrelevant on
411 # non-win32 platforms.
412 VERSION_RC_ROOT = $(shell $(SHELL) $(CLAM_DIR)/cpp/rc_name.sh)
413
414 ifneq "$(CONSOLE_MODE)" ""
415   # this definition can be used to signal different behavior when the app is
416   # being built for console mode.  that generally implies that it should send
417   # debugging info to standard out and avoid doing much with graphics.
418   DEFINITIONS += CONSOLE_MODE
419 endif
420
421 ###############################################################################
422
423 # Operating system dependent flags.
424
425 ifeq "$(OP_SYSTEM)" "UNIX"
426   LIB_ENDING = .a
427   DYNLIB_ENDING = .so
428 endif
429 ifeq "$(OP_SYSTEM)" "WIN32"
430   LIB_ENDING = .lib
431   DYNLIB_ENDING = .dll
432 endif
433
434 ###############################################################################
435
436 # Compiler Dependent Flags
437 #
438 # "COMPILER_ROOT_DIR" is the top-level for the C++ compiler location.
439 export COMPILER_ROOT_DIR
440 # "COMPILER_HEADER_DIR" is where the compiler's headers are.
441 export COMPILER_HEADER_DIR
442 # "COMPILER_LIBRARY_DIR" is where archived libraries are.
443 # "CC" is the name of the C++ compiler to be used.
444
445 # These flags may be useful across multiple compilers.
446 #
447 # SSL brings in the openSSL libraries.
448 USE_SSL=
449
450 # CURL provides access to the curl library.
451 USE_CURL=
452
453 # Enables wxwidget library support.
454 USE_WXWIDGETS=
455
456 ifneq "$(OMIT_VERSIONS)" ""
457   DEFINITIONS += NO_VERSION
458 endif
459
460 ifeq "$(COMPILER)" "GNU_LINUX"
461   # Unix GNU compiler...
462   CC = g++
463   COMPILER_ROOT_DIR = /
464   PLATFORM_ADD_IN = linux_
465   ARCHITECTURE = $(shell machine 2>/dev/null || arch 2>/dev/null || echo i686)
466
467   export COMPILER_VERSION = $(shell $(SHELL) $(CLAM_DIR)/cpp/get_version.sh $(COMPILER) $(COMPILER_ROOT_DIR) )
468
469   DEFINITIONS += _FILE_OFFSET_BITS=64 
470
471   DEPENDENCY_DEFINITIONS += NO_VERSION
472   DEPENDENCY_ADDITIONS = -X/usr/include -X/usr/include/c++/$(COMPILER_VERSION) -X/usr/include/c++/$(COMPILER_VERSION)/tr1 -X/usr/local/include -X/usr/include/linux -X/usr/include/wx-2.8 -X/usr/lib/gcc/i586-suse-linux/$(COMPILER_VERSION)/include -X/usr/lib/gcc/i486-linux-gnu/$(COMPILER_VERSION)/include -X/usr/lib/gcc/i686-linux-gnu/$(COMPILER_VERSION)/include
473
474 #protect other additions to make them only for debian?
475 #  COMPILER_HEADER_DIR := /usr/include /usr/local/include 
476
477   # "USE_XWIN" specifies that this project needs X window system support.
478   #USE_XWIN =
479
480   ifeq "x86_64" "$(ARCHITECTURE)"
481     COMPILER_LIBRARY_DIR = /lib64 /usr/lib64 /usr/local/lib64
482   else
483     COMPILER_LIBRARY_DIR = /lib /usr/lib /usr/local/lib
484   endif
485   DEFINITIONS += __LINUX__ linux __linux__ UNIX unix __UNIX__ __USE_GNU 
486   # X Window System not enabled by default.
487   #DEFINITIONS += __XWINDOWS__ 
488
489   LIBRARY_TOOL = ar
490   LIB_PREFIX = lib
491   LOAD_FLAG_PREFIX += -Xlinker -O3 
492     # -Xlinker --print-map : shows what went in and why.
493     # -Xlinker -O3 : linker optimization
494
495   CREATE_LIBRARY_FLAG += -r 
496     # space on end is significant.
497   LINKER_OUTPUT_FLAG = -o 
498   LINK_TOOL = g++
499   # compiler flags for gcc:
500   # -finline-functions: inline functions as needed.
501   # -fPIC: generate position independent code.
502   # -fpic: generate position independent code, but less portable.
503   # -frepo: automatic template instantiation at link time, no implicit ones.
504   # -ffunction-sections: put each function in own section, improving linking.
505   # -fdata-sections: put data in own section, improving linking.
506   # -shared-libgcc: use the shared library version of compiler libraries.
507   # -fno-exceptions: do not support exception handling and stack unwinding.
508
509   COMPILER_FLAGS += -shared-libgcc -fPIC  
510
511   ifeq "$(DEBUG)" ""
512 #    COMPILER_FLAGS += -finline-functions 
513   endif
514   ifneq "$(STRICT_WARNINGS)" ""
515     COMPILER_FLAGS += -Wall -Werror -Wextra -Wno-long-long
516   endif
517
518   ifeq "$(CONSOLE_MODE)" ""
519     LIBS_USED += dl 
520      # dl=dynamic library.
521   endif
522
523   LIBS_USED += pthread rt 
524      # pthread=thread libraries.
525      # rt=real time libraries for shared memory.
526
527   ifneq "$(DEBUG)" ""
528     # add in debugging flags.
529     COMPILER_FLAGS += -g3 -O0
530
531 ##LOAD_FLAG_PREFIX += -lefence
532 #electric fence
533
534 ###COMPILER_FLAGS += -pg
535 ###LOAD_FLAG_PREFIX += -pg
536 ####trying out profiling: doesn't work so well yet.  generates gmon.out files
537 ####  in pretty random places.  the parameters to the linker don't even
538 ####  mention this flag, and the compiler flags don't seem to provide an
539 ####  option for where the file goes.  so, it's on hold.
540
541   endif
542
543 endif
544
545 ifeq "$(COMPILER)" "GNU_ARM_LINUX"
546   # ARM-linux GNU compiler...
547   COMPILER_ROOT_DIR = /usr/local/arm-linux
548   CC = $(COMPILER_ROOT_DIR)/bin/g++
549   PLATFORM_ADD_IN = linux_
550
551   export COMPILER_VERSION = $(shell $(SHELL) $(CLAM_DIR)/cpp/get_version.sh $(COMPILER) $(COMPILER_ROOT_DIR) )
552
553   SNAPGEAR_ROOT_DIR = $(HOME)/snapgear
554
555   DEPENDENCY_DEFINITIONS += NO_VERSION
556
557   COMPILER_HEADER_DIR = $(SNAPGEAR_ROOT_DIR)/linux-2.4.x/include
558 #  COMPILER_HEADER_DIR += $(SNAPGEAR_ROOT_DIR)/include 
559   COMPILER_HEADER_DIR += $(COMPILER_ROOT_DIR)/include $(COMPILER_ROOT_DIR)/lib 
560   COMPILER_HEADER_DIR += /usr/local/lib/gcc-lib/arm-linux/3.3.2/include
561   
562   COMPILER_LIBRARY_DIR = $(SNAPGEAR_ROOT_DIR)/lib $(COMPILER_ROOT_DIR)/lib/be
563
564   DEFINITIONS += linux __linux__ unix UNIX __UNIX__ __LINUX__ 
565
566   COMPILER_FLAGS += -mbig-endian -finline-functions -ffunction-sections -fPIC -nostdinc -nostdinc++ 
567   ifneq "$(STRICT_WARNINGS)" ""
568     COMPILER_FLAGS += -Wall -Werror
569   endif
570
571   LIBRARY_TOOL = $(COMPILER_ROOT_DIR)/bin/ar
572   LIB_PREFIX = lib
573   CREATE_LIBRARY_FLAG += -r 
574     # space on end is significant.
575   
576   LINK_TOOL = $(COMPILER_ROOT_DIR)/bin/g++
577   LINKER_OUTPUT_FLAG = -o
578   EXE_FLAGS = -mbig-endian
579   LOAD_FLAG_PREFIX += -v -mbig-endian
580
581   LIBS_USED += pthread dl
582
583   ifneq "$(DEBUG)" ""
584     COMPILER_FLAGS += -g3 -O0
585   endif
586
587 endif
588
589 ifeq "$(COMPILER)" "GNU_WIN32"
590   # GNU compiler for MS Windoze...
591   CC = g++
592   ifeq "$(COMPILER_ROOT_DIR)" ""
593     COMPILER_ROOT_DIR = c:/system/mingw
594   endif
595
596   export COMPILER_VERSION = $(shell $(SHELL) $(CLAM_DIR)/cpp/get_version.sh $(COMPILER) $(COMPILER_ROOT_DIR) )
597
598   RC := $(COMPILER_ROOT_DIR)/bin/windres
599   PLATFORM_ADD_IN = w32_
600
601   COMPILER_HEADER_DIR = $(COMPILER_ROOT_DIR)/include $(COMPILER_ROOT_DIR)/include/c++/3.4.2 $(COMPILER_ROOT_DIR)/lib/gcc/mingw32/3.4.2/include 
602 ###$(COMPILER_ROOT_DIR)/usr/include/mingw $(COMPILER_ROOT_DIR)/usr/include $(COMPILER_ROOT_DIR)/usr/include/w32api $(COMPILER_ROOT_DIR)/usr/include/extras
603
604   COMPILER_LIBRARY_DIR = $(COMPILER_ROOT_DIR)/lib
605   DEFINITIONS += _Windows _WINDOWS WIN32 __WIN32__ __FLAT__ VC_EXTRALEAN WIN32_LEAN_AND_MEAN ATL_NO_LEAN_AND_MEAN _WIN32 __cplusplus 
606 #__USE_GNU 
607
608   LIBRARY_TOOL = ar
609 #  LOAD_FLAG_PREFIX += -lpthread
610   LOAD_FLAG_PREFIX += -mwindows
611   CREATE_LIBRARY_FLAG += -r 
612     # space on end is significant.
613   LINKER_OUTPUT_FLAG = -o
614   LINK_TOOL = g++
615   MIDL = midl -Oicf $(MIDL_DEFS) $(HEADER_SEARCH_PATH:%=-I% ) $(DEFINITIONS:%=-D% )
616   MIDL_DEFS = -no_robust
617   # some lovely definitions used by some of the mfc and other ms code.
618   DEPENDENCY_DEFINITIONS += __cplusplus __MINGW32__ _WIN32 _CHAR_UNSIGNED M_I86 _M_I86 _M_IX86=500 _WIN32_WINNT=0x501 __RPC_WIN32__ __RPCNDR_H_VERSION__ __RPCPROXY_H_VERSION__ TARGET_IS_NT40_OR_LATER PGM_SETCHILD _MFC_VER=0x0600
619 endif
620
621 ifeq "$(COMPILER)" "VISUAL_CPP"
622   # microsoft visual c++ 4.x, 5.x or 6.x.
623
624   PLATFORM_ADD_IN = w32_
625
626   TRIPART_VERSION =
627
628   CLEANUPS += $(PDB_DIR)/$(PROJECT)_bookkeeping.pdb 
629 #hmmm: import libs for dynamic libraries on ms-win32 don't currently get
630 #      cleaned up nicely.
631
632   # ensure that any setting for this is seen by sub-shells.
633   export WIN32_MANIFEST_FILE
634
635   # these define special characteristics for a program being built.
636   #   BASE is almost always defined and pulls in fundamental w32 support.
637   #   RPC supplies the remote procedure call libraries.
638   #   SECURITY links with the w32 security APIs.
639   #   CLR sets options that are appropriate for managed code.
640   VCPP_USE_BASE=true
641   VCPP_USE_RPC=
642   VCPP_USE_OLE=
643   VCPP_USE_SECURITY=
644   VCPP_USE_CLR=
645   VCPP_VISTA_ICON=
646
647   # the framework dir points at the .net framework to be used for compilation.
648   ifeq "$(FRAMEWORK_VERSION)" ""
649
650     # older .net 1.1.
651 #    SHORT_FRAMEWORK_VERSION = 1.1
652 #    FRAMEWORK_VERSION = $(SHORT_FRAMEWORK_VERSION).4322
653
654     # current .net 2.0.
655     SHORT_FRAMEWORK_VERSION = 2.0
656     FRAMEWORK_VERSION = $(SHORT_FRAMEWORK_VERSION).50727
657   endif
658   ifeq "$(FRAMEWORK_DIR)" ""
659     FRAMEWORK_DIR = $(subst \,/,$(WINDIR))/Microsoft.NET/Framework/v$(FRAMEWORK_VERSION)
660   endif
661
662   # calculate the visual studio root directory.
663   ifeq "$(VIS_STU_ROOT)" ""
664     export VIS_STU_ROOT := $(shell $(SHELL) $(CLAM_DIR)/cpp/ms_root_dir.sh )
665   endif
666   ifneq "$(VIS_STU_ROOT)" ""
667     export COMPILER_ROOT_DIR = $(VIS_STU_ROOT)/vc
668   endif
669   ifeq "$(COMPILER_ROOT_DIR)" ""
670     HOSEUP = $(shell echo The compiler directory is not set.  Please define the environment variable)
671     HOSEUP = $(shell echo VSxCOMNTOOLS (x=80, 90 or 100) to point at the folder where visual )
672     HOSEUP = $(shell echo Studio is installed.)
673     HOSEUP =
674   endif
675
676   # redo the compiler version with our new info.
677   export COMPILER_VERSION := $(shell $(SHELL) $(CLAM_DIR)/cpp/get_version.sh $(COMPILER) $(COMPILER_ROOT_DIR) )
678
679   # set up a directory for debugging files to be stored.  these are not
680   # moved with the postconditions--they are generated in place.
681   export PDB_DIR = $(TARGETS_DIR)
682
683   # set these way up here so we can override them later.
684   CC = $(COMPILER_ROOT_DIR)/bin/cl
685   LINK_TOOL = $(COMPILER_ROOT_DIR)/bin/link
686
687   # This is needed to protect against the use of 64-bit time_t structure
688   # on windows.  We are casting to time_t from a 32-bit structure.
689   DEFINITIONS += _USE_32BIT_TIME_T
690
691   # vary the locations for compiler files based on the version.
692   ifeq "$(COMPILER_VERSION)" "6"
693     COMPILER_HEADER_DIR = $(COMPILER_ROOT_DIR)/include $(COMPILER_ROOT_DIR)/atl/include
694     COMPILER_LIBRARY_DIR = $(COMPILER_ROOT_DIR)/lib $(COMPILER_ROOT_DIR)/atl/lib
695     RC = $(COMPILER_ROOT_DIR)/../common/msdev98/bin/rc
696   endif
697   ifeq "$(COMPILER_VERSION)" "7"
698     COMPILER_HEADER_DIR = $(COMPILER_ROOT_DIR)/include $(COMPILER_ROOT_DIR)/atlmfc/include $(COMPILER_ROOT_DIR)/platformsdk/include $(FRAMEWORK_DIR)
699     COMPILER_LIBRARY_DIR = $(COMPILER_ROOT_DIR)/lib $(COMPILER_ROOT_DIR)/atlmfc/lib $(COMPILER_ROOT_DIR)/platformsdk/lib
700     RC = $(COMPILER_ROOT_DIR)/bin/rc
701     COMPILER_FLAGS += -Zc:forScope
702       # turn on proper loop scoping.
703   endif
704   ifeq "$(COMPILER_VERSION)" "8"
705     COMPILER_HEADER_DIR = $(COMPILER_ROOT_DIR)/include $(COMPILER_ROOT_DIR)/atlmfc/include $(COMPILER_ROOT_DIR)/platformsdk/include $(FRAMEWORK_DIR)
706     COMPILER_LIBRARY_DIR = $(COMPILER_ROOT_DIR)/lib $(COMPILER_ROOT_DIR)/atlmfc/lib $(COMPILER_ROOT_DIR)/platformsdk/lib
707     RC = $(COMPILER_ROOT_DIR)/bin/rc
708     COMPILER_FLAGS += -Zc:forScope
709       # turn on proper loop scoping.
710     DEFINITIONS += _WIN32_WINNT=0x501 
711     DEPENDENCY_DEFINITIONS += _WIN32_WINNT=0x501 
712   endif
713 #
714 # ver 9 (vis stu 2008) is not in here but is probably similar to 8 or 10.
715 #
716   ifeq "$(COMPILER_VERSION)" "10"
717     export PLATYPUS = $(WindowsSdkDir)
718     COMPILER_HEADER_DIR = $(COMPILER_ROOT_DIR)/include $(COMPILER_ROOT_DIR)/atlmfc/include $(PLATYPUS)/include
719 ## $(FRAMEWORK_DIR)
720     COMPILER_LIBRARY_DIR = $(COMPILER_ROOT_DIR)/lib $(COMPILER_ROOT_DIR)/atlmfc/lib $(PLATYPUS)/lib
721     DEFINITIONS += _WIN32_WINNT=0x501 
722     DEPENDENCY_DEFINITIONS += _WIN32_WINNT=0x501 
723     RC = $(PLATYPUS)/bin/rc
724     COMPILER_FLAGS += -Zc:forScope
725       # turn on proper loop scoping.
726   endif
727   ifeq "$(COMPILER_HEADER_DIR)" ""
728     HOSEUP = $(shell echo The compiler version is not set.  Please define COMPILER_VERSION.)
729   endif
730   ifeq "$(COMPILER_HEADER_DIR)" ""
731     HOSEUP = $(shell echo The compiler version is not set.  Please define COMPILER_VERSION.)
732   endif
733   ifeq "$(COMPILER_HEADER_DIR)" "0"
734     HOSEUP = $(shell echo The compiler version is not set.  Please define COMPILER_VERSION.)
735   endif
736
737   # add in the mfc directories.
738   COMPILER_HEADER_DIR += $(COMPILER_ROOT_DIR)/mfc/include
739   COMPILER_LIBRARY_DIR += $(COMPILER_ROOT_DIR)/mfc/lib
740
741   DEFINITIONS += _Windows _WINDOWS WIN32 __WIN32__ __FLAT__ VC_EXTRALEAN WIN32_LEAN_AND_MEAN ATL_NO_LEAN_AND_MEAN 
742   DEF_FILE =
743   LIBRARY_TOOL = $(COMPILER_ROOT_DIR)/bin/lib
744   LOAD_FLAG_PREFIX = -subsystem:windows -machine:X86 -nologo
745   LOAD_FLAG_SUFFIX =
746
747   MIDL = "$(COMPILER_ROOT_DIR)/../Common7/Tools/Bin"/midl.exe -Oicf $(MIDL_DEFS) $(HEADER_SEARCH_PATH:%=-I% ) $(DEFINITIONS:%=-D% )
748   MIDL_DEFS = -no_robust
749
750   # additional definitions that get put on the command line for makedep.  these
751   # are needed since visual c++ defines them automatically.
752   DEPENDENCY_DEFINITIONS += __cplusplus _WIN32 _CHAR_UNSIGNED M_I86 _M_I86 _MSC_VER=1200 _M_IX86=500 __RPC_WIN32__ __RPCNDR_H_VERSION__ __RPCPROXY_H_VERSION__ TARGET_IS_NT40_OR_LATER PGM_SETCHILD _MFC_VER=0x0600
753
754   # set the flags used by visual c++.
755   CREATE_LIBRARY_FLAG = -out:
756   LIBRARY_NAME_FLAG =
757   LIBRARY_PATH_FLAG = -libpath:
758   LINKER_OPTION_SEPARATOR = -link
759   LINKER_OUTPUT_FLAG = -out:
760   OBJECT_NAME_FLAG = -Fo
761
762   # Add the extra files created by visual c++.
763 #is this needed now that we whack whole output path?  CLEANUPS += $(OUTPUT_PATH)/*.*db
764
765   # compilation parameters for microsoft.
766   #   -c specifies compilation without linking.
767   #   -EHsc is the flag for turning on exception handling.
768   #   -FD is for getting the best dependency checking in visual studio.
769   #   -Fd[filename] names the program database (PDB) file used for debugging.
770   #   -Fp[filename] names the precompiled header file name.
771   #   -FR[filename] names the browser output path used for source analysis.
772   #   -Gd calling convention is cdecl.
773   #   -Gm enables minimal rebuild (only if source files changed).
774   #       Note!  as of Visual Studio 6 SP 3, minimal rebuild does not work
775   #       properly.  Do not use it unless you want inconsistent builds!
776   #   -GR enables run-time type identification (RTTI).
777   #   -GS enables buffer checking.
778   #   -GX turns on synchronous exception handling. (deprecated)
779   #   -Gz uses __stdcall calling convention.
780   #   -MD specifies multi-threaded DLL (MDd means debug).
781   #   -ML signifies uni-threaded executable (MLd means debug).
782   #   -MT indicates multi-threaded executable (MTd means debug)
783   #   -O is for optimization (1 small code, 2 fast code, d disabled).
784   #     don't use 1 or 2 though; they both include "global optimization",
785   #     which seems plagued with problems.  the specific optimizations are:
786   #       -Oa  assume no aliasing
787   #       -Obn  inline function expansion, where n is 1 (enable) or 0 (disable)
788   #       -Od  disable (for debug)
789   #       -Oi  generate intrinsic functions
790   #       -Og  global optimizations (flawed)
791   #       -Op  improve float consistency
792   #       -Os  favor small code
793   #       -Ot  favor fast code
794   #       -Ow  assume aliasing across function calls
795   #       -Ox  full optimization
796   #       -Oy  frame pointer optimization
797   #     -O1 has g s y b1 Gs Gf Gy
798   #     -O2 has g i t y b1 Gs Gf Gy
799   #   -TP C++ compilation.
800   #   -W sets the warning level (from 0 (least warnings) through 4 (loudest)).
801   #       -WX turns all warnings into errors.
802   #   -Yu[filename] uses a precompiled header file.
803   #   -YX turns on precompiled headers.  not used due to poor implementation.
804   #   -Zi generates debugging information into the PDB file.
805
806   # put the common flags into the compiler flags.
807   COMPILER_FLAGS += -nologo -Fd$(PDB_DIR)/$(PROJECT)_bookkeeping.pdb -GR -W3 -Zi -EHsc -GS -Gd 
808 #-Wp64 
809
810   ifneq "$(DEBUG)" ""
811     # disable function inlining and optimizations for debug.
812     COMPILER_FLAGS += -Ob0 -Od
813   else
814     # enable function inlining for release only.
815     COMPILER_FLAGS += -Ob1
816
817     ifneq "$(OPTIMIZE)" ""
818       # add in fast code optimization.
819       COMPILER_FLAGS += -O2
820     else
821       # no optimizations.
822     endif
823
824   endif
825
826   # linking parameters for microsoft.
827   #   -dll specifies that a dynamic library is to be created.
828   #   -debug specifies that debugging information is to be included.
829   #   -map turns on the map file.
830   #   -warn sets the warning level, from 0 to 3, where 3 is the most verbose.
831   #   kernel32.lib is the kernel support.
832   #   user32.lib is the user level support.
833   #   gdi32.lib is the graphical device interface? support.
834   #   winspool.lib contains printer support.
835   #   comdlg32.lib provides the common dialogs.
836   #   advapi32.lib provides deeper win32 features, like registry, services, etc.
837   #   shell32.lib is ?
838   #   ole32.lib supplies OLE support.
839   #   oleaut32.lib is the OLE automation library.
840   #   uuid.lib has unique id management?
841   #   odbc32.lib provides ODBC data source functionality.
842   #   odbccp32.lib is something?
843   #   winmm.lib has the win32 multimedia support.
844   #   version.lib offers up splendid version services.
845
846   # check if profiling is to be enabled.
847   PROFILER_FLAG =
848   ifneq "$(PROFILE)" ""
849     PROFILER_FLAG = -profile
850   endif
851
852   LIBS_USED += htmlhelp.lib
853
854   # add the common linker flags.  the debugging flag is added because we
855   # want to be able to debug into release code, but since the pdb files
856   # are separate, we're not exposing ourselves when we don't include them.
857   LOAD_FLAG_PREFIX += $(PROFILER_FLAG) -debug -opt:ref -opt:icf 
858 #-warn:3
859
860   # "USE_MFC" dictates whether mfc should be allowed in the application.
861   # the default is not to use MFC extension style dlls.  this can be turned
862   # on in the individual makefiles that require MFC.
863   #USE_MFC =
864
865   # the library creator gets a couple of flags.
866   LIBRARIAN_FLAGS += -nologo -machine:X86 -subsystem:windows
867
868   # now, vary the flag configuration based on the flags that have been set.
869
870   ifneq "$(CONSOLE_MODE)" ""
871     # console type of applications are built using the static flag so that
872     # they are more redistributable.
873     DEFINITIONS += _CONSOLE
874     LOAD_FLAG_SUFFIX += -subsystem:console
875     LIBRARIAN_FLAGS += -subsystem:console
876   endif
877
878   # dynamically linked library or application flags.
879   ifneq "$(DEBUG)" ""
880     # debug.
881     DEFINITIONS += _DEBUG
882     COMPILER_FLAGS += -MDd
883   else
884     # release.
885     DEFINITIONS += NDEBUG
886     COMPILER_FLAGS += -MD
887     LOAD_FLAG_PREFIX += -map
888   endif
889
890   ifneq "$(STRICT_WARNINGS)" ""
891     COMPILER_FLAGS += -WX
892 #would like to add W4 but that triggers warnings in ms's own headers.
893   endif
894
895 endif
896
897 ifeq "$(COMPILER)" "GNU_DARWIN"
898   # Darwin kernel GNU compiler...
899   CC = g++
900   COMPILER_ROOT_DIR = /
901   PLATFORM_ADD_IN = darwin
902   ARCHITECTURE = $(shell machine 2>/dev/null || arch 2>/dev/null || echo i686)
903 #  COMPILER_FLAGS += -fgnu-runtime
904
905   export COMPILER_VERSION = $(shell $(SHELL) $(CLAM_DIR)/cpp/get_version.sh $(COMPILER) $(COMPILER_ROOT_DIR) )
906
907   DEFINITIONS += _FILE_OFFSET_BITS=64 
908
909   DEPENDENCY_DEFINITIONS += NO_VERSION
910   DEPENDENCY_ADDITIONS = -X/usr/include -X/usr/include/c++/$(COMPILER_VERSION) -X/usr/include/c++/$(COMPILER_VERSION)/tr1 -X/usr/local/include -X/usr/include/linux -X/usr/include/wx-2.8 -X/usr/lib/gcc/i586-suse-linux/$(COMPILER_VERSION)/include -X/usr/lib/gcc/i486-linux-gnu/$(COMPILER_VERSION)/include
911
912 #protect other additions to make them only for debian?
913 #  COMPILER_HEADER_DIR := /usr/include /usr/local/include 
914   COMPILER_HEADER_DIR := /System/Library/Frameworks/Foundation.framework/Versions/C/Headers
915
916   # "USE_XWIN" specifies that this project needs X window system support.
917   #USE_XWIN =
918
919 #  ifeq "x86_64" "$(ARCHITECTURE)"
920 #    COMPILER_LIBRARY_DIR = /lib64 /usr/lib64 /usr/local/lib64
921 #  else
922
923     COMPILER_LIBRARY_DIR = /usr/lib 
924 ###/usr/local/lib
925 #/lib 
926
927 #  endif
928   DEFINITIONS += __LINUX__ linux __linux__ UNIX unix __UNIX__ __USE_GNU 
929   # X Window System not enabled by default.
930   #DEFINITIONS += __XWINDOWS__ 
931
932   LIBRARY_TOOL = ar
933   LIB_PREFIX = lib
934 #  LOAD_FLAG_PREFIX += -Xlinker 
935 #mac has no o3???
936 #-O3 
937
938 # -Xlinker --print-map : shows what went in and why.
939 # -Xlinker -O3 : linker optimization
940   CREATE_LIBRARY_FLAG += -r 
941     # space on end is significant.
942   LINKER_OUTPUT_FLAG = -o 
943   LINK_TOOL = g++
944 #  COMPILER_FLAGS += -shared-libgcc -fPIC  
945 #old: -Wl,-export-dynamic
946 #  ifeq "$(DEBUG)" ""
947 #    COMPILER_FLAGS += -finline-functions 
948 #  endif
949 #  ifneq "$(STRICT_WARNINGS)" ""
950 #    COMPILER_FLAGS += -Wall -Werror -Wextra -pedantic-errors -Wno-long-long
951 #  endif
952 #  LIBS_USED += dl pthread rt 
953 #mac no like these libs
954      # dl=dynamic library.
955      # pthread=thread libraries.
956      # rt=real time libraries for shared memory.
957
958   ifneq "$(DEBUG)" ""
959     # add in debugging flags.
960 #    COMPILER_FLAGS += -g3 -O0
961   endif
962 endif
963
964 ############################################################################
965
966 # these activities are done after the compiler specific stuff.
967
968 # add a definition for programs to be able to differentiate the versions.
969 DEFINITIONS += COMPILER_VERSION=$(COMPILER_VERSION)
970
971 # set a variable that scripts can use to get most of the definitions.
972 export VARIABLE_DEFINITION_SET := $(DEFINITIONS)
973
974 ###############################################################################
975