1 ###############################################################################
3 # CLAM System default rules and targets for C++ compilation.
5 # This file composite macros and rules for creating compilation objects
6 # (such as library archives, object files, executable programs, and others).
8 # This file should be included in the user's Makefile after the variables
9 # have been initialized appropriately for the particular project being
10 # compiled. The user's own targets should be placed after the include
11 # directive that specifies this file.
13 ###############################################################################
15 # This section manipulates variable values to prepare them for their use
16 # in the standard CLAM support.
18 # see if they have got the clean flag set. if so, we will not build anything.
22 # also omit version compilation and some logging when not compiling.
23 ifneq "$(NO_COMPILE)" ""
27 # implement special bits for gnu on unix.
28 ifeq "$(COMPILER)" "GNU_LINUX"
29 ifneq "$(USE_XWIN)" ""
30 DEFINITIONS += __XWINDOWS__ __X__
31 LIBS_USED += Xm Xt X11 Xft Xp
32 #need to separate out with a USE_MOTIF kind of thing.
34 HEADER_SEARCH_PATH += /usr/include/X11 /usr/X11R6/include /usr/include/g++
35 LIBRARY_SEARCH_PATH += /usr/X11R6/lib
39 LIBS_USED += ssl crypto
42 ifneq "$(USE_WXWIDGETS)" ""
43 DEFINITIONS += __WXWIDGETS__
45 ifneq "$(findstring UNICODE, $(DEFINITIONS))" ""
49 # decide whether to turn on the unicode flag or not.
50 ifneq "$(use_unicode)" ""
51 DEFINITIONS += wxUSE_UNICODE
52 UNICODE_FLAG_ADD = --unicode=yes
54 UNICODE_FLAG_ADD = --unicode=no
56 # could add for debugging: --debug=yes
57 COMPILER_FLAGS += $(shell wx-config --cxxflags $(UNICODE_FLAG_ADD) )
59 LOAD_FLAG_PREFIX += $(shell wx-config --libs $(UNICODE_FLAG_ADD) )
62 ifneq "$(USE_CURL)" ""
63 COMPILER_FLAGS += `curl-config --cflags`
64 LOAD_FLAG_SUFFIX += `curl-config --libs`
68 # some special code for gnu compiler on windows.
69 ifeq "$(COMPILER)" "GNU_WINDOWS"
72 LIBS_USED += ssl crypto
75 ifneq "$(USE_WXWIDGETS)" ""
76 DEFINITIONS += __WXWIDGETS__
78 ifneq "$(findstring UNICODE, $(DEFINITIONS))" ""
82 # decide whether to turn on the unicode flag or not.
83 ifneq "$(use_unicode)" ""
84 DEFINITIONS += wxUSE_UNICODE
85 UNICODE_FLAG_ADD = --unicode=yes
87 UNICODE_FLAG_ADD = --unicode=no
89 # could add for debugging: --debug=yes
90 COMPILER_FLAGS += $(shell wx-config --cxxflags $(UNICODE_FLAG_ADD) )
92 LOAD_FLAG_PREFIX += $(shell wx-config --libs $(UNICODE_FLAG_ADD) )
95 ifneq "$(USE_CURL)" ""
96 COMPILER_FLAGS += `curl-config --cflags`
97 LOAD_FLAG_SUFFIX += `curl-config --libs`
102 ###############################################################################
104 ifeq "$(COMPILER)" "GNU_DARWIN"
105 ifneq "$(USE_XWIN)" ""
106 DEFINITIONS += __XWINDOWS__ __X__
109 #need to separate out with a USE_MOTIF kind of thing.
111 HEADER_SEARCH_PATH += /usr/include/X11 /usr/X11R6/include /usr/include/g++
112 LIBRARY_SEARCH_PATH += /usr/X11R6/lib
115 ifneq "$(USE_SSL)" ""
119 ifneq "$(USE_WXWIDGETS)" ""
120 DEFINITIONS += __WXWIDGETS__
122 ifneq "$(findstring UNICODE, $(DEFINITIONS))" ""
126 # decide whether to turn on the unicode flag or not.
127 ### ifneq "$(findstring UNICODE, $(DEFINITIONS))" ""
128 ifneq "$(use_unicode)" ""
129 UNICODE_FLAG_ADD = --unicode=yes
130 DEFINITIONS += wxUSE_UNICODE
132 UNICODE_FLAG_ADD = --unicode=no
135 COMPILER_FLAGS += $(shell wx-config --cxxflags $(UNICODE_FLAG_ADD) )
136 LOAD_FLAG_PREFIX += $(shell wx-config --libs $(UNICODE_FLAG_ADD) )
139 ifneq "$(USE_CURL)" ""
140 COMPILER_FLAGS += `curl-config --cflags`
141 LOAD_FLAG_SUFFIX += `curl-config --libs`
146 ###############################################################################
149 # additions for gnu x86 and arm compilers.
150 ifneq "$(OP_SYSTEM)" "WIN32"
151 # is the freetds library support available on this host.
152 ifneq "$(ENABLE_FREETDS)" ""
153 # establish the headers if freetds is enabled. that just means things
154 # can be compiled against it. to link in the db-lib, the makefile should
155 # have a 'USE_FREETDS = true' statement.
157 # is this particular library or app using freetds?
158 ifneq "$(USE_FREETDS)" ""
159 DEFINITIONS += ENABLE_FREETDS _FREETDS_LIBRARY_SOURCE
160 LIBS_USED += rt sybdb
165 # win32 compiler additions.
166 ifeq "$(OP_SYSTEM)" "WIN32"
167 #ifeq "$(COMPILER)" "VISUAL_CPP"
168 # processes the def file for linkage, if one has been specified.
169 ifneq "$(DEF_FILE)" ""
170 LOAD_FLAG_PREFIX += -def:$(DEF_FILE)
173 ifneq "$(TYPE)" "library"
174 ifneq "$(USE_MFC)" ""
175 ifneq "$(findstring UNICODE, $(DEFINITIONS))" ""
176 # specify the winmain type for unicode explicitly.
177 LOAD_FLAG_PREFIX += -entry:wWinMainCRTStartup
182 # these are loaded after any special debugging libs.
183 ifneq "$(VCPP_USE_BASE)" ""
184 # the first set will be included in almost any old program. we include
185 # winmm for multimedia in the base support since we make heavy use of the
186 # more accurate uptime function.
187 LOAD_FLAG_PREFIX += kernel32.lib user32.lib advapi32.lib shell32.lib \
188 version.lib winmm.lib shlwapi.lib
191 ifneq "$(USE_WXWIDGETS)" ""
192 DEFINITIONS += __WXWIDGETS__ __WXMSW__
193 LOCAL_HEADERS += $(THIRD_PARTY_DIR)/wxwidgets/include
194 LIBRARY_SEARCH_PATH += $(THIRD_PARTY_DIR)/wxwidgets/lib
195 # ifeq "$(findstring UNICODE, $(DEFINITIONS))" ""
196 LIBS_USED += wxmsw28_core.lib
197 LOCAL_HEADERS += $(THIRD_PARTY_DIR)/wxwidgets/lib/msw
199 # DEFINITIONS += wxUSE_UNICODE
200 # LIBS_USED += wxmsw28u_core.lib
201 # LOCAL_HEADERS += $(THIRD_PARTY_DIR)/wxwidgets/lib/mswu
204 ## LOAD_FLAG_PREFIX += comctl32.lib shell32.lib
209 ifneq "$(USE_CURL)" ""
210 # curl wants this win32 flag?
211 # DEFINITIONS += _WIN32
212 LOCAL_HEADERS += $(THIRD_PARTY_DIR)/curl/include
213 LIBRARY_SEARCH_PATH += $(THIRD_PARTY_DIR)/curl/lib
214 # LIBS_USED += libcurl.dll.a
215 LIBS_USED += libcurl.lib
218 ifneq "$(VCPP_USE_GUI)" ""
219 LOAD_FLAG_PREFIX += comctl32.lib comdlg32.lib gdi32.lib winspool.lib
222 ifneq "$(VCPP_USE_OLE)" ""
223 LOAD_FLAG_PREFIX += ole32.lib oleaut32.lib uuid.lib
226 ifneq "$(VCPP_USE_RPC)" ""
227 ifeq "$(COMPILER_VERSION)" "8"
228 LOAD_FLAG_PREFIX += rpcndr.lib rpcns4.lib rpcrt4.lib
230 ifeq "$(COMPILER_VERSION)" "10"
231 LOAD_FLAG_PREFIX += rpcrt4.lib
235 ifneq "$(VCPP_USE_SOCK)" ""
236 LOAD_FLAG_PREFIX += netapi32.lib ws2_32.lib
238 ifneq "$(VCPP_USE_CLR)" ""
239 LOAD_FLAG_PREFIX += -noentry -include:"__DllMainCRTStartup@12"
240 COMPILER_FLAGS += -EHa -clr -AI "$(FRAMEWORK_DIR)" -AI "$(DYNAMIC_LIBRARY_DIR)" -FU "mscorlib.dll" -FU "System.dll" -FU "System.Data.dll" -FU "System.Windows.Forms.dll" -FU "System.Drawing.dll"
243 ifneq "$(USE_SSL)" ""
244 LOCAL_HEADERS += $(THIRD_PARTY_DIR)/openssl/include
245 LIBRARY_SEARCH_PATH += $(THIRD_PARTY_DIR)/openssl/lib
246 LIBS_USED += libcrypto.lib libssl.lib
247 # LIBS_USED += libeay32.lib
248 $(shell cp $(THIRD_PARTY_DIR)/openssl/lib/*dll $(EXECUTABLE_DIR) )
253 ifeq "$(OP_SYSTEM)" "WIN32"
254 # prep the actual source variable so that certain file names are translated.
255 ACTUAL_RESX = $(RESX:%.resx=$(OBJECT_DIR)/%.resources)
256 ACTUAL_RESX_FLAGS = $(ACTUAL_RESX:%=-ASSEMBLYLINKRESOURCE:%)
262 # Create the real list of local libraries needed.
263 TEMP_LOC1 = $(LOCAL_LIBS_USED:%=%$(TRIPART_VERSION))
264 ACTUAL_LOCAL_LIBS = $(TEMP_LOC1)
266 # Create the list of objects from the list of source files.
267 TEMP_OBJ1 = $(SOURCE:%.cpp=%.obj)
268 TEMP_OBJ2 = $(TEMP_OBJ1:%.c=%.obj)
269 ifeq "$(OP_SYSTEM)" "WIN32"
270 ifneq "$(OMIT_VERSIONS)" ""
271 # remove version rc files if we're not dealing with versions.
272 TEMP_OBJ3a = $(TEMP_OBJ2:%_version.rc=)
274 TEMP_OBJ3a = $(TEMP_OBJ2)
276 ifeq "$(COMPILER)" "VISUAL_CPP"
277 TEMP_OBJ3 = $(TEMP_OBJ3a:%.rc=%.res)
279 TEMP_OBJ3 = $(TEMP_OBJ3a)
282 # replace this when supporting resource files on unix.
283 TEMP_OBJ3 = $(TEMP_OBJ2:%.rc=)
285 TEMP_OBJ4 = $(TEMP_OBJ3:%.h=%.bad)
286 OBJECTS = $(TEMP_OBJ4)
288 # special case for multi-build and res files that need to be rebuilt.
289 #RES_OBJECTS_0 = $(SOURCE:%.cpp=)
290 #RES_OBJECTS_1 = $(RES_OBJECTS_0:%.c=)
291 #RES_OBJECTS = $(RES_OBJECTS_1:%.rc=$(OBJECT_DIR)/%.res)
293 # not much conversion anymore...
294 ACTUAL_OBJECTS = $(OBJECTS) $(EXTRA_OBJECTS)
296 # Updates the search path for the compiler and local libraries.
297 BASE_HEADER_PATH = $(CODEBASE_HEADERS) $(LOCAL_HEADERS) $(HOOPLE_HEADERS) $(SEARCH_DIRS)
298 HEADER_SEARCH_PATH += $(BASE_HEADER_PATH) $(COMPILER_HEADER_DIR)
300 LIBRARY_SEARCH_PATH += $(LOCAL_LIBRARIES) $(HOOPLE_LIBRARIES) \
301 $(STATIC_LIBRARY_DIR) $(COMPILER_LIBRARY_DIR) $(SEARCH_DIRS)
303 # Adds some directories that must be searched onto the search path for
304 # header files, such as the header file directory for the compiler.
305 COMPILER_FLAGS += $(HEADER_SEARCH_PATH:%=-I%) $(DEFINITIONS:%=-D%) $(UNDEFINITIONS:%=-U%) -DGLOBAL_PRODUCT_NAME="$(GLOBAL_PRODUCT_NAME)"
307 # The load flags are updated by looking for code libraries in the directories
308 # to search and by adding all of the code libraries that are used.
309 LOAD_FLAG_PREFIX += $(LIBRARY_SEARCH_PATH:%=$(LIBRARY_PATH_FLAG)%)
310 ifeq "$(OP_SYSTEM)" "UNIX"
311 ifneq "$(COMPILER)" "GNU_DARWIN"
312 LOAD_FLAG_PREFIX += -Xlinker --start-group
313 LOAD_FLAG_SUFFIX += -Xlinker --end-group
316 # had to switch from prefix to suffix recently. oddity.
317 #LOAD_FLAG_PREFIX += $(LIBS_USED:%=$(LIBRARY_NAME_FLAG)%)
318 LOAD_FLAG_SUFFIX += $(LIBS_USED:%=$(LIBRARY_NAME_FLAG)%)
320 # we steal the exe targets and represent their dependency from the hidden
322 EXE_TEMP_0 = $(TARGETS:%.dll=)
323 EXE_TEMP_1 = $(EXE_TEMP_0:%.so=)
324 EXE_TEMP_2 = $(EXE_TEMP_1:%.lib=)
325 EXE_TEMP_3 = $(EXE_TEMP_2:%.elf=%.cpp)
326 EXE_CPPS = $(EXE_TEMP_3:%.exe=%.cpp)
328 # used for compiling multiple source files at the same time with visual cpp.
329 MULTI_BUILD_CMD = $(CC) $(COMPILER_FLAGS) -c `cat $(BUILD_LIST_FILE)` $(OBJECT_NAME_FLAG)$(OBJECT_DIR)/
331 # prepare for mfc style DLLs. currently we plan on all dlls we create being
332 # based on MFC. this is an unfortunate requirement for using the mfc debug
333 # support for allocations; if regular new and DEBUG_NEW get mixed together,
334 # crashes used to result. supposedly these are gone now at least.
335 ifneq "$(USE_MFC)" ""
336 ifeq "$(OP_SYSTEM)" "WIN32"
337 # set the flag that says we are doing mfc extension dlls.
338 DEFINITIONS += _AFXDLL
339 DEPENDENCY_DEFINITIONS += _MT _DLL
340 DEPENDENCY_DEFINITIONS += __AFXWIN_H__ # add this flag to shut stdafx up.
344 ifeq "$(OMIT_VERSIONS)" ""
345 ifneq "$(VERSION_RC_ROOT)" ""
346 VERSION_TARGET = $(VERSION_RC_ROOT)_version.rc
350 ifneq "$(GENDEPS)" ""
351 EXTRA_FIRST_TARGETS += gendeps
354 # only do the deps generation for makefiles that are properly marked.
355 ifneq "$(findstring __BUILD_STATIC_APPLICATION__, $(DEFINITIONS))" ""
356 # generate static build dependencies for all targets in the makefile.
357 GENERATED_DEPS_LIST = $(TARGETS:%.exe=%.gendeps)
360 # Make sure that the directory for objects exists.
361 ACTUAL_FIRST_TARGETS = check_requirements $(EXTRA_FIRST_TARGETS) $(VERSION_TARGET) $(FIRST_TARGETS) pre_compilation
363 # Adds the primary targets to the list of products to create.
364 ifeq "$(NO_COMPILE)" ""
365 ifneq "$(COMPILER)" "VISUAL_CPP"
366 ACTUAL_TARGETS1 = $(TARGETS:%.exe=$(EXECUTABLE_DIR)/%)
368 ACTUAL_TARGETS1 = $(TARGETS:%.exe=$(EXECUTABLE_DIR)/%.exe)
370 ifneq "$(COMPILER)" "VISUAL_CPP"
371 ACTUAL_TARGETS2 = $(ACTUAL_TARGETS1:%.dll=%.so)
372 ACTUAL_TARGETS3 = $(ACTUAL_TARGETS2:%.so=$(DYNAMIC_LIBRARY_DIR)/%$(TRIPART_VERSION).so)
374 ACTUAL_TARGETS2 = $(ACTUAL_TARGETS1:%.so=%.dll)
375 ACTUAL_TARGETS3 = $(ACTUAL_TARGETS2:%.dll=$(DYNAMIC_LIBRARY_DIR)/%$(TRIPART_VERSION).dll)
377 ACTUAL_TARGETS4 = $(ACTUAL_TARGETS3:%.lib=$(STATIC_LIBRARY_DIR)/%$(TRIPART_VERSION).library)
378 ACTUAL_TARGETS = $(ACTUAL_TARGETS4:%.elf=$(EXECUTABLE_DIR)/%.elf)
380 ACTUAL_TARGETS1 = $(TARGETS:%.exe=)
381 ACTUAL_TARGETS2 = $(ACTUAL_TARGETS1:%.dll=)
382 ACTUAL_TARGETS3 = $(ACTUAL_TARGETS2:%.so=)
383 ACTUAL_TARGETS4 = $(ACTUAL_TARGETS3:%.lib=)
384 ACTUAL_TARGETS = $(ACTUAL_TARGETS4:%.elf=)
387 # Adds the last few targets for CLAM to do.
388 ACTUAL_LAST_TARGETS = post_compilation $(LAST_TARGETS)
390 ############################################################################
392 # This section defines the rules used to generate various objects from their
395 ############################################################################
397 # The first section provides simplistic pseudo-targets for testing compilation
398 # rather than generating built products.
400 # the blank target is used to (somewhat) safely remove items from the SOURCE
401 # list. it is an empty file that should be able to go in a library archive
402 # without hosing it up.
404 ifeq "$(NO_COMPILE)" ""
405 $(CATCHER)$(CC) -c $(CLAM_DIR)/cpp/blank_target.c -o $@
409 @echo There is a problem with the makefile in the SOURCE variable.
410 @echo The offending item is: $@
411 $(HIDESH)$(CLAM_DIR)/exit_make.sh
413 ## faked debug object.
415 #ifeq "$(NO_COMPILE)" ""
417 # $(CATCHER)$(CC) $(COMPILER_FLAGS) -c $< $(OBJECT_NAME_FLAG)$(TEMP)/$@
420 # recreate dependencies for static applications.
422 @echo "Generating Static Deps: $*.cpp"
423 $(CATCHER)$(CLAM_DIR)/cpp/buildor_gen_deps.sh "$*.cpp"
425 ############################################################################
427 # C++ source to object file translation.
428 # if there is a special set of flags for this source file, we use them
429 # instead of the default compiler flags.
431 $(OBJECT_DIR)/%.obj: $(CURRENT_DIR)/%.cpp
432 ifeq "$(NO_COMPILE)" ""
433 ifneq "$(COMPILER)" "VISUAL_CPP"
434 @echo Compiling Object [$(notdir $@)]
435 $(HIDESH)-c 'if [ ! -d $(@D) ]; then mkdir $(@D); fi'
436 $(CATCHER)$(CC) $(COMPILER_FLAGS) -c $< $(OBJECT_NAME_FLAG)$@
438 @echo $< >>$(BUILD_LIST_FILE)
439 @echo $@ >>$(BUILD_WHACK_FILE)
444 ############################################################################
446 # C source to object file translation.
448 $(OBJECT_DIR)/%.obj: $(CURRENT_DIR)/%.c
449 ifeq "$(NO_COMPILE)" ""
450 ifneq "$(COMPILER)" "VISUAL_CPP"
451 @echo Compiling Object [$(notdir $@)]
452 $(HIDESH)-c 'if [ ! -d $(@D) ]; then mkdir $(@D); fi'
453 $(CATCHER)$(CC) $(COMPILER_FLAGS) -c $< $(OBJECT_NAME_FLAG)$@
455 @echo $< >>$(BUILD_LIST_FILE)
456 @echo $@ >>$(BUILD_WHACK_FILE)
461 ############################################################################
463 # resource compiler for win32.
465 ifeq "$(OP_SYSTEM)" "WIN32"
466 $(OBJECT_DIR)/%.res: %.rc $(PARAMETER_FILE)
467 ifeq "$(NO_COMPILE)" ""
469 $(HIDESH)-c 'if [ ! -d $(@D) ]; then mkdir $(@D); fi'
470 $(CATCHER)$(RC) -r $(DEFINITIONS:%=-D%) $(HEADER_SEARCH_PATH:%=-i%) -fo $@ $<
473 $(OBJECT_DIR)/%.resources: %.resx $(PARAMETER_FILE)
474 ifeq "$(NO_COMPILE)" ""
476 $(HIDESH)-c 'if [ ! -d $(@D) ]; then mkdir $(@D); fi'
477 $(VCS_ROOT)/../SDK/v1.1/bin/resgen $< $@
480 # this platform probably does not use rc files.
481 $(OBJECT_DIR)/%.res: %.rc
482 ifeq "$(NO_COMPILE)" ""
483 @echo Bogus resource [$@]
488 ############################################################################
490 # creates static libraries.
491 ifneq "$(NO_COMPILE)" ""
492 $(STATIC_LIBRARY_DIR)/%.library:
495 ifeq "$(NO_COMPILE)" ""
496 $(STATIC_LIBRARY_DIR)/%.library: $(ACTUAL_OBJECTS:%=$(OBJECT_DIR)/%) $(ACTUAL_LOCAL_LIBS:%=$(STATIC_LIBRARY_DIR)/$(LIB_PREFIX)%$(LIB_ENDING)) $(PARAMETER_FILE)
497 $(HIDER)echo Building Static Library [$(notdir $@)]
498 @echo $@ >$(DIRTY_FILE)
499 ifeq "$(COMPILER)" "VISUAL_CPP"
500 $(HIDESH)-c 'if [ -f $(BUILD_LIST_FILE) ]; then $(SHELL) $(CLAM_DIR)/cpp/rebuild_oldies.sh $(MULTI_BUILD_CMD); fi'
502 $(CATCHER)$(LIBRARY_TOOL) $(LIBRARIAN_FLAGS) $(CREATE_LIBRARY_FLAG)$@ $(ACTUAL_OBJECTS:%=$(OBJECT_DIR)/%)
503 ifneq "$(OP_SYSTEM)" "UNIX"
504 $(HIDER)mv $@ $(STATIC_LIBRARY_DIR)/$(LIB_PREFIX)$*$(LIB_ENDING)
508 $(HIDER)rm -f $(STATIC_LIBRARY_DIR)/$(LIB_PREFIX)$*$(LIB_ENDING)
509 $(HIDER)ln -s $@ $(STATIC_LIBRARY_DIR)/$(LIB_PREFIX)$*$(LIB_ENDING)
513 ############################################################################
515 # creates dynamic libraries.
517 # we whack any existing LIB file, since we want to use changes in that file
518 # as a clue for when we should rescan the dependencies. we'd be fine if
519 # visual c++ didn't keep an existing LIB if it doesn't change (even when the
522 ifneq "$(NO_COMPILE)" ""
523 $(DYNAMIC_LIBRARY_DIR)/%.dll:
526 ifeq "$(NO_COMPILE)" ""
527 $(DYNAMIC_LIBRARY_DIR)/%.dll: $(ACTUAL_OBJECTS:%=$(OBJECT_DIR)/%) $(ACTUAL_LOCAL_LIBS:%=$(STATIC_LIBRARY_DIR)/$(LIB_PREFIX)%$(LIB_ENDING)) $(ACTUAL_RESX) $(PARAMETER_FILE)
528 #hmmm: use the res objects variable to rebuild res files as needed.
530 $(HIDER)echo Building Dynamic Library [$(notdir $@)]
531 @echo $@ >$(DIRTY_FILE)
532 ifeq "$(COMPILER)" "VISUAL_CPP"
533 $(HIDESH)-c 'if [ -f $(BUILD_LIST_FILE) ]; then $(SHELL) $(CLAM_DIR)/cpp/rebuild_oldies.sh $(MULTI_BUILD_CMD); fi'
535 $(HIDER)rm -f $(@:%.dll=%.lib)
536 echo about to run link tool.
537 $(CATCHER)$(LINK_TOOL) $(LINKER_OUTPUT_FLAG)$@ -dll $(LOAD_FLAG_PREFIX) $(ACTUAL_OBJECTS:%=$(OBJECT_DIR)/%) $(ACTUAL_RESX_FLAGS) $(ACTUAL_LOCAL_LIBS:%=$(LIBRARY_NAME_FLAG)$(LIB_PREFIX)%$(LIB_ENDING)) $(LOAD_FLAG_SUFFIX)
539 ifeq "$(COMPILER_VERSION)" "8"
540 $(HIDESH)$(CLAM_DIR)/cpp/ms_manifest.sh "$@" "2"
542 ifeq "$(COMPILER_VERSION)" "10"
543 $(HIDESH)$(CLAM_DIR)/cpp/ms_manifest.sh "$@" "2"
545 ifneq "$(VCPP_VISTA_ICON)" ""
546 $(HIDER)ReplaceVistaIcon "$@" "$(VCPP_VISTA_ICON)"
550 ifneq "$(NO_COMPILE)" ""
551 $(DYNAMIC_LIBRARY_DIR)/%.so:
554 ifeq "$(NO_COMPILE)" ""
555 $(DYNAMIC_LIBRARY_DIR)/%.so: $(ACTUAL_OBJECTS:%=$(OBJECT_DIR)/%) $(ACTUAL_LOCAL_LIBS:%=$(STATIC_LIBRARY_DIR)/$(LIB_PREFIX)%$(LIB_ENDING)) $(PARAMETER_FILE)
556 ifeq "$(COMPILER:%_LINUX=LINUX)" "LINUX"
557 $(HIDER)echo Shared [$@]
558 @echo $@ >$(DIRTY_FILE)
559 $(CATCHER)$(LINK_TOOL) $(LINKER_OUTPUT_FLAG)$@ $(LOAD_FLAG_PREFIX) -shared -Wl,-soname,$*.so $(ACTUAL_OBJECTS:%=$(OBJECT_DIR)/%) $(ACTUAL_LOCAL_LIBS:%=$(LIBRARY_NAME_FLAG)%) $(LOAD_FLAG_SUFFIX)
560 $(HIDER)rm -f $(STATIC_LIBRARY_DIR)/$(LIB_PREFIX)$*$(LIB_ENDING)
561 $(HIDER)ln -s $@ $(STATIC_LIBRARY_DIR)/$(LIB_PREFIX)$*$(LIB_ENDING)
565 ############################################################################
567 # creates "exe" executables using all of the appropriate objects.
569 ifeq "$(COMPILER)" "VISUAL_CPP"
570 ifneq "$(NO_COMPILE)" ""
571 $(EXECUTABLE_DIR)/%.exe:
574 ifeq "$(NO_COMPILE)" ""
575 $(EXECUTABLE_DIR)/%.exe: $(OBJECT_DIR)/%.obj $(ACTUAL_OBJECTS:%=$(OBJECT_DIR)/%) $(ACTUAL_LOCAL_LIBS:%=$(STATIC_LIBRARY_DIR)/$(LIB_PREFIX)%$(LIB_ENDING)) $(ACTUAL_RESX) $(PARAMETER_FILE)
576 $(HIDER)echo Building Application [$(notdir $@)]
577 @echo $@ >$(DIRTY_FILE)
578 ifeq "$(COMPILER)" "VISUAL_CPP"
579 $(HIDESH)-c 'if [ -f $(BUILD_LIST_FILE) ]; then $(SHELL) $(CLAM_DIR)/cpp/rebuild_oldies.sh $(MULTI_BUILD_CMD); fi'
581 $(CATCHER)$(LINK_TOOL) $(EXE_FLAGS) $(LOAD_FLAG_PREFIX) $< $(ACTUAL_OBJECTS:%=$(OBJECT_DIR)/%) $(ACTUAL_RESX_FLAGS) $(ACTUAL_LOCAL_LIBS:%=$(LIBRARY_NAME_FLAG)$(LIB_PREFIX)%$(LIB_ENDING)) $(LOAD_FLAG_SUFFIX) $(LINKER_OUTPUT_FLAG)$@
583 ifeq "$(COMPILER_VERSION)" "8"
584 $(HIDESH)$(CLAM_DIR)/cpp/ms_manifest.sh "$@" "1"
586 ifeq "$(COMPILER_VERSION)" "10"
587 $(HIDESH)$(CLAM_DIR)/cpp/ms_manifest.sh "$@" "1"
589 ifneq "$(VCPP_VISTA_ICON)" ""
590 $(HIDER)ReplaceVistaIcon "$@" "$(VCPP_VISTA_ICON)"
595 ifneq "$(COMPILER)" "VISUAL_CPP"
596 ifneq "$(NO_COMPILE)" ""
600 ifeq "$(NO_COMPILE)" ""
601 $(EXECUTABLE_DIR)/%: $(OBJECT_DIR)/%.obj $(ACTUAL_OBJECTS:%=$(OBJECT_DIR)/%) $(ACTUAL_LOCAL_LIBS:%=$(STATIC_LIBRARY_DIR)/$(LIB_PREFIX)%$(LIB_ENDING)) $(PARAMETER_FILE)
602 $(HIDER)echo Building Application [$(notdir $@)]
603 @echo $@ >$(DIRTY_FILE)
604 $(CATCHER)$(LINK_TOOL) $(EXE_FLAGS) $(LOAD_FLAG_PREFIX) $< $(ACTUAL_OBJECTS:%=$(OBJECT_DIR)/%) $(ACTUAL_LOCAL_LIBS:%=$(LIBRARY_NAME_FLAG)%) $(LOAD_FLAG_SUFFIX) $(LINKER_OUTPUT_FLAG)$@
605 #hmmm: experimental item below.
610 ############################################################################
612 # creates firmware "elf" executables with the proper objects.
614 ifneq "$(NO_COMPILE)" ""
615 $(EXECUTABLE_DIR)/%.elf:
618 ifeq "$(NO_COMPILE)" ""
619 $(EXECUTABLE_DIR)/%.elf: $(OBJECT_DIR)/%.obj $(ACTUAL_OBJECTS:%=$(OBJECT_DIR)/%) $(ACTUAL_LOCAL_LIBS:%=$(STATIC_LIBRARY_DIR)/$(LIB_PREFIX)%$(LIB_ENDING)) $(PARAMETER_FILE)
620 $(HIDER)echo Building Application [$(notdir $@)]
621 @echo $@ >$(DIRTY_FILE)
622 $(CATCHER)$(LINK_TOOL) $(MAP) $(LOAD_FLAG_PREFIX) $< $(LINKER_COMMAND_FILE) $(STARTUP_OBJECT_FILE) $(ACTUAL_OBJECTS:%=$(OBJECT_DIR)/%) $(ACTUAL_LOCAL_LIBS:%=$(LIBRARY_NAME_FLAG)%) $(LOAD_FLAG_SUFFIX) $(LINKER_OUTPUT_FLAG)$@
624 @echo Hex [$(EXECUTABLE_DIR)/$*.out]
625 $(CATCHER)$(DDUMP_TOOL) $(DDUMP_OPTIONS) $@ -o$(EXECUTABLE_DIR)/$*.out
626 @echo Binary [$(EXECUTABLE_DIR)/$*.bin]
627 $(CATCHER)$(DDUMP_TOOL) $(DDUMP_BIN_OPTIONS) $@ -o$(EXECUTABLE_DIR)/$*.bin
630 ############################################################################
632 # handles creating version resource files if this project has a version.ini.
634 ifeq "$(OMIT_VERSIONS)" ""
635 ifneq "$(VERSION_RC_ROOT)" ""
636 # only redo the version resource if it or version.ini is out of date.
637 %_version.rc: version.ini $(PARAMETER_FILE)
638 $(CATCHER)$(CLAM_BINARY_DIR)/version_stamper$(EXE_END) . $(PARAMETER_FILE)
642 ############################################################################
644 # Now the active part of the make process...
646 # Adds the main CLAM system in to get some work done. This should be placed
647 # after the module's rules are defined and before the module's targets are
651 # make sure we really want to include the dependencies file.
652 ifeq "$(TYPE)" "hierarchy"
653 # no dependencies for a simple hierarchy builder.
658 # no dependencies get left when we are cleaning up.
659 $(shell rm -f $(DEPS_FILE))
661 ifneq "$(NO_COMPILE)" ""
662 # non compiling projects do not need dependencies.
665 ifneq "$(REBUILD)" ""
667 # if we are rebuilding everything, we zap the deps file.
668 $(shell rm -f $(DEPS_FILE))
671 # includes the auto-dependency information. the dependency file is checked
672 # for being up-to-date. if not, it gets rebuilt and the make is restarted.
677 # preserves intermediate files from being deleted.
679 .PRECIOUS: $(OBJECT_DIR)/%.obj $(OBJECT_DIR)/%.res $(OBJECT_DIR)/%.resources
682 # zaps things when they could not be created correctly.
683 ####.DELETE_ON_ERROR:
685 ############################################################################
687 # autodependency file creator. See the make_dep man page for more info.
689 # we do the auto-dependencies unless the disabling flag is set.
690 ifneq "$(NO_DEPS)" ""
691 # makes the dependencies a no-op.
692 deps: $(PARAMETER_FILE)
694 $(DEPS_FILE): $(PARAMETER_FILE)
699 # this causes the dependency file to be regenerated if the sources or libs
700 # have changed. we have to touch the deps file in case it's missing;
701 # makedep doesn't deal well with that. also, we touch the dirty flag file
702 # to ensure that the fact we redid dependencies for some reason causes us
703 # to re-promote. we only bother with any of this if we know we're going
704 # to really do some compilation; if in non-compile mode, we'll skip it.
705 ifneq "$(NO_COMPILE)" ""
706 # no dependencies in non-compile mode.
710 ifeq "$(LAX_DEPENDENCIES)" ""
711 $(DEPS_FILE): $(SOURCE) $(ACTUAL_LOCAL_LIBS:%=$(STATIC_LIBRARY_DIR)/$(LIB_PREFIX)%$(LIB_ENDING)) $(wildcard *.h) $(EXE_CPPS)
712 else # lax dependencies means create if missing or if parm file changed.
713 $(DEPS_FILE): $(PARAMETER_FILE)
714 endif # !lax dependencies.
715 ifneq "$(VERSION_RC_ROOT)" ""
716 ifeq "$(OMIT_VERSIONS)" ""
717 $(DEPS_FILE): $(VERSION_RC_ROOT)_version.rc
720 @echo Dependencies [$(notdir $@)]
721 -$(HIDESH)$(CLAM_DIR)/cpp/preconditions.sh
723 # @echo dep adds: $(DEPENDENCY_ADDITIONS)
724 @$(CLAM_BINARY_DIR)/makedep$(EXE_END) $(DEPENDENCY_DEFINITIONS:%=-D%) $(DEPENDENCY_ADDITIONS) -f$@ -o.obj -p$(OBJECT_DIR)/ -w 420 $(COMPILER_HEADER_DIR:%=-X%) $(THIRD_PARTY_DIR:%=-X%) -- $(COMPILER_FLAGS) $(SOURCE) $(EXE_CPPS)
725 # $(CATCHER)$(CLAM_BINARY_DIR)/makedep$(EXE_END) $(DEPENDENCY_DEFINITIONS:%=-D%) $(DEPENDENCY_ADDITIONS) -f$@ -o.obj -p$(OBJECT_DIR)/ -w 420 $(COMPILER_HEADER_DIR:%=-X%) $(THIRD_PARTY_DIR:%=-X%) -- $(COMPILER_FLAGS) $(SOURCE) $(EXE_CPPS)
726 @echo $@ >$(SUBMAKE_FLAG)
730 ############################################################################
732 # examines the required variables and complains if they're missing.
734 $(HIDESH) -c 'if [ -z "$(PROJECT)" ]; then echo the PROJECT variable is not defined!; . $(CLAM_DIR)/exit_make.sh; fi'
735 $(HIDESH) -c 'if [ -z "$(TYPE)" ]; then echo the TYPE variable is not defined!; . $(CLAM_DIR)/exit_make.sh; fi'
737 ############################################################################
739 # calls the script for preparing output directories and such.
741 $(HIDESH)$(CLAM_DIR)/cpp/preconditions.sh
743 ############################################################################
745 # calls the script for copying the final products to the library directory.
746 # we don't bother reporting errors from touch since there will sometimes
747 # not be any objects in the final directory.
749 $(HIDESH)$(CLAM_DIR)/cpp/postconditions.sh
751 ############################################################################
753 # if REBUILD is defined, then we cause all objects to be recompiled.
754 .PHONY: force_rebuild
757 ifneq "$(REBUILD)" ""
758 # the target below needs the blank rule that it has for this to work.
759 $(FIRST_TARGETS) $(ACTUAL_OBJECTS:%=$(OBJECT_DIR)/%) $(ACTUAL_TARGETS) $(EXE_CPPS:%.cpp=$(OBJECT_DIR)/%.obj) $(LAST_TARGETS): force_rebuild
762 ############################################################################
764 # generate dependencies for any static targets if requested.
765 gendeps: $(GENERATED_DEPS_LIST)
767 ############################################################################