1 ###############################################################################
3 # CLAM System default variable definitions for C# compilation.
5 ###############################################################################
7 # Pull in the base support for CLAM.
10 ###############################################################################
12 #CLAM_BINARIES = $(CLAM_SCRIPTS)/../bin
14 ###############################################################################
16 ifneq "$(BUILD_PARAMETER_FILE)" ""
17 # define our version of the build parameter file. this should be set
18 # beforehand so we override the default parameter file for clam.
19 export PARAMETER_FILE = $(BUILD_PARAMETER_FILE)
20 ###no: $(FEISTY_MEOW_APEX)/build/identity.ini
22 ifeq "$(PARAMETER_FILE)" ""
23 # last ditch attempt to get one that will work.
24 export PARAMETER_FILE = $(FEISTY_MEOW_APEX)/build.ini
27 ###############################################################################
29 # BASE_CPU is a flag that distinguishes the type of processor, if necessary.
32 # motorola 68000 series.
40 # set the CPU default if we do not have one.
45 # COMPILER is a flag that specifies the operating system or the compiler for
46 # use in conditional compilation (#ifdef ... #endif) of the compiler dependent
47 # interfaces or implementations.
49 #COMPILER = VISUAL_CPP
51 # choose a default compiler if none was specified.
56 # COMPILER_VERSION specifies the version of a particular compiler, if this is
57 # needed to distinguish how the code is built.
58 export COMPILER_VERSION
60 ###############################################################################
62 # "TYPE" is the kind of product being generated by this project. this is
63 # used to decide where to put the final products of compilation. this is a
64 # variable in the user's makefile.
66 # TYPE = library (outputs are static or dynamic libraries)
67 # TYPE = application (outputs are main-line executables)
68 # TYPE = test (outputs are test programs)
71 ###############################################################################
73 # pseudo-boolean variable section. if these have any value at all, then they
74 # are treated as being true. note that these are flags that should generally
75 # be passed on the command line to a make. if they are intended to be used
76 # from inside a makefile, then they must appear before this file is included.
78 # "REBUILD" causes a rebuild of all source files if it's true.
81 # "DEBUG" is used to specify a debugging build. the default is for this to
82 # be false, which causes a release build.
85 # "OPTIMIZE" creates optimized code.
88 # "NO_COMPILE" just runs through the targets without compiling. it still
89 # promotes headers however.
92 # "BUILD_LIST_FILE" is the set of files that need to be recompiled for
94 export BUILD_LIST_FILE = $(CLAM_TMP)/clam_rebuild.$(PROJECT)
96 # "BUILD_WHACK_FILE" is the set of object files that should be removed if
97 # a build failure occurs.
98 export BUILD_WHACK_FILE = $(CLAM_TMP)/clam_whack.$(PROJECT)
100 # we're adding the build list to the flag files so we know it gets cleaned up.
101 FLAG_FILES += $(BUILD_LIST_FILE) $(BUILD_WHACK_FILE)
103 ###############################################################################
105 # This section implements the HOOPLE directory scheme. If your scheme differs,
106 # then you'll want to modify these appropriately.
108 # "THIRD_PARTY_DIR" is the root of our support libraries.
109 ifeq "$(OP_SYSTEM)" "UNIX"
110 export THIRD_PARTY_DIR
112 ifeq "$(OP_SYSTEM)" "WIN32"
113 export THIRD_PARTY_DIR = $(FEISTY_MEOW_APEX)/3rdparty
116 # "OUTPUT_ROOT" is the root of all output directories for objects and other
117 # products being built.
118 export OUTPUT_ROOT = $(TARGETS_STORE)/obj
120 # "PLATFORM_ADD_IN" is an option discriminator for the intended execution
121 # platform. it should end in an underscore if it is provided.
122 #PLATFORM_ADD_IN = linux_
123 #PLATFORM_ADD_IN = w32_
126 # "CPU_BUILD_DIR" distinguishes object directories by including the cpu
127 # name and the type of build.
129 CPU_BUILD_DIR = $(BASE_CPU)_dbg
131 CPU_BUILD_DIR = $(BASE_CPU)_$(PLATFORM_ADD_IN)rel
134 # "BASE_OUTPUT_PATH" is the parent directory of objects for this type of
135 # cpu and this type of build.
136 export BASE_OUTPUT_PATH = $(OUTPUT_ROOT)/$(CPU_BUILD_DIR)
138 # "OUTPUT_PATH" is the directory to generate all compiled products into.
139 export OUTPUT_PATH = $(BASE_OUTPUT_PATH)/$(PROJECT)
141 # "OBJECT_DIR" is where object files will be stored during compilation for the
142 # target type being produced.
143 export OBJECT_DIR = $(OUTPUT_PATH)
145 # These specify where files are to be created or located for our local build.
146 export EXECUTABLE_DIR = $(TARGETS_STORE)/exe
147 export DYNAMIC_LIBRARY_DIR = $(TARGETS_STORE)/dll
148 export STATIC_LIBRARY_DIR = $(TARGETS_STORE)/lib
149 export TESTS_DIR = $(TARGETS_STORE)/tests
151 # "HEADER_SEARCH_PATH" is where the class interface files are to be found.
152 #HEADER_SEARCH_PATH =
154 # "HOOPLE_HEADERS" are locations where the HOOPLE headers can be found.
155 HOOPLE_HEADERS := $(shell $(FIND) $(FEISTY_MEOW_APEX)/source/lib_src $(FEISTY_MEOW_APEX)/libraries -mindepth 1 -maxdepth 1 -type d)
157 # "LOCAL_HEADERS" are overrides that go first in the header search path.
160 # "CODEBASE_HEADERS" is a list that can be changed for a particular codebase.
161 # it is guaranteed that clam will not interfere with this list, whereas
162 # the LOCAL_HEADERS can be modified by clam.
165 # "LOCAL_LIBRARIES" are overrides that go first in the library search path.
168 # "LIBRARY_SEARCH_PATH" is where the library files are to be found.
169 #LIBRARY_SEARCH_PATH =
171 # "HOOPLE_LIBRARIES" is where our local libraries are located.
174 # "EXTRA_COPIES" is a list of files that are copied to a project's output
178 # "EXTRA_VERSIONS" is a list of version files to synchronize with the main
179 # library version for this build. if a file called "version.ini" exists in
180 # the project directory, then it will automatically be upgraded, so the
181 # extra version files are mainly useful when you have a project with multiple
182 # programs in it and you want them to have independent version files (as you
183 # should perhaps want).
184 export EXTRA_VERSIONS
186 # "OMIT_VERSIONS" is another exclusion flag. this one turns off the creation
187 # of version resource files and eliminates any references that would include
188 # such files. this is needed when rebuilding version_stamper.
191 # Add the obligatory junk to be cleaned up. Individual compiler sections
192 # should customize this by adding their object output directories.
193 CLEANUPS += $(ACTUAL_TARGETS) $(OUTPUT_PATH)
194 #hmmm: import libs for dynamic libraries on ms-win32 don't currently get
197 ###############################################################################
199 # "SEARCH_DIRS" is a list of directories that should be searched for both C++
200 # header files and for C++ code libraries. The items placed in SEARCH_DIRS
201 # are fed into both the LIBRARY_SEARCH_PATH and the HEADER_SEARCH_PATH.
204 # "DEFINITIONS" is a list of compiler flags that define the value of c macros.
205 # These usually have the format of -D<flag>, but in this variable, only the
206 # <flag> itself should be listed because the compiler option -D is added
208 DEFINITIONS = CLAM_BUILT
210 ifneq "$(BOOT_STRAPPING)" ""
211 # the software is being built from the ground up, including the binaries
212 # we use for building (like value_tagger and others).
213 DEFINITIONS += BOOT_STRAPPING
216 # "UNDEFINITIONS" is a list of macros to undefine.
219 #hmmm: these kinds of defines (with a value) do not work for csharp.
220 # GLOBAL_PRODUCT_NAME is an important variable for tagging the entire code base
221 # with some branding. It is provided as a macro definition to all source
222 # files. The initial value for the macro should come from the build init
223 # file, but if it doesn't, we pick a default.
224 ##ifeq "$(product_name)" ""
225 ## DEFINITIONS += GLOBAL_PRODUCT_NAME=\\\"HOOPLE\\\"
227 ## DEFINITIONS += GLOBAL_PRODUCT_NAME=\\\"$(product_name)\\\"
230 # *_PRODUCT_VERSION records parts of our version numbers for the code to see.
231 ###DEFINITIONS += MAJOR_PRODUCT_VERSION=$(major) MINOR_PRODUCT_VERSION=$(minor)
233 # "DEBUG_FLAGS" these flags are used for generating specialized versions of
234 # object files, such as ones that include debugging code or that add code for
236 # Possible values are -g for adding GDB debugging code and -pg for adding
237 # gprof profiling code.
242 # "COMPILER_FLAGS" are the flags for the pre-processor and compiler.
245 # "STRICT_WARNINGS" turns on all warnings and forces them to be considered
246 # as errors when encountered.
249 # "LIBRARIAN_FLAGS" are flags that need to be passed to the library tool
250 # that creates static code libraries.
253 # "SOURCE" is the list of files that are turned into objects.
256 # "LIBS_USED" are system or compiler code libraries that the targets to be
257 # created depend upon.
260 # "LOCAL_LIBS_USED" is very similar to the LIBS_USED, but these libraries
261 # actually cause executables and object files to be recompiled when the
262 # libraries specified have changed. To accomplish this, these libraries MUST
263 # be located in the STATIC_LIBRARY_DIR rather than at some arbitrary place
264 # on the LIBRARY_SEARCH_PATH.
267 # Load flags tell the linker and loader how to deal with the files and where
268 # to locate library components. The prefix goes before object files are
269 # listed, and the suffix after. The prefix should have things like the
270 # directories to be searched for code libraries (although they should be added
271 # to LIBRARY_SEARCH_PATH) and the loading mode for functions (static/dynamic).
272 # In the suffix, actual library loading statements (like -lmath) can be
273 # included (although they should be listed in a different form in LIBS_USED).
274 # Remember that the unix loader looks for functions in libraries in a bizarre
275 # way: ld searches for a function only when it has already been asked for it.
276 # This means that it doesn't remember what functions it has already been
277 # provided with in the libraries and object files, and it will fail if those
278 # functions are only asked for after they have already been encountered.
282 # The prefix used on library names, mostly for unix.
284 # The standard suffix for static or import libraries on this operating system.
287 # Flag for specifying the library name to create.
288 #CREATE_LIBRARY_FLAG =
290 # Flag for specifying a library to include in linking.
291 LIBRARY_NAME_FLAG = -l
293 # Flag for specifying a directory to add to the search path for libs.
294 #LIBRARY_PATH_FLAG = -L
296 # Flag for specifying the name of an output from the linker.
297 #LINKER_OUTPUT_FLAG =
299 # Flag for separating linker options from compilation options for a combined
301 #LINKER_OPTION_SEPARATOR =
303 # Flag that passes special options when building executable programs. It is
304 # passed just before the LOAD_FLAG_PREFIX.
307 # The name of the compiler tool.
310 # The name of the library creator tool.
313 # the root name of the version file. This is currently irrelevant on
314 # non-win32 platforms.
315 VERSION_RC_ROOT = $(shell $(SHELL) $(CLAM_SCRIPTS)/cpp/rc_name.sh)
316 # we import the rc_name from our close ally, the c++ compiler definitions.
318 ###############################################################################
320 # Compiler Dependent Flags
322 # "COMPILER_ROOT_DIR" is the top-level for the C++ compiler location.
323 # "COMPILER_HEADER_DIR" is where the compiler's headers are.
324 export COMPILER_HEADER_DIR
325 # "COMPILER_LIBRARY_DIR" is where archived libraries are.
326 # "CC" is the name of the C++ compiler to be used.
328 ifeq "$(COMPILER)" "VISUAL_CPP"
329 # microsoft visual studio 7.
332 PLATFORM_ADD_IN = w32_
334 # these define special characteristics for a program being built.
335 # BASE is almost always defined and pulls in fundamental w32 support.
336 # RPC supplies the remote procedure call libraries.
337 # OLE pulls in object linking and embedding support.
338 # SECURITY links with the w32 security APIs.
339 # CLR sets options that are appropriate for managed code.
347 # the framework dir points at the .net framework to be used for compilation.
348 ifeq "$(FRAMEWORK_VERSION)" ""
351 # SHORT_FRAMEWORK_VERSION = 1.1
352 # FRAMEWORK_VERSION = $(SHORT_FRAMEWORK_VERSION).4322
355 # SHORT_FRAMEWORK_VERSION = 2.0
356 # FRAMEWORK_VERSION = $(SHORT_FRAMEWORK_VERSION).50727
359 SHORT_FRAMEWORK_VERSION = 3.5
360 FRAMEWORK_VERSION = $(SHORT_FRAMEWORK_VERSION)
364 ifeq "$(FRAMEWORK_DIR)" ""
365 FRAMEWORK_DIR = $(subst \,/,$(WINDIR))/Microsoft.NET/Framework/v$(FRAMEWORK_VERSION)
368 # pick a default compiler version for what we tend to use the most at the
370 ifeq "$(COMPILER_VERSION)" ""
373 ## DEFINITIONS += COMPILER_VERSION=$(COMPILER_VERSION)
374 # add a macro so programs can check what version is appropriate.
376 # C# needs an entry point for exes. a different one can be specified also.
379 # C# treats resources differently than simple code files. the list in this
380 # variable will be embedded in the target.
383 # TLBEXPORT is a tool to create TLB files from DLL files.
384 TLBEXPORT = $(COMPILER_ROOT_DIR)/../SDK/v$(SHORT_FRAMEWORK_VERSION)/bin/tlbexp$(EXE_END)
386 # calculate the visual studio root directory.
387 export VIS_STU_ROOT := $(shell $(SHELL) $(CLAM_SCRIPTS)/cpp/ms_root_dir.sh $(CLAM_BINARIES) )
388 ifneq "$(VIS_STU_ROOT)" ""
389 COMPILER_ROOT_DIR = $(VIS_STU_ROOT)/vc#
391 ifeq "$(COMPILER_ROOT_DIR)" ""
392 HOSEUP = $(shell echo The compiler directory is not set. Please define the environment )
393 HOSEUP = $(shell echo variable VSxCOMNTOOLS to point at the folder where visual C++ is installed. )
397 export COMPILER_VERSION = $(shell $(SHELL) $(CLAM_SCRIPTS)/cpp/get_version.sh $(COMPILER) $(COMPILER_ROOT_DIR) )
399 # set a variable for the resource compiler for old-style resources.
400 STANDARD_RC = $(VIS_STU_ROOT)/vc/bin/rc
402 # set up a directory for debugging files to be stored. these are not
403 # moved with the postconditions--they are generated in place.
404 export PDB_DIR=$(TARGETS_STORE)/pdb
406 # set these way up here so we can override them later.
407 CC = bash $(CLAM_SCRIPTS)/csharp/csharper.sh
408 ##$(FRAMEWORK_DIR)/csc
410 # LINK_TOOL = $(COMPILER_ROOT_DIR)/bin/link
412 # vary the locations for compiler files based on the version.
413 COMPILER_HEADER_DIR = $(VIS_STU_ROOT)/vc/include $(VIS_STU_ROOT)/vc/atlmfc/include $(VIS_STU_ROOT)/vc/platformsdk/include
414 COMPILER_LIBRARY_DIR =
415 ###$(COMPILER_ROOT_DIR)/lib $(COMPILER_ROOT_DIR)/atlmfc/lib $(COMPILER_ROOT_DIR)/platformsdk/lib
416 RC = $(COMPILER_ROOT_DIR)/../SDK/v2.0/bin/resgen$(EXE_END)
418 ifeq "$(COMPILER_HEADER_DIR)" ""
419 HOSEUP = $(shell echo The compiler version is not set. Please define COMPILER_VERSION.)
422 DEFINITIONS += _Windows _WINDOWS WIN32 __WIN32__ __FLAT__ VC_EXTRALEAN WIN32_LEAN_AND_MEAN ATL_NO_LEAN_AND_MEAN _WIN32_WINNT=0x403
424 LIBRARY_TOOL = $(COMPILER_ROOT_DIR)/bin/lib
425 LOAD_FLAG_PREFIX = -nologo
426 #-subsystem:windows -machine:IX86
429 MIDL = midl -Oicf $(MIDL_DEFS) $(HEADER_SEARCH_PATH:%=-I% ) $(DEFINITIONS:%=-I% )
430 MIDL_DEFS = -no_robust
432 # set the flags used by visual c++.
433 CREATE_LIBRARY_FLAG = -out:
434 LIBRARY_NAME_FLAG = -reference:
435 LIBRARY_PATH_FLAG = -lib:
436 LINKER_OPTION_SEPARATOR = -link
437 LINKER_OUTPUT_FLAG = -out:
439 # Add the extra files created by visual c++.
440 #is this needed now that we whack whole output path? CLEANUPS += $(OUTPUT_PATH)/*.*db
442 # put the common flags into the compiler flags.
443 COMPILER_FLAGS += -nologo
444 #-Fd$(PDB_DIR)/$(PROJECT)_bookkeeping.pdb -GR -GX -W3 -Zi -EHsc -GS -Gd
447 # disable function inlining and optimizations for debug.
448 # COMPILER_FLAGS += -Ob0 -Od
450 # enable function inlining for release only.
451 # COMPILER_FLAGS += -Ob1
453 ifneq "$(OPTIMIZE)" ""
454 # add in fast code optimization.
456 # COMPILER_FLAGS += -O2
457 #trying O2 again although it seems to combust too easily.
464 # check if profiling is to be enabled.
466 ifneq "$(PROFILE)" ""
467 PROFILER_FLAG = -profile
470 # add the common linker flags. the debugging flag is added because we
471 # want to be able to debug into release code, but since the pdb files
472 # are separate, we're not exposing ourselves when we don't include them.
473 LOAD_FLAG_PREFIX += $(PROFILER_FLAG) -debug
476 # "USE_MFC" dictates whether mfc should be allowed in the application.
477 # the default is not to use MFC extension style dlls. this can be turned
478 # on in the individual makefiles that require MFC.
481 # the library creator gets a couple of flags.
482 LIBRARIAN_FLAGS += -nologo -machine:IX86
484 # now, vary the flag configuration based on the flags that have been set.
486 ifneq "$(CONSOLE_MODE)" ""
487 # console type of applications are built using the static flag so that
488 # they are more redistributable.
489 DEFINITIONS += _CONSOLE
490 ### LOAD_FLAG_SUFFIX += -subsystem:console
494 # dynamically linked library or application flags.
497 DEFINITIONS += _DEBUG
498 # COMPILER_FLAGS += -MDd
501 DEFINITIONS += NDEBUG
502 # COMPILER_FLAGS += -MD
505 ifneq "$(STRICT_WARNINGS)" ""
506 # COMPILER_FLAGS += -W3 -WX
507 # we have not turned on W4 because it is not really warnings for the
508 # microsoft compiler. instead, it is a bunch of blather about what the
509 # compiler intends to do rather than problems in the code.