1 ###############################################################################
3 # CLAM System default variable definitions for C++ compilation.
5 ###############################################################################
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)
12 ifeq "$(PARAMETER_FILE)" ""
13 # last ditch attempt to get one that will work.
14 export PARAMETER_FILE = $(PRODUCTION_STORE)/feisty_meow_config.ini
17 ###############################################################################
19 # Pull in the base support for CLAM.
22 ###############################################################################
24 # "TYPE" is the kind of product being generated by this project. this is
25 # used to decide where to put the final products of compilation. this is a
26 # variable in the user makefile.
28 # TYPE = library (outputs are static or dynamic libraries)
29 # TYPE = application (outputs are main-line executables)
30 # TYPE = test (outputs are test programs)
31 # TYPE = hierarchy (there are no outputs; just invokes other makes)
34 ###############################################################################
36 # "DEFINITIONS" is a list of compiler flags that define the value of c macros.
37 # These usually have the format of -D<flag>, but in this variable, only the
38 # <flag> itself should be listed because the compiler option -D is added
40 DEFINITIONS += CLAM_BUILT
41 # simple definition that tells the code that clam is building it.
43 ifneq "$(BOOT_STRAPPING)" ""
44 # the software is being built from the ground up, including the binaries
45 # we use for building (like value_tagger and others).
46 DEFINITIONS += BOOT_STRAPPING
49 # "UNDEFINITIONS" is a list of macros to undefine.
52 # GLOBAL_PRODUCT_NAME is an important variable for tagging the entire code base
53 # with some branding. It is provided as a macro definition to all source
54 # files. The initial value for the macro should come from the build init
55 # file, but if it does not, we pick a default.
56 ifeq "$(product_name)" ""
57 GLOBAL_PRODUCT_NAME := \\\"HOOPLE\\\"
59 GLOBAL_PRODUCT_NAME := \\\"$(product_name)\\\"
62 # *_PRODUCT_VERSION records parts of our version numbers for the code to see.
63 DEFINITIONS += MAJOR_PRODUCT_VERSION=$(major) MINOR_PRODUCT_VERSION=$(minor)
65 # TEST_MAKEFILE tells the preconditions to check that the files specified
66 # in the makefile are actually present.
67 export TEST_MAKEFILE =
69 ###############################################################################
71 # pseudo-boolean variable section. if these have any value at all, then they
72 # are treated as being true. note that these are flags that should generally
73 # be passed on the command line to a make. if they are intended to be used
74 # from inside a makefile, then they must appear before this file is included.
76 # "REBUILD" causes a rebuild of all source files if it is true.
79 # "DEBUG" is used to specify a debugging build. the default is for this to
80 # be false, which causes a release build.
83 # Add in a macro definition if debugging is turned on. This allows us to
84 # easily eliminate code from release builds.
86 DEFINITIONS += __DEBUGGING__
89 # "CONSOLE_MODE" causes the program to be generated as a console application.
90 # this is relevant in systems where programs are otherwise built with graphical
91 # user interfaces. these are always built statically.
94 # "OPTIMIZE" creates optimized code.
97 # "NO_COMPILE" just runs through the targets without compiling.
100 # "BUILD_LIST_FILE" is the set of files that need to be recompiled for
102 export BUILD_LIST_FILE = $(CLAM_TMP)/clam_rebuild.$(PROJECT)
104 # "BUILD_WHACK_FILE" is the set of object files that should be removed if
105 # a build failure occurs.
106 export BUILD_WHACK_FILE = $(CLAM_TMP)/clam_whack.$(PROJECT)
108 # we are adding the build list to the flag files so we know it gets cleaned up.
109 FLAG_FILES += $(BUILD_LIST_FILE) $(BUILD_WHACK_FILE)
111 ###############################################################################
113 # This section implements the HOOPLE directory scheme. If your scheme differs,
114 # then you will want to modify these appropriately.
116 # "THIRD_PARTY_DIR" is the root of our support libraries.
117 export THIRD_PARTY_DIR
118 ifeq "$(THIRD_PARTY_DIR)" ""
119 export THIRD_PARTY_DIR := "$(PRODUCTION_STORE)/3rdparty"
122 # "OUTPUT_ROOT" is the root of all output directories for objects and other
123 # products being built.
124 export OUTPUT_ROOT = $(CLAM_TMP)/objects
126 # "PLATFORM_ADD_IN" is an option discriminator for the intended execution
127 # platform. it should end in an underscore if it is provided.
128 #PLATFORM_ADD_IN = linux_ | w32_
130 # "CPU_BUILD_DIR" distinguishes object directories by including the CPU
131 # name and the type of build.
133 CPU_BUILD_DIR = $(CLAM_BASE_CPU)_$(PLATFORM_ADD_IN)dbg
135 CPU_BUILD_DIR = $(CLAM_BASE_CPU)_$(PLATFORM_ADD_IN)rel
138 # "BASE_OUTPUT_PATH" is the parent directory of objects for this type of
139 # CPU and this type of build.
140 export BASE_OUTPUT_PATH = $(OUTPUT_ROOT)/$(CPU_BUILD_DIR)
142 # special case when doing arm-linux builds
143 ifeq "$(CLAM_COMPILER)" "GNU_ARM_LINUX"
144 export TARGETS_STORE = $(FEISTY_MEOW_APEX)/$(CPU_BUILD_DIR)
145 # special output directory for firmware does not include CPU name because
146 # the repository already include the CPU name
147 BASE_OUTPUT_PATH = $(OUTPUT_ROOT)
150 # "OUTPUT_PATH" is the directory to generate all compiled products into.
151 export OUTPUT_PATH = $(BASE_OUTPUT_PATH)/$(PROJECT)
153 # "OBJECT_DIR" is where object files will be stored during compilation for the
154 # target type being produced.
155 export OBJECT_DIR = $(OUTPUT_PATH)
157 # These specify where files are to be created or located for our local build.
158 export EXECUTABLE_DIR = $(TARGETS_STORE)
159 export DYNAMIC_LIBRARY_DIR = $(TARGETS_STORE)
160 export STATIC_LIBRARY_DIR = $(TARGETS_STORE)
162 # "HEADER_SEARCH_PATH" is where the class interface files are to be found.
163 # the generated store folder is added to access the build version file.
164 # the binaries are added to access the system_helper.h file.
165 HEADER_SEARCH_PATH = $(FEISTY_MEOW_GENERATED_STORE)/versions $(FEISTY_MEOW_BINARIES)
167 # "LOCAL_HEADERS" are overrides that go first in the header search path.
168 LOCAL_HEADERS = $(THIRD_PARTY_DIR)
170 # "CODEBASE_HEADERS" is a list that can be changed for a particular codebase.
171 # it is guaranteed that clam will not interfere with this list, whereas
172 # the LOCAL_HEADERS can be modified by clam.
175 # "LOCAL_LIBRARIES" are overrides that go first in the library search path.
178 # "LIBRARY_SEARCH_PATH" is where the library files are to be found.
179 #LIBRARY_SEARCH_PATH =
181 # "HOOPLE_LIBRARIES" is where our local libraries are located.
184 # "EXTRA_COPIES" is a list of files that need to be among the files copied
185 # to a project output folder.
188 # "EXTRA_VERSIONS" is a list of version files to synchronize with the main
189 # library version for this build. if a file called "version.ini" exists in
190 # the project directory, then it will automatically be upgraded, so the
191 # extra version files are mainly useful when you have a project with multiple
192 # programs in it and you want them to have independent version files (as you
193 # should perhaps want).
194 export EXTRA_VERSIONS
196 # "DEPS_FILE" is where the auto-dependency information is stored.
197 export DEPS_FILE = $(OUTPUT_PATH)/$(PROJECT).deps
199 # "NO_DEPS" is an exclusion flag. if it is defined, then no auto-dependency
200 # files will be generated. this is useful if you are missing makedep or trying
204 # "OMIT_VERSIONS" is another exclusion flag. this one turns off the creation
205 # of version resource files and eliminates any references that would include
206 # such files. this is needed when rebuilding version_stamper.
209 # add the cleanup values we already know.
210 CLEANUPS += $(OUTPUT_PATH) $(DEPS_FILE)
212 SUPPLEMENTAL_CLEANUP_TARGETS = cpp_add_to_cleanups_variable
214 # "GENDEPS" is a flag that causes dependencies to be generated into
215 # statically built applications.
218 ###############################################################################
220 # "SEARCH_DIRS" is a list of directories that should be searched for both C++
221 # header files and for C++ code libraries. The items placed in SEARCH_DIRS
222 # are fed into both the LIBRARY_SEARCH_PATH and the HEADER_SEARCH_PATH.
225 # "DEPENDENCY_DEFINITIONS" is a list of extra definitions that only get passed
226 # to the makedep tool. this can vary for each compiler.
227 #DEPENDENCY_DEFINITIONS =
229 # "DEPENDENCY_ADDITIONS" is a set of parameters passed directly to makedep.
230 #DEPENDENCY_ADDITIONS =
232 # "DEBUG_FLAGS" these flags are used for generating specialized versions of
233 # object files, such as ones that include debugging code or that add code for
235 # Possible values are -g for adding GDB debugging code and -pg for adding
236 # gprof profiling code.
241 # "COMPILER_FLAGS" are the flags for the pre-processor and compiler.
244 # "STRICT_WARNINGS" turns on all warnings and forces them to be considered
245 # as errors when encountered.
248 # "LIBRARIAN_FLAGS" are flags that need to be passed to the library tool
249 # that creates static code libraries.
252 # "SOURCE" is the list of files that are turned into objects.
255 # "OBJECTS" are the files to be created by compilation and added to any
256 # libraries or executables that are made.
259 # "EXTRA_OBJECTS" are files that are created elsewhere but need to be bound
263 # "LIBS_USED" are system or compiler code libraries that the targets to be
264 # created depend upon.
267 # "LOCAL_LIBS_USED" is very similar to the LIBS_USED, but these libraries
268 # actually cause executables and object files to be recompiled when the
269 # libraries specified have changed. To accomplish this, these libraries MUST
270 # be located in the STATIC_LIBRARY_DIR rather than at some arbitrary place
271 # on the LIBRARY_SEARCH_PATH.
274 # Load flags tell the linker and loader how to deal with the files and where
275 # to locate library components. The prefix goes before object files are
276 # listed, and the suffix after. The prefix should have things like the
277 # directories to be searched for code libraries (although they should be added
278 # to LIBRARY_SEARCH_PATH) and the loading mode for functions (static/dynamic).
279 # In the suffix, actual library loading statements (like -lmath) can be
280 # included (although they should be listed in a different form in LIBS_USED).
281 # Remember that the unix loader looks for functions in libraries in a bizarre
282 # way: ld searches for a function only when it has already been asked for it.
283 # This means that it does not remember what functions it has already been
284 # provided with in the libraries and object files, and it will fail if those
285 # functions are only asked for after they have already been encountered.
289 # The prefix used on library names, mostly for unix.
291 # The standard suffix for static or import libraries on this operating system.
294 # The dynamic library ending differs between platforms.
297 # Flag for specifying the library name to create.
298 #CREATE_LIBRARY_FLAG =
300 # Flag for specifying a library to include in linking.
301 LIBRARY_NAME_FLAG = -l
303 # Flag for specifying the name of an object file to include in a library or exe.
304 OBJECT_NAME_FLAG = -o
306 # Flag for specifying a directory to add to the search path for libs.
307 LIBRARY_PATH_FLAG = -L
309 # Flag for specifying the name of an output from the linker.
310 #LINKER_OUTPUT_FLAG =
312 # Flag for separating linker options from compilation options for a combined
314 #LINKER_OPTION_SEPARATOR =
316 # Flag that passes special options when building executable programs. It is
317 # passed just before the LOAD_FLAG_PREFIX.
320 # The name of the compiler tool.
323 # The name of the library creator tool.
326 ifeq "$(OPERATING_SYSTEM)" "WIN32"
327 # the root name of the version file. This is currently irrelevant on
328 # non-windoze platforms.
329 #CLAM_VERSION_RC_ROOT = $(shell $(SHELL) $(CLAM_SCRIPTS)/cpp/rc_name.sh)
330 #hmmm: also currently irrelevant since we are only doing static builds.
333 ifneq "$(CONSOLE_MODE)" ""
334 # this definition can be used to signal different behavior when the app is
335 # being built for console mode. that generally implies that it should send
336 # debugging info to standard out and avoid doing much with graphics.
337 DEFINITIONS += CONSOLE_MODE
340 ###############################################################################
342 # Operating system dependent flags.
343 # (not so OS dependent with move to only gnu compilation...)
348 ###############################################################################
350 # Compiler Dependent Flags
352 # "CLAM_COMPILER_ROOT_DIR" is the top-level for the C++ compiler location.
353 # "COMPILER_HEADER_DIR" is where the compiler headers are.
354 # "COMPILER_LIBRARY_DIR" is where archived libraries are.
355 # "CC" is the name of the C++ compiler to be used.
356 export COMPILER_HEADER_DIR
358 # These flags may be useful across multiple compilers.
360 # "USE_SSL" brings in the OpenSSL libraries.
363 # "USE_CURL" provides access to the curl library.
366 # "USE_WXWIDGETS" enables wxwidget library support.
369 # "USE_XWIN" specifies that this project needs X window system support.
372 ifneq "$(OMIT_VERSIONS)" ""
373 DEFINITIONS += NO_VERSION
376 ############################################################################
377 # compiler specific section below.
378 ############################################################################
380 ifeq "$(CLAM_COMPILER)" "GNU_LINUX"
381 # Unix GNU compiler...
383 PLATFORM_ADD_IN = linux_
384 DEFINITIONS += _FILE_OFFSET_BITS=64
386 DEPENDENCY_DEFINITIONS += NO_VERSION
387 #hmmm: uggh, can we clean up this huge list of dep adds somehow?
388 DEPENDENCY_ADDITIONS = -X/usr/include -X/usr/include/c++/$(CLAM_COMPILER_VERSION) -X/usr/include/c++/$(CLAM_COMPILER_VERSION)/tr1 -X/usr/local/include -X/usr/include/linux -X/usr/include/wx-2.8 -X/usr/lib/gcc/i586-suse-linux/$(CLAM_COMPILER_VERSION)/include -X/usr/lib/gcc/i486-linux-gnu/$(CLAM_COMPILER_VERSION)/include -X/usr/lib/gcc/i686-linux-gnu/$(CLAM_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
390 # ifeq "x86_64" "$(CLAM_BASE_CPU)"
391 # COMPILER_LIBRARY_DIR = /lib64 /usr/lib64 /usr/local/lib64
393 # COMPILER_LIBRARY_DIR = /lib /usr/lib /usr/local/lib
395 DEFINITIONS += __LINUX__ linux __linux__ UNIX unix __UNIX__ __USE_GNU
397 #hmmm: move to an x win enabling area.
398 # X Window System not enabled by default.
399 #DEFINITIONS += __XWINDOWS__
403 LOAD_FLAG_PREFIX += -Xlinker -O3
404 # -Xlinker --print-map : shows what went in and why.
405 # -Xlinker -O3 : linker optimization
407 CREATE_LIBRARY_FLAG += -r
408 # space on end is significant.
409 LINKER_OUTPUT_FLAG = -o
412 COMPILER_FLAGS += -shared-libgcc -fPIC
413 # compiler flags for gcc:
414 # -finline-functions: inline functions as needed.
415 # -fPIC: generate position independent code.
416 # -fpic: generate position independent code, but less portable.
417 # -frepo: automatic template instantiation at link time, no implicit ones.
418 # -ffunction-sections: put each function in own section, improving linking.
419 # -fdata-sections: put data in own section, improving linking.
420 # -shared-libgcc: use the shared library version of compiler libraries.
421 # -fno-exceptions: do not support exception handling and stack unwinding.
424 # COMPILER_FLAGS += -finline-functions
426 ifneq "$(STRICT_WARNINGS)" ""
427 COMPILER_FLAGS += -Wall -Werror -Wextra -Wno-long-long
430 ifeq "$(CONSOLE_MODE)" ""
432 # dl=dynamic library.
435 LIBS_USED += pthread rt
436 # pthread=thread libraries.
437 # rt=real time libraries for shared memory.
440 # add in debugging flags.
441 COMPILER_FLAGS += -g3 -O0
443 ##LOAD_FLAG_PREFIX += -lefence
446 ###COMPILER_FLAGS += -pg
447 ###LOAD_FLAG_PREFIX += -pg
448 ####trying out profiling: does not work so well yet. generates gmon.out files
449 #### in pretty random places. the parameters to the linker do not even
450 #### mention this flag, and the compiler flags do not seem to provide an
451 #### option for where the file goes. so, it is on hold.
457 ############################################################################
459 ifeq "$(CLAM_COMPILER)" "GNU_DARWIN"
460 # Darwin kernel GNU compiler... really more general macos (MacOS) here these days.
462 PLATFORM_ADD_IN = darwin
463 DEFINITIONS += _FILE_OFFSET_BITS=64
465 DEPENDENCY_DEFINITIONS += NO_VERSION
466 # DEPENDENCY_ADDITIONS = -X/usr/include -X/usr/include/c++/$(CLAM_COMPILER_VERSION) -X/usr/include/c++/$(CLAM_COMPILER_VERSION)/tr1 -X/usr/local/include -X/usr/include/linux -X/usr/include/wx-2.8 -X/usr/lib/gcc/i586-suse-linux/$(CLAM_COMPILER_VERSION)/include -X/usr/lib/gcc/i486-linux-gnu/$(CLAM_COMPILER_VERSION)/include
467 DEPENDENCY_ADDITIONS = -X/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include
469 COMPILER_HEADER_DIR := /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include
470 #/usr/local/include /usr/include
471 #old /System/Library/Frameworks/Foundation.framework/Versions/C/Headers
472 #/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include
473 #/Library/Developer/CommandLineTools/usr/include
475 # ifeq "x86_64" "$(CLAM_BASE_CPU)"
476 # COMPILER_LIBRARY_DIR = /lib64 /usr/lib64 /usr/local/lib64
478 # COMPILER_LIBRARY_DIR = /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib
479 ##/usr/lib /usr/local/lib
482 DEFINITIONS += UNIX unix __UNIX__ __USE_GNU
486 # special flags for getting rid of warnings on fd_set.
487 LOAD_FLAG_PREFIX=-Wl,-U,___darwin_check_fd_set_overflow
489 CREATE_LIBRARY_FLAG += -r
490 # space on end is significant.
491 LINKER_OUTPUT_FLAG = -o
495 COMPILER_FLAGS += -Wno-nullability-completeness
496 #trying this one again, which had been turned off.
497 COMPILER_FLAGS += -fgnu-runtime
500 # add in debugging flags.
501 # COMPILER_FLAGS += -g3 -O0
505 ############################################################################
507 ifeq "$(CLAM_COMPILER)" "GNU_ARM_LINUX"
508 # ARM-linux GNU compiler...
510 ## CLAM_COMPILER_ROOT_DIR = /usr/local/arm-linux
511 #hmmm: the above is the one we may need to integrate into build_variables.sh
513 CC = $(CLAM_COMPILER_ROOT_DIR)/bin/g++
514 PLATFORM_ADD_IN = linux_
515 SNAPGEAR_ROOT_DIR = $(HOME)/snapgear
516 DEPENDENCY_DEFINITIONS += NO_VERSION
518 COMPILER_HEADER_DIR = $(SNAPGEAR_ROOT_DIR)/linux-2.4.x/include
519 # COMPILER_HEADER_DIR += $(SNAPGEAR_ROOT_DIR)/include
520 COMPILER_HEADER_DIR += $(CLAM_COMPILER_ROOT_DIR)/include $(CLAM_COMPILER_ROOT_DIR)/lib
521 COMPILER_HEADER_DIR += /usr/local/lib/gcc-lib/arm-linux/3.3.2/include
523 COMPILER_LIBRARY_DIR = $(SNAPGEAR_ROOT_DIR)/lib $(CLAM_COMPILER_ROOT_DIR)/lib/be
525 DEFINITIONS += linux __linux__ unix UNIX __UNIX__ __LINUX__
527 COMPILER_FLAGS += -mbig-endian -finline-functions -ffunction-sections -fPIC -nostdinc -nostdinc++
528 ifneq "$(STRICT_WARNINGS)" ""
529 COMPILER_FLAGS += -Wall -Werror
532 LIBRARY_TOOL = $(CLAM_COMPILER_ROOT_DIR)/bin/ar
534 CREATE_LIBRARY_FLAG += -r
535 # space on end is significant.
537 LINK_TOOL = $(CLAM_COMPILER_ROOT_DIR)/bin/g++
538 LINKER_OUTPUT_FLAG = -o
539 EXE_FLAGS = -mbig-endian
540 LOAD_FLAG_PREFIX += -v -mbig-endian
542 LIBS_USED += pthread dl
545 COMPILER_FLAGS += -g3 -O0
550 ############################################################################
552 ifeq "$(CLAM_COMPILER)" "GNU_WINDOWS"
553 # GNU compiler for MS Windoze...
555 # RC := $(CLAM_COMPILER_ROOT_DIR)/bin/windres
556 PLATFORM_ADD_IN = w32_
558 COMPILER_HEADER_DIR = $(CLAM_COMPILER_ROOT_DIR)/include $(CLAM_COMPILER_ROOT_DIR)/include/c++/3.4.2
559 #$(CLAM_COMPILER_ROOT_DIR)/lib/gcc/mingw32/3.4.2/include
560 ###$(CLAM_COMPILER_ROOT_DIR)/usr/include/mingw $(CLAM_COMPILER_ROOT_DIR)/usr/include $(CLAM_COMPILER_ROOT_DIR)/usr/include/w32api $(CLAM_COMPILER_ROOT_DIR)/usr/include/extras
562 COMPILER_LIBRARY_DIR = $(CLAM_COMPILER_ROOT_DIR)/lib
563 DEFINITIONS += __GNU_WINDOWS__ _Windows _WINDOWS WIN32 __WIN32__ __FLAT__ VC_EXTRALEAN WIN32_LEAN_AND_MEAN ATL_NO_LEAN_AND_MEAN _WIN32
566 LIBRARY_PATH_FLAG = -L
569 LOAD_FLAG_PREFIX += -mwindows
570 CREATE_LIBRARY_FLAG += -r
571 # space on end is significant.
572 LINKER_OUTPUT_FLAG = -o
574 MIDL = midl -Oicf $(MIDL_DEFS) $(HEADER_SEARCH_PATH:%=-I% ) $(DEFINITIONS:%=-D% )
575 MIDL_DEFS = -no_robust
576 # some lovely definitions used by some of the mfc and other ms code.
577 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
578 #hmmm: yuck; re-evaluate need for the above dep defs.
582 ############################################################################
584 # these activities are done after the compiler specific stuff.
586 # add a definition for programs to be able to differentiate the versions.
587 DEFINITIONS += CLAM_COMPILER_VERSION=$(CLAM_COMPILER_VERSION)
589 # set a variable that scripts can use to get most of the definitions.
590 export VARIABLE_DEFINITION_SET := $(DEFINITIONS)
592 ###############################################################################