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 #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
29 # ifeq "$(OP_SYSTEM)" "WIN32"
30 # export FEISTY_MEOW_APEX = l:
34 #export CLAM_BINARIES = $(CLAM_SCRIPTS)/../bin
36 ###############################################################################
38 # BASE_CPU is a flag that distinguishes the type of processor, if necessary.
40 #BASE_CPU := m68k = motorola 68000 series | m68340 = motorola 68340
41 # | x86 = intel x86 | ppc = power pc | arm = ARM core
43 # set the CPU to a default if it has not been set previously.
45 # ifneq "$(OP_SYSTEM)" "WIN32"
46 BASE_CPU := $(shell machine 2>/dev/null || arch 2>/dev/null || uname -m 2>/dev/null || echo i686)
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.
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
63 #COMPILER := GNU_LINUX | GNU_ARM_LINUX | GNU_DARWIN | GNU_WINDOWS | VISUAL_CPP
65 # choose a default compiler if none was specified.
67 ifeq "$(OP_SYSTEM)" "UNIX"
68 ifeq "$(OS_SUBCLASS)" "darwin"
69 COMPILER := GNU_DARWIN
74 ifeq "$(OP_SYSTEM)" "WIN32"
75 # COMPILER := GNU_WINDOWS
76 COMPILER := VISUAL_CPP
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.
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
90 ###############################################################################
92 # "TYPE" is the kind of product being generated by this project. this is
93 # used to decide where to put the final products of compilation. this is a
94 # variable in the user makefile.
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)
102 ###############################################################################
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
108 DEFINITIONS += CLAM_BUILT
109 # simple definition that tells the code that clam is building it.
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
117 # "UNDEFINITIONS" is a list of macros to undefine.
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\\\"
127 GLOBAL_PRODUCT_NAME := \\\"$(product_name)\\\"
130 # *_PRODUCT_VERSION records parts of our version numbers for the code to see.
131 DEFINITIONS += MAJOR_PRODUCT_VERSION=$(major) MINOR_PRODUCT_VERSION=$(minor)
133 # TEST_MAKEFILE tells the preconditions to check that the files specified
134 # in the makefile are actually present.
135 export TEST_MAKEFILE =
137 ###############################################################################
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.
144 # "REBUILD" causes a rebuild of all source files if it is true.
147 # "DEBUG" is used to specify a debugging build. the default is for this to
148 # be false, which causes a release build.
151 # Add in a macro definition if debugging is turned on. This allows us to
152 # easily eliminate code from release builds.
154 DEFINITIONS += __DEBUGGING__
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.
162 # "OPTIMIZE" creates optimized code.
165 # "NO_COMPILE" just runs through the targets without compiling.
168 # "BUILD_LIST_FILE" is the set of files that need to be recompiled for
170 export BUILD_LIST_FILE = $(CLAM_TMP)/clam_rebuild.$(PROJECT)
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)
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)
179 ###############################################################################
181 # This section implements the HOOPLE directory scheme. If your scheme differs,
182 # then you will want to modify these appropriately.
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_STORE)/3rdparty"
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
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_
198 # "CPU_BUILD_DIR" distinguishes object directories by including the CPU
199 # name and the type of build.
201 CPU_BUILD_DIR = $(BASE_CPU)_$(PLATFORM_ADD_IN)dbg
203 CPU_BUILD_DIR = $(BASE_CPU)_$(PLATFORM_ADD_IN)rel
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)
210 # special case when doing arm-linux builds
211 ifeq "$(COMPILER)" "GNU_ARM_LINUX"
212 export TARGETS_STORE = $(FEISTY_MEOW_APEX)/$(CPU_BUILD_DIR)
213 # special output directory for firmware does not include CPU name because
214 # the repository already include the CPU name
215 BASE_OUTPUT_PATH = $(OUTPUT_ROOT)
218 # "OUTPUT_PATH" is the directory to generate all compiled products into.
219 export OUTPUT_PATH = $(BASE_OUTPUT_PATH)/$(PROJECT)
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)
225 # These specify where files are to be created or located for our local build.
226 export EXECUTABLE_DIR = $(TARGETS_STORE)
227 export DYNAMIC_LIBRARY_DIR = $(TARGETS_STORE)
228 export STATIC_LIBRARY_DIR = $(TARGETS_STORE)
230 # "HEADER_SEARCH_PATH" is where the class interface files are to be found.
231 #HEADER_SEARCH_PATH =
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" ; \
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 )
246 # "LOCAL_HEADERS" are overrides that go first in the header search path.
247 LOCAL_HEADERS = $(THIRD_PARTY_DIR)
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.
254 # "LOCAL_LIBRARIES" are overrides that go first in the library search path.
257 # "LIBRARY_SEARCH_PATH" is where the library files are to be found.
258 #LIBRARY_SEARCH_PATH =
260 # "HOOPLE_LIBRARIES" is where our local libraries are located.
263 # "EXTRA_COPIES" is a list of files that need to be among the files copied
264 # to a project output folder.
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
275 # "DEPS_FILE" is where the auto-dependency information is stored.
276 export DEPS_FILE = $(OUTPUT_PATH)/$(PROJECT).deps
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 are missing makedep or trying
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.
288 # add the cleanup values we already know.
289 CLEANUPS += $(OUTPUT_PATH) $(DEPS_FILE)
291 SUPPLEMENTAL_CLEANUP_TARGETS = cpp_add_to_cleanups_variable
293 # "GENDEPS" is a flag that causes dependencies to be generated into
294 # statically built applications.
297 ###############################################################################
299 # "SEARCH_DIRS" is a list of directories that should be searched for both C++
300 # header files and for C++ code libraries. The items placed in SEARCH_DIRS
301 # are fed into both the LIBRARY_SEARCH_PATH and the HEADER_SEARCH_PATH.
304 # "DEPENDENCY_DEFINITIONS" is a list of extra definitions that only get passed
305 # to the makedep tool. this can vary for each compiler.
306 #DEPENDENCY_DEFINITIONS =
308 # "DEPENDENCY_ADDITIONS" is a set of parameters passed directly to makedep.
309 #DEPENDENCY_ADDITIONS =
311 # "DEBUG_FLAGS" these flags are used for generating specialized versions of
312 # object files, such as ones that include debugging code or that add code for
314 # Possible values are -g for adding GDB debugging code and -pg for adding
315 # gprof profiling code.
320 # "COMPILER_FLAGS" are the flags for the pre-processor and compiler.
323 # "STRICT_WARNINGS" turns on all warnings and forces them to be considered
324 # as errors when encountered.
327 # "LIBRARIAN_FLAGS" are flags that need to be passed to the library tool
328 # that creates static code libraries.
331 # "SOURCE" is the list of files that are turned into objects.
334 # "OBJECTS" are the files to be created by compilation and added to any
335 # libraries or executables that are made.
338 # "EXTRA_OBJECTS" are files that are created elsewhere but need to be bound
342 # "LIBS_USED" are system or compiler code libraries that the targets to be
343 # created depend upon.
346 # "LOCAL_LIBS_USED" is very similar to the LIBS_USED, but these libraries
347 # actually cause executables and object files to be recompiled when the
348 # libraries specified have changed. To accomplish this, these libraries MUST
349 # be located in the STATIC_LIBRARY_DIR rather than at some arbitrary place
350 # on the LIBRARY_SEARCH_PATH.
353 # Load flags tell the linker and loader how to deal with the files and where
354 # to locate library components. The prefix goes before object files are
355 # listed, and the suffix after. The prefix should have things like the
356 # directories to be searched for code libraries (although they should be added
357 # to LIBRARY_SEARCH_PATH) and the loading mode for functions (static/dynamic).
358 # In the suffix, actual library loading statements (like -lmath) can be
359 # included (although they should be listed in a different form in LIBS_USED).
360 # Remember that the unix loader looks for functions in libraries in a bizarre
361 # way: ld searches for a function only when it has already been asked for it.
362 # This means that it does not remember what functions it has already been
363 # provided with in the libraries and object files, and it will fail if those
364 # functions are only asked for after they have already been encountered.
368 # The prefix used on library names, mostly for unix.
370 # The standard suffix for static or import libraries on this operating system.
373 # The dynamic library ending differs between platforms.
376 # Flag for specifying the library name to create.
377 #CREATE_LIBRARY_FLAG =
379 # Flag for specifying a library to include in linking.
380 LIBRARY_NAME_FLAG = -l
382 # Flag for specifying the name of an object file to include in a library or exe.
383 OBJECT_NAME_FLAG = -o
385 # Flag for specifying a directory to add to the search path for libs.
386 LIBRARY_PATH_FLAG = -L
388 # Flag for specifying the name of an output from the linker.
389 #LINKER_OUTPUT_FLAG =
391 # Flag for separating linker options from compilation options for a combined
393 #LINKER_OPTION_SEPARATOR =
395 # Flag that passes special options when building executable programs. It is
396 # passed just before the LOAD_FLAG_PREFIX.
399 # The name of the compiler tool.
402 # The name of the library creator tool.
405 # the root name of the version file. This is currently irrelevant on
406 # non-win32 platforms.
407 VERSION_RC_ROOT = $(shell $(SHELL) $(CLAM_SCRIPTS)/cpp/rc_name.sh)
409 ifneq "$(CONSOLE_MODE)" ""
410 # this definition can be used to signal different behavior when the app is
411 # being built for console mode. that generally implies that it should send
412 # debugging info to standard out and avoid doing much with graphics.
413 DEFINITIONS += CONSOLE_MODE
416 ###############################################################################
418 # Operating system dependent flags.
420 ifeq "$(OP_SYSTEM)" "UNIX"
424 ifeq "$(OP_SYSTEM)" "WIN32"
425 ifeq "$(COMPILER)" "VISUAL_CPP"
434 ###############################################################################
436 # Compiler Dependent Flags
438 # "COMPILER_ROOT_DIR" is the top-level for the C++ compiler location.
439 export COMPILER_ROOT_DIR
440 # "COMPILER_HEADER_DIR" is where the compiler headers are.
441 export COMPILER_HEADER_DIR
442 # "COMPILER_LIBRARY_DIR" is where archived libraries are.
443 # "CC" is the name of the C++ compiler to be used.
445 # These flags may be useful across multiple compilers.
447 # SSL brings in the OpenSSL libraries.
450 # CURL provides access to the curl library.
453 # Enables wxwidget library support.
456 ifneq "$(OMIT_VERSIONS)" ""
457 DEFINITIONS += NO_VERSION
460 ############################################################################
461 # compiler specific section below.
462 ############################################################################
464 ifeq "$(COMPILER)" "GNU_LINUX"
465 # Unix GNU compiler...
467 COMPILER_ROOT_DIR = /
468 PLATFORM_ADD_IN = linux_
469 ARCHITECTURE = $(shell machine 2>/dev/null || arch 2>/dev/null || echo i686)
471 export COMPILER_VERSION = $(shell $(SHELL) $(CLAM_SCRIPTS)/cpp/get_version.sh $(COMPILER) $(COMPILER_ROOT_DIR) )
473 DEFINITIONS += _FILE_OFFSET_BITS=64
475 DEPENDENCY_DEFINITIONS += NO_VERSION
476 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
478 # "USE_XWIN" specifies that this project needs X window system support.
481 ifeq "x86_64" "$(ARCHITECTURE)"
482 COMPILER_LIBRARY_DIR = /lib64 /usr/lib64 /usr/local/lib64
484 COMPILER_LIBRARY_DIR = /lib /usr/lib /usr/local/lib
486 DEFINITIONS += __LINUX__ linux __linux__ UNIX unix __UNIX__ __USE_GNU
487 # X Window System not enabled by default.
488 #DEFINITIONS += __XWINDOWS__
492 LOAD_FLAG_PREFIX += -Xlinker -O3
493 # -Xlinker --print-map : shows what went in and why.
494 # -Xlinker -O3 : linker optimization
496 CREATE_LIBRARY_FLAG += -r
497 # space on end is significant.
498 LINKER_OUTPUT_FLAG = -o
500 # compiler flags for gcc:
501 # -finline-functions: inline functions as needed.
502 # -fPIC: generate position independent code.
503 # -fpic: generate position independent code, but less portable.
504 # -frepo: automatic template instantiation at link time, no implicit ones.
505 # -ffunction-sections: put each function in own section, improving linking.
506 # -fdata-sections: put data in own section, improving linking.
507 # -shared-libgcc: use the shared library version of compiler libraries.
508 # -fno-exceptions: do not support exception handling and stack unwinding.
510 COMPILER_FLAGS += -shared-libgcc -fPIC
513 # COMPILER_FLAGS += -finline-functions
515 ifneq "$(STRICT_WARNINGS)" ""
516 COMPILER_FLAGS += -Wall -Werror -Wextra -Wno-long-long
519 ifeq "$(CONSOLE_MODE)" ""
521 # dl=dynamic library.
524 LIBS_USED += pthread rt
525 # pthread=thread libraries.
526 # rt=real time libraries for shared memory.
529 # add in debugging flags.
530 COMPILER_FLAGS += -g3 -O0
532 ##LOAD_FLAG_PREFIX += -lefence
535 ###COMPILER_FLAGS += -pg
536 ###LOAD_FLAG_PREFIX += -pg
537 ####trying out profiling: does not work so well yet. generates gmon.out files
538 #### in pretty random places. the parameters to the linker do not even
539 #### mention this flag, and the compiler flags do not seem to provide an
540 #### option for where the file goes. so, it is on hold.
546 ############################################################################
548 ifeq "$(COMPILER)" "GNU_ARM_LINUX"
549 # ARM-linux GNU compiler...
550 COMPILER_ROOT_DIR = /usr/local/arm-linux
551 CC = $(COMPILER_ROOT_DIR)/bin/g++
552 PLATFORM_ADD_IN = linux_
554 export COMPILER_VERSION = $(shell $(SHELL) $(CLAM_SCRIPTS)/cpp/get_version.sh $(COMPILER) $(COMPILER_ROOT_DIR) )
556 SNAPGEAR_ROOT_DIR = $(HOME)/snapgear
558 DEPENDENCY_DEFINITIONS += NO_VERSION
560 COMPILER_HEADER_DIR = $(SNAPGEAR_ROOT_DIR)/linux-2.4.x/include
561 # COMPILER_HEADER_DIR += $(SNAPGEAR_ROOT_DIR)/include
562 COMPILER_HEADER_DIR += $(COMPILER_ROOT_DIR)/include $(COMPILER_ROOT_DIR)/lib
563 COMPILER_HEADER_DIR += /usr/local/lib/gcc-lib/arm-linux/3.3.2/include
565 COMPILER_LIBRARY_DIR = $(SNAPGEAR_ROOT_DIR)/lib $(COMPILER_ROOT_DIR)/lib/be
567 DEFINITIONS += linux __linux__ unix UNIX __UNIX__ __LINUX__
569 COMPILER_FLAGS += -mbig-endian -finline-functions -ffunction-sections -fPIC -nostdinc -nostdinc++
570 ifneq "$(STRICT_WARNINGS)" ""
571 COMPILER_FLAGS += -Wall -Werror
574 LIBRARY_TOOL = $(COMPILER_ROOT_DIR)/bin/ar
576 CREATE_LIBRARY_FLAG += -r
577 # space on end is significant.
579 LINK_TOOL = $(COMPILER_ROOT_DIR)/bin/g++
580 LINKER_OUTPUT_FLAG = -o
581 EXE_FLAGS = -mbig-endian
582 LOAD_FLAG_PREFIX += -v -mbig-endian
584 LIBS_USED += pthread dl
587 COMPILER_FLAGS += -g3 -O0
592 ############################################################################
594 ifeq "$(COMPILER)" "GNU_WINDOWS"
595 # GNU compiler for MS Windoze...
597 ifeq "$(COMPILER_ROOT_DIR)" ""
598 COMPILER_ROOT_DIR = $(CYGROOT)
601 export COMPILER_VERSION = $(shell $(SHELL) $(CLAM_SCRIPTS)/cpp/get_version.sh $(COMPILER) $(COMPILER_ROOT_DIR) )
603 RC := $(COMPILER_ROOT_DIR)/bin/windres
604 PLATFORM_ADD_IN = w32_
606 COMPILER_HEADER_DIR = $(COMPILER_ROOT_DIR)/include $(COMPILER_ROOT_DIR)/include/c++/3.4.2
607 #$(COMPILER_ROOT_DIR)/lib/gcc/mingw32/3.4.2/include
608 ###$(COMPILER_ROOT_DIR)/usr/include/mingw $(COMPILER_ROOT_DIR)/usr/include $(COMPILER_ROOT_DIR)/usr/include/w32api $(COMPILER_ROOT_DIR)/usr/include/extras
610 COMPILER_LIBRARY_DIR = $(COMPILER_ROOT_DIR)/lib
611 DEFINITIONS += __GNU_WINDOWS__ _Windows _WINDOWS WIN32 __WIN32__ __FLAT__ VC_EXTRALEAN WIN32_LEAN_AND_MEAN ATL_NO_LEAN_AND_MEAN _WIN32 __USE_W32_SOCKETS
616 LIBRARY_PATH_FLAG = -L
619 # LOAD_FLAG_PREFIX += -lpthread
620 LOAD_FLAG_PREFIX += -mwindows
621 CREATE_LIBRARY_FLAG += -r
622 # space on end is significant.
623 LINKER_OUTPUT_FLAG = -o
625 MIDL = midl -Oicf $(MIDL_DEFS) $(HEADER_SEARCH_PATH:%=-I% ) $(DEFINITIONS:%=-D% )
626 MIDL_DEFS = -no_robust
627 # some lovely definitions used by some of the mfc and other ms code.
628 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
632 ############################################################################
634 ifeq "$(COMPILER)" "VISUAL_CPP"
635 # microsoft visual c++ 4.x, 5.x or 6.x.
637 PLATFORM_ADD_IN = w32_
641 CLEANUPS += $(PDB_DIR)/$(PROJECT)_bookkeeping.pdb
642 #hmmm: import libs for dynamic libraries on ms-win32 do not currently get
645 # ensure that any setting for this is seen by sub-shells.
646 export WIN32_MANIFEST_FILE
648 # these define special characteristics for a program being built.
649 # BASE is almost always defined and pulls in fundamental w32 support.
650 # RPC supplies the remote procedure call libraries.
651 # SECURITY links with the w32 security APIs.
652 # CLR sets options that are appropriate for managed code.
660 # the framework dir points at the .net framework to be used for compilation.
661 ifeq "$(FRAMEWORK_VERSION)" ""
664 # SHORT_FRAMEWORK_VERSION = 1.1
665 # FRAMEWORK_VERSION = $(SHORT_FRAMEWORK_VERSION).4322
668 SHORT_FRAMEWORK_VERSION = 2.0
669 FRAMEWORK_VERSION = $(SHORT_FRAMEWORK_VERSION).50727
671 ifeq "$(FRAMEWORK_DIR)" ""
672 FRAMEWORK_DIR = $(subst \,/,$(WINDIR))/Microsoft.NET/Framework/v$(FRAMEWORK_VERSION)
675 # calculate the visual studio root directory.
676 ifeq "$(VIS_STU_ROOT)" ""
677 export VIS_STU_ROOT := $(shell $(SHELL) $(CLAM_SCRIPTS)/cpp/ms_root_dir.sh )
679 ifneq "$(VIS_STU_ROOT)" ""
680 export COMPILER_ROOT_DIR = $(VIS_STU_ROOT)/VC
682 ifeq "$(COMPILER_ROOT_DIR)" ""
683 HOSEUP = $(shell echo The compiler directory is not set. Please define the environment variable)
684 HOSEUP = $(shell echo VSxCOMNTOOLS (x=80, 90 or 100) to point at the folder where visual )
685 HOSEUP = $(shell echo Studio is installed.)
689 # redo the compiler version with our new info.
690 export COMPILER_VERSION := $(shell $(SHELL) $(CLAM_SCRIPTS)/cpp/get_version.sh $(COMPILER) $(COMPILER_ROOT_DIR) )
692 # set up a directory for debugging files to be stored. these are not
693 # moved with the postconditions--they are generated in place.
694 export PDB_DIR = $(TARGETS_STORE)
696 # set these way up here so we can override them later.
697 CC = $(BUILD_SCRIPTS_PATH)/wrapdoze.sh $(COMPILER_ROOT_DIR)/bin/cl.exe
698 LINK_TOOL = $(BUILD_SCRIPTS_PATH)/wrapdoze.sh $(COMPILER_ROOT_DIR)/bin/link.exe
699 LIBRARY_TOOL = $(BUILD_SCRIPTS_PATH)/wrapdoze.sh $(COMPILER_ROOT_DIR)/bin/lib
701 # This is needed to protect against the use of 64-bit time_t structure
702 # on windows. We are casting to time_t from a 32-bit structure.
703 DEFINITIONS += _USE_32BIT_TIME_T
705 # vary the locations for compiler files based on the version.
706 ifeq "$(COMPILER_VERSION)" "6"
707 COMPILER_HEADER_DIR = $(COMPILER_ROOT_DIR)/include $(COMPILER_ROOT_DIR)/atl/include
708 COMPILER_LIBRARY_DIR = $(COMPILER_ROOT_DIR)/lib $(COMPILER_ROOT_DIR)/atl/lib
709 RC = $(BUILD_SCRIPTS_PATH)/wrapdoze.sh $(COMPILER_ROOT_DIR)/../common/msdev98/bin/rc
711 ifeq "$(COMPILER_VERSION)" "7"
712 COMPILER_HEADER_DIR = $(COMPILER_ROOT_DIR)/include $(COMPILER_ROOT_DIR)/atlmfc/include $(COMPILER_ROOT_DIR)/platformsdk/include $(FRAMEWORK_DIR)
713 COMPILER_LIBRARY_DIR = $(COMPILER_ROOT_DIR)/lib $(COMPILER_ROOT_DIR)/atlmfc/lib $(COMPILER_ROOT_DIR)/platformsdk/lib
714 RC = $(BUILD_SCRIPTS_PATH)/wrapdoze.sh $(COMPILER_ROOT_DIR)/bin/rc
715 COMPILER_FLAGS += -Zc:forScope
716 # turn on proper loop scoping.
718 ifeq "$(COMPILER_VERSION)" "8"
719 COMPILER_HEADER_DIR = $(COMPILER_ROOT_DIR)/include $(COMPILER_ROOT_DIR)/atlmfc/include $(COMPILER_ROOT_DIR)/platformsdk/include $(FRAMEWORK_DIR)
720 COMPILER_LIBRARY_DIR = $(COMPILER_ROOT_DIR)/lib $(COMPILER_ROOT_DIR)/atlmfc/lib $(COMPILER_ROOT_DIR)/platformsdk/lib
721 RC = $(BUILD_SCRIPTS_PATH)/wrapdoze.sh $(COMPILER_ROOT_DIR)/bin/rc
722 COMPILER_FLAGS += -Zc:forScope
723 # turn on proper loop scoping.
724 DEFINITIONS += _WIN32_WINNT=0x501
725 DEPENDENCY_DEFINITIONS += _WIN32_WINNT=0x501
728 # ver 9 (vis stu 2008) is not in here but is probably similar to 8 or 10.
730 ifeq "$(COMPILER_VERSION)" "10"
731 export PLATYPUS = $(WindowsSdkDir)
732 COMPILER_HEADER_DIR = $(COMPILER_ROOT_DIR)/include $(COMPILER_ROOT_DIR)/atlmfc/include $(PLATYPUS)/include
734 COMPILER_LIBRARY_DIR = $(COMPILER_ROOT_DIR)/lib $(COMPILER_ROOT_DIR)/atlmfc/lib $(PLATYPUS)/lib
735 DEFINITIONS += _WIN32_WINNT=0x501
736 DEPENDENCY_DEFINITIONS += _WIN32_WINNT=0x501
737 RC = $(BUILD_SCRIPTS_PATH)/wrapdoze.sh $(PLATYPUS)/bin/rc
738 COMPILER_FLAGS += -Zc:forScope
739 # turn on proper loop scoping.
741 ifeq "$(COMPILER_HEADER_DIR)" ""
742 HOSEUP = $(shell echo The compiler version is not set. Please define COMPILER_VERSION.)
744 ifeq "$(COMPILER_HEADER_DIR)" ""
745 HOSEUP = $(shell echo The compiler version is not set. Please define COMPILER_VERSION.)
747 ifeq "$(COMPILER_HEADER_DIR)" "0"
748 HOSEUP = $(shell echo The compiler version is not set. Please define COMPILER_VERSION.)
751 # add in the mfc directories.
752 COMPILER_HEADER_DIR += $(COMPILER_ROOT_DIR)/mfc/include
753 COMPILER_LIBRARY_DIR += $(COMPILER_ROOT_DIR)/mfc/lib
755 DEFINITIONS += _Windows _WINDOWS WIN32 __WIN32__ __FLAT__ VC_EXTRALEAN WIN32_LEAN_AND_MEAN ATL_NO_LEAN_AND_MEAN
757 LOAD_FLAG_PREFIX = -subsystem:windows -machine:X86 -nologo
760 MIDL = "$(COMPILER_ROOT_DIR)/../Common7/Tools/Bin"/midl.exe -Oicf $(MIDL_DEFS) $(HEADER_SEARCH_PATH:%=-I% ) $(DEFINITIONS:%=-D% )
761 MIDL_DEFS = -no_robust
763 # additional definitions that get put on the command line for makedep. these
764 # are needed since visual c++ defines them automatically.
765 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
767 # set the flags used by visual c++.
768 CREATE_LIBRARY_FLAG = -out:
770 LIBRARY_PATH_FLAG = -libpath:
771 LINKER_OPTION_SEPARATOR = -link
772 LINKER_OUTPUT_FLAG = -out:
773 OBJECT_NAME_FLAG = -Fo
775 # Add the extra files created by visual c++.
776 #is this needed now that we whack whole output path? CLEANUPS += $(OUTPUT_PATH)/*.*db
778 # compilation parameters for microsoft.
779 # -c specifies compilation without linking.
780 # -EHsc is the flag for turning on exception handling.
781 # -FD is for getting the best dependency checking in visual studio.
782 # -Fd[filename] names the program database (PDB) file used for debugging.
783 # -Fp[filename] names the precompiled header file name.
784 # -FR[filename] names the browser output path used for source analysis.
785 # -Gd calling convention is cdecl.
786 # -Gm enables minimal rebuild (only if source files changed).
787 # Note! as of Visual Studio 6 SP 3, minimal rebuild does not work
788 # properly. Do not use it unless you want inconsistent builds!
789 # -GR enables run-time type identification (RTTI).
790 # -GS enables buffer checking.
791 # -GX turns on synchronous exception handling. (deprecated)
792 # -Gz uses __stdcall calling convention.
793 # -MD specifies multi-threaded DLL (MDd means debug).
794 # -ML signifies uni-threaded executable (MLd means debug).
795 # -MT indicates multi-threaded executable (MTd means debug)
796 # -O is for optimization (1 small code, 2 fast code, d disabled).
797 # do not use 1 or 2 though; they both include "global optimization",
798 # which seems plagued with problems. the specific optimizations are:
799 # -Oa assume no aliasing
800 # -Obn inline function expansion, where n is 1 (enable) or 0 (disable)
801 # -Od disable (for debug)
802 # -Oi generate intrinsic functions
803 # -Og global optimizations (flawed)
804 # -Op improve float consistency
805 # -Os favor small code
806 # -Ot favor fast code
807 # -Ow assume aliasing across function calls
808 # -Ox full optimization
809 # -Oy frame pointer optimization
810 # -O1 has g s y b1 Gs Gf Gy
811 # -O2 has g i t y b1 Gs Gf Gy
812 # -TP C++ compilation.
813 # -W sets the warning level (from 0 (least warnings) through 4 (loudest)).
814 # -WX turns all warnings into errors.
815 # -Yu[filename] uses a precompiled header file.
816 # -YX turns on precompiled headers. not used due to poor implementation.
817 # -Zi generates debugging information into the PDB file.
819 # put the common flags into the compiler flags.
820 COMPILER_FLAGS += -nologo -Fd$(PDB_DIR)/$(PROJECT)_bookkeeping.pdb -GR -W3 -Zi -EHsc -GS -Gd
824 # disable function inlining and optimizations for debug.
825 COMPILER_FLAGS += -Ob0 -Od
827 # enable function inlining for release only.
828 COMPILER_FLAGS += -Ob1
830 ifneq "$(OPTIMIZE)" ""
831 # add in fast code optimization.
832 COMPILER_FLAGS += -O2
839 # linking parameters for microsoft.
840 # -dll specifies that a dynamic library is to be created.
841 # -debug specifies that debugging information is to be included.
842 # -map turns on the map file.
843 # -warn sets the warning level, from 0 to 3, where 3 is the most verbose.
844 # kernel32.lib is the kernel support.
845 # user32.lib is the user level support.
846 # gdi32.lib is the graphical device interface? support.
847 # winspool.lib contains printer support.
848 # comdlg32.lib provides the common dialogs.
849 # advapi32.lib provides deeper win32 features, like registry, services, etc.
851 # ole32.lib supplies OLE support.
852 # oleaut32.lib is the OLE automation library.
853 # uuid.lib has unique id management?
854 # odbc32.lib provides ODBC data source functionality.
855 # odbccp32.lib is something?
856 # winmm.lib has the win32 multimedia support.
857 # version.lib offers up splendid version services.
859 # check if profiling is to be enabled.
861 ifneq "$(PROFILE)" ""
862 PROFILER_FLAG = -profile
865 LIBS_USED += htmlhelp.lib
867 # add the common linker flags. the debugging flag is added because we
868 # want to be able to debug into release code, but since the pdb files
869 # are separate, we are not exposing ourselves when we do not include them.
870 LOAD_FLAG_PREFIX += $(PROFILER_FLAG) -debug -opt:ref -opt:icf
873 # "USE_MFC" dictates whether mfc should be allowed in the application.
874 # the default is not to use MFC extension style dlls. this can be turned
875 # on in the individual makefiles that require MFC.
878 # the library creator gets a couple of flags.
879 LIBRARIAN_FLAGS += -nologo -machine:X86 -subsystem:windows
881 # now, vary the flag configuration based on the flags that have been set.
883 ####override for windows since things are broken with WinMain
884 ###export CONSOLE_MODE = true
886 ifneq "$(CONSOLE_MODE)" ""
887 # console type of applications are built using the static flag so that
888 # they are more redistributable.
889 DEFINITIONS += _CONSOLE
890 LOAD_FLAG_SUFFIX += -subsystem:console
891 LIBRARIAN_FLAGS += -subsystem:console
894 # dynamically linked library or application flags.
897 DEFINITIONS += _DEBUG
898 COMPILER_FLAGS += -MDd
901 DEFINITIONS += NDEBUG
902 COMPILER_FLAGS += -MD
903 LOAD_FLAG_PREFIX += -map
906 ifneq "$(STRICT_WARNINGS)" ""
907 COMPILER_FLAGS += -WX
908 #would like to add W4 but that triggers warnings in microsoft headers.
913 ############################################################################
915 ifeq "$(COMPILER)" "GNU_DARWIN"
916 # Darwin kernel GNU compiler...
918 COMPILER_ROOT_DIR = /
919 PLATFORM_ADD_IN = darwin
920 ARCHITECTURE = $(shell machine 2>/dev/null || arch 2>/dev/null || echo i686)
921 # COMPILER_FLAGS += -fgnu-runtime
923 export COMPILER_VERSION = $(shell $(SHELL) $(CLAM_SCRIPTS)/cpp/get_version.sh $(COMPILER) $(COMPILER_ROOT_DIR) )
925 DEFINITIONS += _FILE_OFFSET_BITS=64
927 DEPENDENCY_DEFINITIONS += NO_VERSION
928 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
930 #protect other additions to make them only for debian?
931 # COMPILER_HEADER_DIR := /usr/include /usr/local/include
932 COMPILER_HEADER_DIR := /System/Library/Frameworks/Foundation.framework/Versions/C/Headers
934 # "USE_XWIN" specifies that this project needs X window system support.
937 # ifeq "x86_64" "$(ARCHITECTURE)"
938 # COMPILER_LIBRARY_DIR = /lib64 /usr/lib64 /usr/local/lib64
941 COMPILER_LIBRARY_DIR = /usr/lib
946 DEFINITIONS += __LINUX__ linux __linux__ UNIX unix __UNIX__ __USE_GNU
947 # X Window System not enabled by default.
948 #DEFINITIONS += __XWINDOWS__
952 # LOAD_FLAG_PREFIX += -Xlinker
956 # -Xlinker --print-map : shows what went in and why.
957 # -Xlinker -O3 : linker optimization
958 CREATE_LIBRARY_FLAG += -r
959 # space on end is significant.
960 LINKER_OUTPUT_FLAG = -o
962 # COMPILER_FLAGS += -shared-libgcc -fPIC
963 #old: -Wl,-export-dynamic
965 # COMPILER_FLAGS += -finline-functions
967 # ifneq "$(STRICT_WARNINGS)" ""
968 # COMPILER_FLAGS += -Wall -Werror -Wextra -pedantic-errors -Wno-long-long
970 # LIBS_USED += dl pthread rt
971 #mac no like these libs
972 # dl=dynamic library.
973 # pthread=thread libraries.
974 # rt=real time libraries for shared memory.
977 # add in debugging flags.
978 # COMPILER_FLAGS += -g3 -O0
982 ############################################################################
984 # these activities are done after the compiler specific stuff.
986 # add a definition for programs to be able to differentiate the versions.
987 DEFINITIONS += COMPILER_VERSION=$(COMPILER_VERSION)
989 # set a variable that scripts can use to get most of the definitions.
990 export VARIABLE_DEFINITION_SET := $(DEFINITIONS)
992 ###############################################################################