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