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