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