| 1 | ############################################################################################## |
|---|
| 2 | # |
|---|
| 3 | # The magic.makefile Copyright 2004-2006 by Jeff Koftinoff <jeffk@jdkoftinoff.com> |
|---|
| 4 | # version 3. |
|---|
| 5 | # |
|---|
| 6 | # Simplifies the building of a c/c++ library, it's tests, tools, examples, and documentation. |
|---|
| 7 | # |
|---|
| 8 | # See https://clicker.jdkoftinoff.com/projects/trac/jdks/wiki/MagicMakefileV3 |
|---|
| 9 | # for more information, including license information (GPL) |
|---|
| 10 | # |
|---|
| 11 | |
|---|
| 12 | |
|---|
| 13 | # default project settings. These are usually originally set in project.mak |
|---|
| 14 | |
|---|
| 15 | # PROJECT is the single word describing this project. |
|---|
| 16 | PROJECT?=project |
|---|
| 17 | |
|---|
| 18 | # PROJECT_NAME is a single line describing this project |
|---|
| 19 | PROJECT_NAME?=Project |
|---|
| 20 | |
|---|
| 21 | # PROJECT_VERSION defaults to the date, YYYYMMDD |
|---|
| 22 | PROJECT_VERSION?=$(shell date +%Y%m%d) |
|---|
| 23 | |
|---|
| 24 | # BINARY_TARBALL_NAME is the file name of the result tar ball when an installation directory is tarred and bzipped. |
|---|
| 25 | BINARY_TARBALL_NAME?=$(PROJECT_NAME)-$(PROJECT_VERSION).tar.bz2 |
|---|
| 26 | |
|---|
| 27 | # We put our build dir in $(PWD) by default |
|---|
| 28 | BUILD_DIR?=$(PWD) |
|---|
| 29 | |
|---|
| 30 | NATIVE_BUILD_DIR=$(PWD) |
|---|
| 31 | |
|---|
| 32 | # We are not cross compiling by default |
|---|
| 33 | CROSS_COMPILING?=0 |
|---|
| 34 | |
|---|
| 35 | # TOP_LIB_DIRS is a list of relative directories from the PROJECT_TOP_DIR that each contain |
|---|
| 36 | # an "include", "src", "tools", "tests" and other directories. Typically for a single project |
|---|
| 37 | # TOP_LIB_DIRS is set to '.' in project.mak |
|---|
| 38 | |
|---|
| 39 | # LIB_DIRS is then calculated with the fully qualified directory name for each directory in TOP_LIB_DIRS |
|---|
| 40 | LIB_DIRS+=$(call add_top_dir_prefix,$(TOP_LIB_DIRS)) |
|---|
| 41 | |
|---|
| 42 | |
|---|
| 43 | # RSYNC is the name of our rsync program. |
|---|
| 44 | RSYNC?=rsync |
|---|
| 45 | |
|---|
| 46 | # RSYNC_OPTIONS are the rsync options we use to copy a tree of files/directories to another dir. |
|---|
| 47 | # We want ot exclude backup files and subversion and CVS control directories. |
|---|
| 48 | RSYNC_OPTIONS?=-a --exclude='*~' --exclude='.svn' --exclude='CVS' |
|---|
| 49 | |
|---|
| 50 | # When we build a config tool script, this is the file name we use. |
|---|
| 51 | PROJECT_CONFIG_TOOL?=$(PROJECT)-cfg |
|---|
| 52 | |
|---|
| 53 | OBJDUMP?=$(COMPILER_PREFIX)objdump |
|---|
| 54 | OBJDUMP_FLAGS?=-d -C |
|---|
| 55 | LIPO?=$(COMPILER_PREFIX)lipo |
|---|
| 56 | |
|---|
| 57 | ############################################################################################## |
|---|
| 58 | # |
|---|
| 59 | # utility functions |
|---|
| 60 | |
|---|
| 61 | # add_top_dir_prefix is a function that takes every directory and or wildcard pattern |
|---|
| 62 | # in arg1 and prefixes PROJECT_TOP_DIR to it, and then only expands the directories that actually exist. |
|---|
| 63 | |
|---|
| 64 | add_top_dir_prefix=$(strip $(wildcard $(foreach lib,$(1),$(PROJECT_TOP_DIR)/$(lib)))) |
|---|
| 65 | |
|---|
| 66 | |
|---|
| 67 | # subdirs_in_path is a function which takes 1 parameter: |
|---|
| 68 | # $(1) is a single directory |
|---|
| 69 | # it expands to a list of all directories in $(1) |
|---|
| 70 | |
|---|
| 71 | subdirs_in_path=$(strip $(foreach d,$(wildcard $(1)/*/.),$(dir $(d)))) |
|---|
| 72 | |
|---|
| 73 | bare_subdirs_in_path=$(subst /,,$(subst $(1),,$(call subdirs_in_path,$(1)))) |
|---|
| 74 | |
|---|
| 75 | # suffix_platform_dirs is a function that takes 3 parameters: |
|---|
| 76 | # $(1) is a subdirectory name, like 'src' |
|---|
| 77 | # $(2) is a list of platform directories, like 'win32' or 'posix' |
|---|
| 78 | # $(3) is a list of main directory names, like '$(PROJECT_TOP_DIR)' |
|---|
| 79 | # |
|---|
| 80 | # suffix_platform_dirs expands all existing directories that match any of $(3)/$(1) or $(3)/$(1)/$(2) |
|---|
| 81 | |
|---|
| 82 | |
|---|
| 83 | suffix_platform_dirs=$(strip $(foreach dir,$(addsuffix /$(1),$(3)) $(foreach platform,$(2),$(addsuffix /$(1)/$(platform),$(3))),$(wildcard $(dir)))) |
|---|
| 84 | |
|---|
| 85 | |
|---|
| 86 | # targe_suffix_platform_dirs is a function which takes one parameter: |
|---|
| 87 | # $(1) is a subdirectory name, like 'src' or 'tool' |
|---|
| 88 | # it expands into all existing directories for the target platform sources |
|---|
| 89 | |
|---|
| 90 | target_suffix_platform_dirs=$(wildcard $(call suffix_platform_dirs,$(1),$(PLATFORM_DIRS),$(LIB_DIRS))) |
|---|
| 91 | |
|---|
| 92 | # native_suffix_platform_dirs is a function which takes one parameter: |
|---|
| 93 | # $(1) is a subdirectory name, like 'src' or 'tool' |
|---|
| 94 | # it expands into all existing directories for the native platform sources |
|---|
| 95 | |
|---|
| 96 | native_suffix_platform_dirs=$(wildcard $(call suffix_platform_dirs,$(1),$(NATIVE_PLATFORM_DIRS),$(LIB_DIRS))) |
|---|
| 97 | |
|---|
| 98 | # get_file_list is a function which takes two parameters: |
|---|
| 99 | # $(1) a list of directory names |
|---|
| 100 | # $(2) a file extension (without the dot) |
|---|
| 101 | # it expands into all the file names that are found in the listed directories which that file extension, |
|---|
| 102 | # and then removes all the directory names from the results. |
|---|
| 103 | |
|---|
| 104 | get_file_list=$(strip $(notdir $(foreach dir,$(1),$(wildcard $(dir)/*.$(2))))) |
|---|
| 105 | |
|---|
| 106 | |
|---|
| 107 | # get_src_file_list is a function which takes one parameter: |
|---|
| 108 | # $(1) is a file extension |
|---|
| 109 | # it expands into a list of all source files for the target platform that of that type |
|---|
| 110 | # (with the directory names removed) |
|---|
| 111 | |
|---|
| 112 | get_src_file_list=$(call get_file_list,$(LIB_SRC_DIR),$(1)) |
|---|
| 113 | get_native_src_file_list=$(call get_file_list,$(NATIVE_LIB_SRC_DIR),$(1)) |
|---|
| 114 | |
|---|
| 115 | |
|---|
| 116 | # get_cpp_o_files is a function which takes one parameter: |
|---|
| 117 | # $(1) is a list of cpp files with no directory names |
|---|
| 118 | # |
|---|
| 119 | # it returns the full path names for all the required object files which are generated by cpp files. |
|---|
| 120 | # get_cc_o_files, get_c_o_files, get_m_o_files, and get_mm_o_files are the same as get_cpp_o_files |
|---|
| 121 | # except for C, Objective-C, and Objective-C++ respectively. |
|---|
| 122 | |
|---|
| 123 | get_cpp_o_files=$(addprefix $(OUTPUT_OBJ_DIR)/,$(1:.cpp=.o)) |
|---|
| 124 | get_cc_o_files=$(addprefix $(OUTPUT_OBJ_DIR)/,$(1:.cc=.o)) |
|---|
| 125 | get_c_o_files=$(addprefix $(OUTPUT_OBJ_DIR)/,$(1:.c=.o)) |
|---|
| 126 | get_m_o_files=$(addprefix $(OUTPUT_OBJ_DIR)/,$(1:.m=.o)) |
|---|
| 127 | get_mm_o_files=$(addprefix $(OUTPUT_OBJ_DIR)/,$(1:.mm=.o)) |
|---|
| 128 | get_rc_o_files=$(addprefix $(OUTPUT_OBJ_DIR)/,$(1:.rc=.o)) |
|---|
| 129 | |
|---|
| 130 | get_native_cpp_o_files=$(addprefix $(NATIVE_OUTPUT_OBJ_DIR)/,$(1:.cpp=.o)) |
|---|
| 131 | get_native_cc_o_files=$(addprefix $(NATIVE_OUTPUT_OBJ_DIR)/,$(1:.cc=.o)) |
|---|
| 132 | get_native_c_o_files=$(addprefix $(NATIVE_OUTPUT_OBJ_DIR)/,$(1:.c=.o)) |
|---|
| 133 | get_native_m_o_files=$(addprefix $(NATIVE_OUTPUT_OBJ_DIR)/,$(1:.m=.o)) |
|---|
| 134 | get_native_mm_o_files=$(addprefix $(NATIVE_OUTPUT_OBJ_DIR)/,$(1:.mm=.o)) |
|---|
| 135 | get_native_rc_o_files=$(addprefix $(NATIVE_OUTPUT_OBJ_DIR)/,$(1:.rc=.o)) |
|---|
| 136 | |
|---|
| 137 | |
|---|
| 138 | |
|---|
| 139 | # calc_target_options is a function which takes 1 parameter: |
|---|
| 140 | # $(1) is a target platform suffix, such as MINGW32, POSIX, or LINUX |
|---|
| 141 | # |
|---|
| 142 | # it expands into makefile code which is to be ultimately eval'd - |
|---|
| 143 | # this means that if $(1) is LINUX, then for instance, COMPILE_FLAGS_LINUX |
|---|
| 144 | # will get appended to the current COMPILE_FLAGS. |
|---|
| 145 | # the variables set in this fashion include: |
|---|
| 146 | # LIB_SRC_DIR, DEFINES, COMPILE_FLAGS, LINK_FLAGS, LINK_FLAGS_GUI, LDLIBS, and LDLIBS_GUI |
|---|
| 147 | |
|---|
| 148 | define calc_target_options |
|---|
| 149 | # add the relevant top src dirs |
|---|
| 150 | LIB_SRC_DIR+=$$(call add_top_dir_prefix,$$(TOP_LIB_DIRS_$(1))) |
|---|
| 151 | |
|---|
| 152 | # set the target platform macro definition |
|---|
| 153 | DEFINES+=TARGET_PLATFORM_$(1)=1 |
|---|
| 154 | |
|---|
| 155 | # set the platform specific project defines |
|---|
| 156 | DEFINES+=$$(DEFINES_$(1)) |
|---|
| 157 | |
|---|
| 158 | # set the platform specific project compile flags |
|---|
| 159 | COMPILE_FLAGS+=$$(COMPILE_FLAGS_$(1)) |
|---|
| 160 | |
|---|
| 161 | # set the platform specific project pre-process flags |
|---|
| 162 | PREPROCESS_FLAGS+=$$(PREPROCESS_FLAGS_$(1)) |
|---|
| 163 | |
|---|
| 164 | # set the platform specific project link flags |
|---|
| 165 | LINK_FLAGS+=$$(LINK_FLAGS_$(1)) |
|---|
| 166 | |
|---|
| 167 | # set the platform specific project gui link flags |
|---|
| 168 | LINK_FLAGS_GUI+=$$(LINK_FLAGS_GUI_$(1)) |
|---|
| 169 | |
|---|
| 170 | # set the platform specific project link libs |
|---|
| 171 | LDLIBS+=$$(LDLIBS_$(1)) |
|---|
| 172 | |
|---|
| 173 | # set the platform specific project gui link libs |
|---|
| 174 | LDLIBS_GUI+=$$(LDLIBS_GUI_$(1)) |
|---|
| 175 | endef |
|---|
| 176 | |
|---|
| 177 | |
|---|
| 178 | # calc_multi_target_options is a function which takes 1 parameter: |
|---|
| 179 | # $(1) is a list of target platform suffixes, such as POSIX or LINUX |
|---|
| 180 | # it takes each one and expands them via the calc_target_options function. |
|---|
| 181 | # this expansion is to be eval'd. |
|---|
| 182 | |
|---|
| 183 | calc_multi_target_options=$(foreach suffix,$(1),$(call calc_target_options,$(suffix))) |
|---|
| 184 | |
|---|
| 185 | |
|---|
| 186 | # calc_native_options is a function which takes 1 parameter: |
|---|
| 187 | # $(1) is a native platform suffix, such as MINGW32, POSIX, or LINUX |
|---|
| 188 | # |
|---|
| 189 | # it expands into makefile code which is to be ultimately eval'd - |
|---|
| 190 | # this means that if $(1) is LINUX, then for instance, COMPILE_FLAGS_LINUX |
|---|
| 191 | # will get appended to the current NATIVE_COMPILE_FLAGS. |
|---|
| 192 | # the variables set in this fashion include: |
|---|
| 193 | # NATIVE_LIB_SRC_DIR, NATIVE_DEFINES, NATIVE_COMPILE_FLAGS, |
|---|
| 194 | # NATIVE_LINK_FLAGS, NATIVE_LINK_FLAGS_GUI, NATIVE_LDLIBS, and NATIVE_LDLIBS_GUI |
|---|
| 195 | |
|---|
| 196 | define calc_native_options |
|---|
| 197 | # add the relevant top src dirs |
|---|
| 198 | NATIVE_LIB_SRC_DIR+=$$(call add_top_dir_prefix,$$(TOP_LIB_DIRS_$(1))) |
|---|
| 199 | |
|---|
| 200 | # set the target platform macro definition |
|---|
| 201 | NATIVE_DEFINES+=TARGET_PLATFORM_$(1)=1 |
|---|
| 202 | |
|---|
| 203 | # set the platform specific project defines |
|---|
| 204 | NATIVE_DEFINES+=$$(DEFINES_$(1)) |
|---|
| 205 | |
|---|
| 206 | # set the platform specific project compile flags |
|---|
| 207 | NATIVE_COMPILE_FLAGS+=$$(COMPILE_FLAGS_$(1)) |
|---|
| 208 | |
|---|
| 209 | # set the platform specific project preprocess flags |
|---|
| 210 | NATIVE_PREPROCESS_FLAGS+=$$(PREPROCESS_FLAGS_$(1)) |
|---|
| 211 | |
|---|
| 212 | # set the platform specific project link flags |
|---|
| 213 | NATIVE_LINK_FLAGS+=$$(LINK_FLAGS_$(1)) |
|---|
| 214 | |
|---|
| 215 | # set the platform specific project gui link flags |
|---|
| 216 | NATIVE_LINK_FLAGS_GUI+=$$(LINK_FLAGS_GUI_$(1)) |
|---|
| 217 | |
|---|
| 218 | # set the platform specific project link libs |
|---|
| 219 | NATIVE_LDLIBS+=$$(LDLIBS_$(1)) |
|---|
| 220 | |
|---|
| 221 | # set the platform specific project gui link libs |
|---|
| 222 | NATIVE_LDLIBS_GUI+=$$(LDLIBS_GUI_$(1)) |
|---|
| 223 | endef |
|---|
| 224 | |
|---|
| 225 | |
|---|
| 226 | # calc_multi_native_options is a function which takes 1 parameter: |
|---|
| 227 | # $(1) is a list of native platform suffixes, such as POSIX or LINUX |
|---|
| 228 | # it takes each one and expands them via the calc_native_options function. |
|---|
| 229 | # this expansion is to be eval'd. |
|---|
| 230 | |
|---|
| 231 | calc_multi_native_options=$(foreach suffix,$(1),$(call calc_native_options,$(suffix))) |
|---|
| 232 | |
|---|
| 233 | |
|---|
| 234 | # search_program_group is a function which returns the makefile text required to find |
|---|
| 235 | # all source files in a specified directory class and construct the o file lists for them. |
|---|
| 236 | # Param $(1) is the class of program in capitals, for example TOOLS, TESTS, EXAMPLES, GUI |
|---|
| 237 | # the text returned by this function is then to be eval'd. The appropriate lists of |
|---|
| 238 | # source files and O files for this class are then created dynamically. |
|---|
| 239 | |
|---|
| 240 | define search_program_group |
|---|
| 241 | LIB_$(1)_CPP_FILES=$$(call get_file_list,$$(LIB_$(1)_DIR),cpp) |
|---|
| 242 | LIB_$(1)_CC_FILES=$$(call get_file_list,$$(LIB_$(1)_DIR),cc) |
|---|
| 243 | LIB_$(1)_C_FILES=$$(call get_file_list,$$(LIB_$(1)_DIR),c) |
|---|
| 244 | LIB_$(1)_M_FILES=$$(call get_file_list,$$(LIB_$(1)_DIR),m) |
|---|
| 245 | LIB_$(1)_MM_FILES=$$(call get_file_list,$$(LIB_$(1)_DIR),mm) |
|---|
| 246 | LIB_$(1)_RC_FILES=$$(call get_file_list,$$(LIB_$(1)_DIR),rc) |
|---|
| 247 | LIB_$(1)_SH_FILES=$$(call get_file_list,$$(LIB_$(1)_DIR),sh) |
|---|
| 248 | |
|---|
| 249 | LIB_$(1)_O_FILES=$$(call get_cpp_o_files,$$(LIB_$(1)_CPP_FILES)) \ |
|---|
| 250 | $$(call get_cc_o_files,$$(LIB_$(1)_CC_FILES)) \ |
|---|
| 251 | $$(call get_c_o_files,$$(LIB_$(1)_C_FILES)) \ |
|---|
| 252 | $$(call get_m_o_files,$$(LIB_$(1)_M_FILES)) \ |
|---|
| 253 | $$(call get_mm_o_files,$$(LIB_$(1)_MM_FILES)) \ |
|---|
| 254 | $$(call get_rc_o_files,$$(LIB_$(1)_RC_FILES)) |
|---|
| 255 | |
|---|
| 256 | LIB_$(1)_DISASM_FILES=$$(LIB_$(1)_O_FILES:.o=.disasm) |
|---|
| 257 | |
|---|
| 258 | LIB_$(1)_ASM_FILES=$$(LIB_$(1)_O_FILES:.o=.asm) |
|---|
| 259 | |
|---|
| 260 | LIB_$(1)_EXE_FILES=$$(addprefix $$(OUTPUT_$(1)_DIR)/,$$(notdir $$(LIB_$(1)_O_FILES:.o=$$(EXE)))) |
|---|
| 261 | |
|---|
| 262 | ifeq ($(CROSS_COMPILING),1) |
|---|
| 263 | NATIVE_LIB_$(1)_CPP_FILES=$$(call get_file_list,$$(NATIVE_LIB_$(1)_DIR),cpp) |
|---|
| 264 | NATIVE_LIB_$(1)_CC_FILES=$$(call get_file_list,$$(NATIVE_LIB_$(1)_DIR),cc) |
|---|
| 265 | NATIVE_LIB_$(1)_C_FILES=$$(call get_file_list,$$(NATIVE_LIB_$(1)_DIR),c) |
|---|
| 266 | NATIVE_LIB_$(1)_M_FILES=$$(call get_file_list,$$(NATIVE_LIB_$(1)_DIR),m) |
|---|
| 267 | NATIVE_LIB_$(1)_MM_FILES=$$(call get_file_list,$$(NATIVE_LIB_$(1)_DIR),mm) |
|---|
| 268 | NATIVE_LIB_$(1)_SH_FILES=$$(call get_file_list,$$(NATIVE_LIB_$(1)_DIR),sh) |
|---|
| 269 | NATIVE_LIB_$(1)_RC_FILES=$$(call get_file_list,$$(NATIVE_LIB_$(1)_DIR),rc) |
|---|
| 270 | |
|---|
| 271 | NATIVE_LIB_TOOLS_O_FILES=$$(call get_native_cpp_o_files,$$(NATIVE_LIB_$(1)_CPP_FILES)) \ |
|---|
| 272 | $$(call get_native_cc_o_files,$$(NATIVE_LIB_$(1)_CC_FILES)) \ |
|---|
| 273 | $$(call get_native_c_o_files,$$(NATIVE_LIB_$(1)_C_FILES)) \ |
|---|
| 274 | $$(call get_native_m_o_files,$$(NATIVE_LIB_$(1)_M_FILES)) \ |
|---|
| 275 | $$(call get_native_mm_o_files,$$(NATIVE_LIB_$(1)_MM_FILES)) \ |
|---|
| 276 | $$(call get_native_rc_o_files,$$(NATIVE_LIB_$(1)_RC_FILES)) |
|---|
| 277 | |
|---|
| 278 | NATIVE_LIB_$(1)_EXE_FILES=$$(addprefix $$(NATIVE_OUTPUT_$(1)_DIR)/,$$(notdir $$(NATIVE_LIB_$(1)_O_FILES:.o=$$(NATIVE_EXE)))) |
|---|
| 279 | endif |
|---|
| 280 | endef |
|---|
| 281 | |
|---|
| 282 | # compile options |
|---|
| 283 | |
|---|
| 284 | # having DEBUG set to 1 means we compile with -g and define DEBUG=1 |
|---|
| 285 | |
|---|
| 286 | ifeq ($(DEBUG),1) |
|---|
| 287 | COMPILE_FLAGS+=-g |
|---|
| 288 | DEFINES+=DEBUG=1 |
|---|
| 289 | endif |
|---|
| 290 | |
|---|
| 291 | # having PROFILE set to 1 means we compile with -pg |
|---|
| 292 | |
|---|
| 293 | ifeq ($(PROFILE),1) |
|---|
| 294 | COMPILE_FLAGS+=-pg |
|---|
| 295 | endif |
|---|
| 296 | |
|---|
| 297 | # all our */include directories |
|---|
| 298 | INCLUDES+=$(LIB_INCLUDE_DIR) |
|---|
| 299 | |
|---|
| 300 | # our compiler defines |
|---|
| 301 | DEFINES?= |
|---|
| 302 | |
|---|
| 303 | # The preprocessor flags is initially comprised of -I option for each include dir, |
|---|
| 304 | # and the -D option for each define |
|---|
| 305 | PREPROCESS_FLAGS+=$(addprefix -I,$(INCLUDES)) $(addprefix -D,$(DEFINES)) |
|---|
| 306 | |
|---|
| 307 | # The compiler flag settings for optimization and warnings |
|---|
| 308 | COMPILE_FLAGS+=$(OPTIMIZE) $(WARNINGS) |
|---|
| 309 | |
|---|
| 310 | # the additional linker flags: |
|---|
| 311 | LDFLAGS+= |
|---|
| 312 | |
|---|
| 313 | # the addition linker libraries: |
|---|
| 314 | LDLIBS+= |
|---|
| 315 | |
|---|
| 316 | # The preprocessor flags needed to generate dependency information: |
|---|
| 317 | DEPENDENCY_OPTIONS?=-MM |
|---|
| 318 | |
|---|
| 319 | # native platform debug flags: having NATIVE_DEBUG set to 1 means we compile native platform |
|---|
| 320 | # code with -g and define DEBUG=1 |
|---|
| 321 | ifeq ($(NATIVE_DEBUG),1) |
|---|
| 322 | NATIVE_COMPILE_FLAGS+=-g |
|---|
| 323 | NATIVE_DEFINES+=DEBUG=1 |
|---|
| 324 | endif |
|---|
| 325 | |
|---|
| 326 | # native platform profile flag: having NATIVE_PROFILE set to 1 means we compile native platform |
|---|
| 327 | # code with -pg |
|---|
| 328 | ifeq ($(NATIVE_PROFILE),1) |
|---|
| 329 | NATIVE_COMPILE_FLAGS+=-pg |
|---|
| 330 | endif |
|---|
| 331 | |
|---|
| 332 | |
|---|
| 333 | # The native platform preprocessor flags is initially comprised of -I option for each include dir, |
|---|
| 334 | # and the -D option for each define |
|---|
| 335 | NATIVE_PREPROCESS_FLAGS=$(addprefix -I,$(INCLUDES)) $(addprefix -D,$(NATIVE_DEFINES)) |
|---|
| 336 | |
|---|
| 337 | # The native platform compiler flags settings for optimization and warnings |
|---|
| 338 | NATIVE_COMPILE_FLAGS+=$(NATIVE_OPTIMIZE) $(NATIVE_WARNINGS) |
|---|
| 339 | |
|---|
| 340 | # the additional linker flags: |
|---|
| 341 | NATIVE_LDFLAGS+= |
|---|
| 342 | |
|---|
| 343 | # the addition linker libraries: |
|---|
| 344 | NATIVE_LDLIBS+= |
|---|
| 345 | |
|---|
| 346 | |
|---|
| 347 | |
|---|
| 348 | # config tool generation options |
|---|
| 349 | |
|---|
| 350 | # CONFIG_TOOL_FILE is the full path name of the generated config tool script |
|---|
| 351 | CONFIG_TOOL_FILE=$(OUTPUT_TOOLS_DIR)/$(PROJECT_CONFIG_TOOL) |
|---|
| 352 | |
|---|
| 353 | # CONFIG_TOOL_PREPROCESS_FLAGS is the preprocessor flags that the config tool script |
|---|
| 354 | # will output when given --cppflags |
|---|
| 355 | CONFIG_TOOL_PREPROCESS_FLAGS+=$(addprefix -I,$(INSTALL_INCLUDE_DIR)) $(addprefix -D,$(DEFINES)) |
|---|
| 356 | |
|---|
| 357 | # CONFIG_TOOL_COMPILE_FLAGS is the full compile flags that the config tool script |
|---|
| 358 | # will output when given --cflags or --cxxflags |
|---|
| 359 | CONFIG_TOOL_COMPILE_FLAGS+=$(WARNINGS) $(OPTIMIZE) $(CONFIG_TOOL_PREPROCESS_FLAGS) $(COMPILE_FLAGS) |
|---|
| 360 | |
|---|
| 361 | |
|---|
| 362 | |
|---|
| 363 | # mingw32 is a subset of win32 |
|---|
| 364 | ifeq ($(TARGET_PLATFORM_MINGW32),1) |
|---|
| 365 | SUFFIXES_TARGET_PLATFORM=MINGW32 WIN32 |
|---|
| 366 | EXE=.exe |
|---|
| 367 | PLATFORM_DIRS+=win32 mingw32 |
|---|
| 368 | endif |
|---|
| 369 | |
|---|
| 370 | |
|---|
| 371 | # cygwin is really a subset of posix |
|---|
| 372 | ifeq ($(TARGET_PLATFORM_CYGWIN),1) |
|---|
| 373 | SUFFIXES_TARGET_PLATFORM=CYGWIN POSIX |
|---|
| 374 | EXE=.exe |
|---|
| 375 | PLATFORM_DIRS+=cygwin posix |
|---|
| 376 | endif |
|---|
| 377 | |
|---|
| 378 | # plain posix is just posix |
|---|
| 379 | ifeq ($(TARGET_PLATFORM_POSIX),1) |
|---|
| 380 | SUFFIXES_TARGET_PLATFORM=POSIX |
|---|
| 381 | PLATFORM_DIRS+=posix |
|---|
| 382 | endif |
|---|
| 383 | |
|---|
| 384 | # linux is a subset of posix |
|---|
| 385 | ifeq ($(TARGET_PLATFORM_LINUX),1) |
|---|
| 386 | SUFFIXES_TARGET_PLATFORM=POSIX LINUX |
|---|
| 387 | PLATFORM_DIRS+=posix linux |
|---|
| 388 | endif |
|---|
| 389 | |
|---|
| 390 | |
|---|
| 391 | # linux-i386 is a subset of linux, posix |
|---|
| 392 | ifeq ($(TARGET_PLATFORM_LINUX_I386),1) |
|---|
| 393 | SUFFIXES_TARGET_PLATFORM=POSIX LINUX LINUX_I386 |
|---|
| 394 | PLATFORM_DIRS+=posix linux |
|---|
| 395 | endif |
|---|
| 396 | |
|---|
| 397 | # linux-ppc is a subset of linux, posix |
|---|
| 398 | ifeq ($(TARGET_PLATFORM_LINUX_PPC),1) |
|---|
| 399 | SUFFIXES_TARGET_PLATFORM=POSIX LINUX LINUX_PPC |
|---|
| 400 | PLATFORM_DIRS+=posix linux |
|---|
| 401 | endif |
|---|
| 402 | |
|---|
| 403 | # bsd is a subset of posix |
|---|
| 404 | ifeq ($(TARGET_PLATFORM_BSD),1) |
|---|
| 405 | SUFFIXES_TARGET_PLATFORM=POSIX BSD |
|---|
| 406 | PLATFORM_DIRS+=bsd posix |
|---|
| 407 | endif |
|---|
| 408 | |
|---|
| 409 | # freebsd is a subset of posix and bsd |
|---|
| 410 | ifeq ($(TARGET_PLATFORM_FREEBSD),1) |
|---|
| 411 | SUFFIXES_TARGET_PLATFORM=POSIX BSD FREEBSD |
|---|
| 412 | PLATFORM_DIRS+=bsd posix freebsd |
|---|
| 413 | endif |
|---|
| 414 | |
|---|
| 415 | # openbsd is a subset of posix and bsd |
|---|
| 416 | ifeq ($(TARGET_PLATFORM_OPENBSD),1) |
|---|
| 417 | SUFFIXES_TARGET_PLATFORM=POSIX BSD OPENBSD |
|---|
| 418 | PLATFORM_DIRS+=bsd posix openbsd |
|---|
| 419 | endif |
|---|
| 420 | |
|---|
| 421 | # netbsd is a subset of posix and bsd |
|---|
| 422 | ifeq ($(TARGET_PLATFORM_NETBSD),1) |
|---|
| 423 | SUFFIXES_TARGET_PLATFORM=POSIX BSD NETBSD |
|---|
| 424 | PLATFORM_DIRS+=bsd posix netbsd |
|---|
| 425 | endif |
|---|
| 426 | |
|---|
| 427 | # solaris is a subset of posix |
|---|
| 428 | ifeq ($(TARGET_PLATFORM_SOLARIS),1) |
|---|
| 429 | SUFFIXES_TARGET_PLATFORM=POSIX SOLARIS |
|---|
| 430 | PLATFORM_DIRS+=solaris posix |
|---|
| 431 | endif |
|---|
| 432 | |
|---|
| 433 | # macosx is a subset of posix |
|---|
| 434 | ifeq ($(TARGET_PLATFORM_MACOSX),1) |
|---|
| 435 | SUFFIXES_TARGET_PLATFORM=POSIX MACOSX |
|---|
| 436 | PLATFORM_DIRS+=posix macosx |
|---|
| 437 | DISASM=otool |
|---|
| 438 | DISASM_FLAGS=-t -v -V |
|---|
| 439 | endif |
|---|
| 440 | |
|---|
| 441 | # macosx_ppc is a subset of macosx and posix |
|---|
| 442 | ifeq ($(TARGET_PLATFORM_MACOSX_PPC),1) |
|---|
| 443 | SUFFIXES_TARGET_PLATFORM=POSIX MACOSX MACOSX_PPC |
|---|
| 444 | PLATFORM_DIRS+=posix macosx macosx-ppc |
|---|
| 445 | DISASM=otool |
|---|
| 446 | DISASM_FLAGS=-t -v -V |
|---|
| 447 | endif |
|---|
| 448 | |
|---|
| 449 | # macosx_i386 is a subset of macosx and posix |
|---|
| 450 | ifeq ($(TARGET_PLATFORM_MACOSX_I386),1) |
|---|
| 451 | SUFFIXES_TARGET_PLATFORM=POSIX MACOSX MACOSX_I386 |
|---|
| 452 | PLATFORM_DIRS+=posix macosx macosx-i386 |
|---|
| 453 | DISASM=otool |
|---|
| 454 | DISASM_FLAGS=-t -v -V |
|---|
| 455 | endif |
|---|
| 456 | |
|---|
| 457 | |
|---|
| 458 | # macosx_universal is a subset of macosx and posix and uses mac libtool to generate fat binaries. |
|---|
| 459 | ifeq ($(TARGET_PLATFORM_MACOSX_UNIVERSAL),1) |
|---|
| 460 | MACOSX_UNIVERSAL_ARCHS?=i386 ppc |
|---|
| 461 | MACOSX_UNIVERSAL_ARCHS_PARAMS=$(foreach a,$(MACOSX_UNIVERSAL_ARCHS),-arch $(a)) |
|---|
| 462 | SUFFIXES_TARGET_PLATFORM=POSIX MACOSX MACOSX_UNIVERSAL |
|---|
| 463 | PLATFORM_DIRS+=posix macosx macosx-ppc macosx-i386 |
|---|
| 464 | TARGET_MACOSX_SDK?=/Developer/SDKs/MacOSX10.4u.sdk |
|---|
| 465 | COMPILE_FLAGS+=-isysroot $(TARGET_MACOSX_SDK) $(MACOSX_UNIVERSAL_ARCHS_PARAMS) |
|---|
| 466 | LINK_FLAGS+=-isysroot $(TARGET_MACOSX_SDK) $(MACOSX_UNIVERSAL_ARCHS_PARAMS) |
|---|
| 467 | TARGET_USE_AR=0 |
|---|
| 468 | TARGET_USE_MACOSX_LIBTOOL=1 |
|---|
| 469 | MACOSX_LIBTOOL=libtool |
|---|
| 470 | MACOSX_LIBTOOLFLAGS?=-static |
|---|
| 471 | DISASM=otool |
|---|
| 472 | DISASM_FLAGS=-t -v -V |
|---|
| 473 | endif |
|---|
| 474 | |
|---|
| 475 | # cell_spu is not a posix platform |
|---|
| 476 | ifeq ($(TARGET_PLATFORM_CELL_SPU),1) |
|---|
| 477 | SUFFIXES_TARGET_PLATFORM=CELL_SPU |
|---|
| 478 | PLATFORM_DIRS+=cell_spu |
|---|
| 479 | endif |
|---|
| 480 | |
|---|
| 481 | # linux_cell_ppu is a subset of linux-ppc, linux, posix |
|---|
| 482 | ifeq ($(TARGET_PLATFORM_LINUX_CELL_PPU),1) |
|---|
| 483 | SUFFIXES_TARGET_PLATFORM=POSIX LINUX LINUX_PPC LINUX_CELL_PPU CELL_PPU |
|---|
| 484 | PLATFORM_DIRS+=posix linux cell_ppu |
|---|
| 485 | endif |
|---|
| 486 | |
|---|
| 487 | # default to objdump for disassembly |
|---|
| 488 | DISASM_FLAGS?=-d -S |
|---|
| 489 | DISASM?=$(OBJDUMP) |
|---|
| 490 | |
|---|
| 491 | # if EXE suffix is not set then it ought to be blank. |
|---|
| 492 | EXE?= |
|---|
| 493 | |
|---|
| 494 | # If we are to use normal gnu 'ar' to manipulate static libraries for the target platform, |
|---|
| 495 | # TARGET_USE_AR is to be set to 1. Defaults to 1. |
|---|
| 496 | TARGET_USE_AR?=1 |
|---|
| 497 | |
|---|
| 498 | # If we are to use mac os x libtool (tiger and beyond) to manipulate static libraries for the target |
|---|
| 499 | # platform, TARGET_USE_MACOSX_LIBTOOL is to be set to 1 instead. Defaults to 0. |
|---|
| 500 | TARGET_USE_MACOSX_LIBTOOL?=0 |
|---|
| 501 | |
|---|
| 502 | |
|---|
| 503 | # Now we know all our target platform suffixes in SUFFIXES_TARGET_PLATFORM, so |
|---|
| 504 | # we eval the result of the calc_multi_target_options function. This effectively merges in |
|---|
| 505 | # the platform specific defines, compile flags, and link flags |
|---|
| 506 | |
|---|
| 507 | $(eval $(call calc_multi_target_options,$(SUFFIXES_TARGET_PLATFORM))) |
|---|
| 508 | |
|---|
| 509 | |
|---|
| 510 | ############################################################################################## |
|---|
| 511 | # |
|---|
| 512 | # Calculate all our source dirs for various things, for our target platform |
|---|
| 513 | # |
|---|
| 514 | LIB_INCLUDE_DIR+=$(call target_suffix_platform_dirs,include) |
|---|
| 515 | LIB_SRC_DIR+=$(call target_suffix_platform_dirs,src) |
|---|
| 516 | LIB_TESTS_DIR+=$(call target_suffix_platform_dirs,tests) |
|---|
| 517 | LIB_GUI_DIR+=$(call target_suffix_platform_dirs,gui) |
|---|
| 518 | LIB_EXAMPLES_DIR+=$(call target_suffix_platform_dirs,examples) |
|---|
| 519 | LIB_TOOLS_DIR+=$(call target_suffix_platform_dirs,tools) |
|---|
| 520 | LIB_DOCS_DIR+=$(call target_suffix_platform_dirs,docs) |
|---|
| 521 | |
|---|
| 522 | ALL_SOURCES_DIRS=$(strip $(LIB_SRC_DIR) $(LIB_TESTS_DIR) $(LIB_GUI_DIR) $(LIB_EXAMPLES_DIR) $(LIB_TOOLS_DIR)) |
|---|
| 523 | |
|---|
| 524 | # calculate our output directories for our target platform results |
|---|
| 525 | OUTPUT_DIR=$(BUILD_DIR)/build |
|---|
| 526 | OUTPUT_LIB_DIR?=$(OUTPUT_DIR)/lib |
|---|
| 527 | OUTPUT_TESTS_DIR?=$(OUTPUT_DIR)/tests |
|---|
| 528 | OUTPUT_DOCS_DIR?=$(OUTPUT_DIR)/docs |
|---|
| 529 | OUTPUT_TOOLS_DIR?=$(OUTPUT_DIR)/tools |
|---|
| 530 | OUTPUT_GUI_DIR?=$(OUTPUT_DIR)/gui |
|---|
| 531 | OUTPUT_EXAMPLES_DIR?=$(OUTPUT_DIR)/examples |
|---|
| 532 | OUTPUT_OBJ_DIR?=$(OUTPUT_DIR)/obj |
|---|
| 533 | |
|---|
| 534 | # our output libraries name is simply our project name prefixed with lib in our output lib dir. |
|---|
| 535 | |
|---|
| 536 | INSTALL_DIR?=$(BUILD_DIR)/$(PROJECT)-$(PROJECT_VERSION) |
|---|
| 537 | INSTALL_BIN_DIR?=$(INSTALL_DIR)/bin |
|---|
| 538 | INSTALL_LIB_DIR?=$(INSTALL_DIR)/lib |
|---|
| 539 | INSTALL_INCLUDE_DIR?=$(INSTALL_DIR)/include |
|---|
| 540 | INSTALL_DOCS_DIR?=$(INSTALL_DIR)/docs |
|---|
| 541 | INSTALL_DOCS_DIR?=$(INSTALL_DIR)/share/$(PROJECT)-$(PROJECT_VERSION) |
|---|
| 542 | |
|---|
| 543 | ALL_OUTPUT_DIRS+=$(OUTPUT_LIB_DIR) $(OUTPUT_TOOLS_DIR) $(OUTPUT_TESTS_DIR) $(OUTPUT_DOCS_DIR) $(OUTPUT_EXAMPLES_DIR) $(OUTPUT_OBJ_DIR) $(OUTPUT_GUI_DIR) |
|---|
| 544 | |
|---|
| 545 | |
|---|
| 546 | |
|---|
| 547 | NATIVE_USE_AR?=1 |
|---|
| 548 | NATIVE_USE_MACOSX_LIBTOOL?=0 |
|---|
| 549 | |
|---|
| 550 | |
|---|
| 551 | ifeq ($(NATIVE_PLATFORM_MINGW32),1) |
|---|
| 552 | SUFFIXES_NATIVE_PLATFORM=MINGW32 WIN32 |
|---|
| 553 | NATIVE_PLATFORM_GENERIC=0 |
|---|
| 554 | NATIVE_EXE=.exe |
|---|
| 555 | NATIVE_PLATFORM_DIRS+=win32 mingw32 |
|---|
| 556 | endif |
|---|
| 557 | |
|---|
| 558 | ifeq ($(NATIVE_PLATFORM_CYGWIN),1) |
|---|
| 559 | SUFFIXES_NATIVE_PLATFORM=CYGWIN POSIX |
|---|
| 560 | NATIVE_PLATFORM_GENERIC=0 |
|---|
| 561 | NATIVE_EXE=.exe |
|---|
| 562 | NATIVE_PLATFORM_DIRS+=cygwin posix |
|---|
| 563 | endif |
|---|
| 564 | |
|---|
| 565 | ifeq ($(NATIVE_PLATFORM_POSIX),1) |
|---|
| 566 | SUFFIXES_NATIVE_PLATFORM=POSIX |
|---|
| 567 | NATIVE_PLATFORM_GENERIC=0 |
|---|
| 568 | NATIVE_EXE= |
|---|
| 569 | NATIVE_PLATFORM_DIRS+=posix |
|---|
| 570 | endif |
|---|
| 571 | |
|---|
| 572 | ifeq ($(NATIVE_PLATFORM_LINUX),1) |
|---|
| 573 | SUFFIXES_NATIVE_PLATFORM=POSIX LINUX |
|---|
| 574 | NATIVE_PLATFORM_GENERIC=0 |
|---|
| 575 | NATIVE_EXE= |
|---|
| 576 | NATIVE_PLATFORM_DIRS+=posix linux |
|---|
| 577 | endif |
|---|
| 578 | |
|---|
| 579 | ifeq ($(NATIVE_PLATFORM_LINUX_I386),1) |
|---|
| 580 | SUFFIXES_NATIVE_PLATFORM=POSIX LINUX LINUX_I386 |
|---|
| 581 | NATIVE_PLATFORM_GENERIC=0 |
|---|
| 582 | NATIVE_EXE= |
|---|
| 583 | NATIVE_PLATFORM_DIRS+=posix linux |
|---|
| 584 | endif |
|---|
| 585 | |
|---|
| 586 | ifeq ($(NATIVE_PLATFORM_LINUX_PPC),1) |
|---|
| 587 | SUFFIXES_NATIVE_PLATFORM=POSIX LINUX LINUX_PPC |
|---|
| 588 | NATIVE_PLATFORM_GENERIC=0 |
|---|
| 589 | NATIVE_EXE= |
|---|
| 590 | NATIVE_PLATFORM_DIRS+=posix linux |
|---|
| 591 | endif |
|---|
| 592 | |
|---|
| 593 | |
|---|
| 594 | # bsd is a subset of posix |
|---|
| 595 | ifeq ($(NATIVE_PLATFORM_BSD),1) |
|---|
| 596 | SUFFIXES_NATIVE_PLATFORM=POSIX BSD |
|---|
| 597 | NATIVE_PLATFORM_DIRS+=bsd posix |
|---|
| 598 | endif |
|---|
| 599 | |
|---|
| 600 | # freebsd is a subset of posix and bsd |
|---|
| 601 | ifeq ($(NATIVE_PLATFORM_FREEBSD),1) |
|---|
| 602 | SUFFIXES_NATIVE_PLATFORM=POSIX BSD FREEBSD |
|---|
| 603 | NATIVE_PLATFORM_DIRS+=bsd posix freebsd |
|---|
| 604 | endif |
|---|
| 605 | |
|---|
| 606 | # openbsd is a subset of posix and bsd |
|---|
| 607 | ifeq ($(NATIVE_PLATFORM_OPENBSD),1) |
|---|
| 608 | SUFFIXES_NATIVE_PLATFORM=POSIX BSD OPENBSD |
|---|
| 609 | NATIVE_PLATFORM_DIRS+=bsd posix openbsd |
|---|
| 610 | endif |
|---|
| 611 | |
|---|
| 612 | # netbsd is a subset of posix and bsd |
|---|
| 613 | ifeq ($(NATIVE_PLATFORM_NETBSD),1) |
|---|
| 614 | SUFFIXES_NATIVE_PLATFORM=POSIX BSD NETBSD |
|---|
| 615 | NATIVE_PLATFORM_DIRS+=bsd posix netbsd |
|---|
| 616 | endif |
|---|
| 617 | |
|---|
| 618 | # solaris is a subset of posix |
|---|
| 619 | ifeq ($(NATIVE_PLATFORM_SOLARIS),1) |
|---|
| 620 | SUFFIXES_NATIVE_PLATFORM=POSIX SOLARIS |
|---|
| 621 | NATIVE_PLATFORM_DIRS+=solaris posix |
|---|
| 622 | endif |
|---|
| 623 | |
|---|
| 624 | |
|---|
| 625 | ifeq ($(NATIVE_PLATFORM_MACOSX),1) |
|---|
| 626 | SUFFIXES_NATIVE_PLATFORM=POSIX MACOSX |
|---|
| 627 | NATIVE_PLATFORM_GENERIC=0 |
|---|
| 628 | NATIVE_EXE= |
|---|
| 629 | NATIVE_PLATFORM_DIRS+=posix macosx |
|---|
| 630 | NATIVE_DISASM=otool |
|---|
| 631 | NATIVE_DISASM_FLAGS=-t -v -V |
|---|
| 632 | endif |
|---|
| 633 | |
|---|
| 634 | ifeq ($(NATIVE_PLATFORM_MACOSX_PPC),1) |
|---|
| 635 | SUFFIXES_NATIVE_PLATFORM=POSIX MACOSX MACOSX_PPC |
|---|
| 636 | NATIVE_PLATFORM_GENERIC=0 |
|---|
| 637 | NATIVE_EXE= |
|---|
| 638 | NATIVE_PLATFORM_DIRS+=posix macosx macosx-ppc |
|---|
| 639 | NATIVE_DISASM=otool |
|---|
| 640 | NATIVE_DISASM_FLAGS=-t -v -V |
|---|
| 641 | endif |
|---|
| 642 | |
|---|
| 643 | ifeq ($(NATIVE_PLATFORM_MACOSX_I386),1) |
|---|
| 644 | SUFFIXES_NATIVE_PLATFORM=POSIX MACOSX MACOSX_I386 |
|---|
| 645 | NATIVE_PLATFORM_GENERIC=0 |
|---|
| 646 | NATIVE_EXE= |
|---|
| 647 | NATIVE_PLATFORM_DIRS+=posix macosx macosx-i386 |
|---|
| 648 | NATIVE_DISASM=otool |
|---|
| 649 | NATIVE_DISASM_FLAGS=-t -v -V |
|---|
| 650 | endif |
|---|
| 651 | |
|---|
| 652 | ifeq ($(NATIVE_PLATFORM_MACOSX_UNIVERSAL),1) |
|---|
| 653 | SUFFIXES_NATIVE_PLATFORM=POSIX MACOSX MACOSX_UNIVERSAL |
|---|
| 654 | NATIVE_PLATFORM_GENERIC=0 |
|---|
| 655 | NATIVE_EXE= |
|---|
| 656 | NATIVE_PLATFORM_DIRS+=posix macosx macosx-ppc macosx-i386 |
|---|
| 657 | NATIVE_MACOSX_SDK?=/Developer/SDKs/MacOSX10.4u.sdk |
|---|
| 658 | NATIVE_COMPILE_FLAGS+=-isysroot $(TARGET_MACOSX_SDK) -arch i386 -arch ppc |
|---|
| 659 | NATIVE_LINK_FLAGS+=-isysroot $(TARGET_MACOSX_SDK) -arch i386 -arch ppc |
|---|
| 660 | NATIVE_USE_AR=0 |
|---|
| 661 | NATIVE_USE_MACOSX_LIBTOOL=1 |
|---|
| 662 | NATIVE_MACOSX_LIBTOOL=libtool |
|---|
| 663 | NATIVE_MACOSX_LIBTOOLFLAGS?=-static |
|---|
| 664 | NATIVE_DISASM=otool |
|---|
| 665 | NATIVE_DISASM_FLAGS=-t -v -V |
|---|
| 666 | endif |
|---|
| 667 | |
|---|
| 668 | |
|---|
| 669 | # cell_spu |
|---|
| 670 | ifeq ($(NATIVE_PLATFORM_CELL_SPU),1) |
|---|
| 671 | SUFFIXES_NATIVE_PLATFORM=CELL_SPU |
|---|
| 672 | NATIVE_PLATFORM_DIRS+=cell_spu |
|---|
| 673 | endif |
|---|
| 674 | |
|---|
| 675 | # linux_cell_ppu is a subset of linux-ppc, linux, posix |
|---|
| 676 | ifeq ($(NATIVE_PLATFORM_LINUX_CELL_PPU),1) |
|---|
| 677 | SUFFIXES_NARIVE_PLATFORM=POSIX LINUX LINUX_PPC LINUX_CELL_PPU CELL_PPU |
|---|
| 678 | NATIVE_PLATFORM_DIRS+=posix linux cell_ppu |
|---|
| 679 | endif |
|---|
| 680 | |
|---|
| 681 | # default to objdump for disassembly |
|---|
| 682 | NATIVE_DISASM_FLAGS?=-d -S |
|---|
| 683 | NATIVE_DISASM?=$(OBJDUMP) |
|---|
| 684 | |
|---|
| 685 | $(eval $(call calc_multi_native_options,$(SUFFIXES_NATIVE_PLATFORM))) |
|---|
| 686 | |
|---|
| 687 | |
|---|
| 688 | # calculate our output directories for our native platform results |
|---|
| 689 | |
|---|
| 690 | NATIVE_OUTPUT_DIR=$(NATIVE_BUILD_DIR)/native |
|---|
| 691 | NATIVE_OUTPUT_LIB_DIR?=$(NATIVE_OUTPUT_DIR)/lib |
|---|
| 692 | NATIVE_OUTPUT_TESTS_DIR?=$(NATIVE_OUTPUT_DIR)/tests |
|---|
| 693 | NATIVE_OUTPUT_DOCS_DIR?=$(NATIVE_OUTPUT_DIR)/docs |
|---|
| 694 | NATIVE_OUTPUT_TOOLS_DIR?=$(NATIVE_OUTPUT_DIR)/tools |
|---|
| 695 | NATIVE_OUTPUT_EXAMPLES_DIR?=$(NATIVE_OUTPUT_DIR)/examples |
|---|
| 696 | NATIVE_OUTPUT_OBJ_DIR?=$(NATIVE_OUTPUT_DIR)/obj |
|---|
| 697 | |
|---|
| 698 | |
|---|
| 699 | |
|---|
| 700 | NATIVE_LIB_SRC_DIR+=$(call native_suffix_platform_dirs,tests) |
|---|
| 701 | NATIVE_LIB_TESTS_DIR+=$(call native_suffix_platform_dirs,tests) |
|---|
| 702 | NATIVE_LIB_GUI_DIR+=$(call native_suffix_platform_dirs,gui) |
|---|
| 703 | NATIVE_LIB_EXAMPLES_DIR+=$(call native_suffix_platform_dirs,examples) |
|---|
| 704 | NATIVE_LIB_TOOLS_DIR+=$(call native_suffix_platform_dirs,tools) |
|---|
| 705 | NATIVE_ALL_SOURCES_DIRS=$(strip $(NATIVE_LIB_SRC_DIR) $(NATIVE_LIB_TESTS_DIR) $(NATIVE_LIB_GUI_DIR) $(NATIVE_LIB_EXAMPLES_DIR) $(NATIVE_LIB_TOOLS_DIR)) |
|---|
| 706 | |
|---|
| 707 | NATIVE_ALL_OUTPUT_DIRS+=$(NATIVE_OUTPUT_LIB_DIR) $(NATIVE_OUTPUT_TOOLS_DIR) $(NATIVE_OUTPUT_TESTS_DIR) $(NATIVE_OUTPUT_DOCS_DIR) $(NATIVE_OUTPUT_EXAMPLES_DIR) $(NATIVE_OUTPUT_OBJ_DIR) |
|---|
| 708 | |
|---|
| 709 | |
|---|
| 710 | |
|---|
| 711 | ############################################################################################## |
|---|
| 712 | # |
|---|
| 713 | # our vpaths |
|---|
| 714 | # |
|---|
| 715 | |
|---|
| 716 | # all o files in $(OUTPUT_OBJ_DIR) |
|---|
| 717 | vpath %.o $(OUTPUT_OBJ_DIR) |
|---|
| 718 | |
|---|
| 719 | # all source files in all of our src,tests,ecxamples,tools,gui dirs |
|---|
| 720 | vpath %.m $(LIB_SRC_DIR) $(LIB_TESTS_DIR) $(LIB_EXAMPLES_DIR) $(LIB_TOOLS_DIR) $(LIB_GUI_DIR) |
|---|
| 721 | vpath %.mm $(LIB_SRC_DIR) $(LIB_TESTS_DIR) $(LIB_EXAMPLES_DIR) $(LIB_TOOLS_DIR) $(LIB_GUI_DIR) |
|---|
| 722 | vpath %.cpp $(LIB_SRC_DIR) $(LIB_TESTS_DIR) $(LIB_EXAMPLES_DIR) $(LIB_TOOLS_DIR) $(LIB_GUI_DIR) |
|---|
| 723 | vpath %.cc $(LIB_SRC_DIR) $(LIB_TESTS_DIR) $(LIB_EXAMPLES_DIR) $(LIB_TOOLS_DIR) $(LIB_GUI_DIR) |
|---|
| 724 | vpath %.c $(LIB_SRC_DIR) $(LIB_TESTS_DIR) $(LIB_EXAMPLES_DIR) $(LIB_TOOLS_DIR) $(LIB_GUI_DIR) |
|---|
| 725 | vpath %.rc $(LIB_SRC_DIR) $(LIB_TESTS_DIR) $(LIB_EXAMPLES_DIR) $(LIB_TOOLS_DIR) $(LIB_GUI_DIR) |
|---|
| 726 | |
|---|
| 727 | # all h files in our include dirs |
|---|
| 728 | vpath %.h .:$(LIB_INCLUDE_DIR) |
|---|
| 729 | |
|---|
| 730 | # all libraries in our OUTPUT_LIB_DIR |
|---|
| 731 | vpath %.a $(OUTPUT_LIB_DIR) |
|---|
| 732 | vpath %.so $(OUTPUT_LIB_DIR) |
|---|
| 733 | |
|---|
| 734 | # all testing shell scripts in our tests source dir |
|---|
| 735 | vpath %.sh $(LIB_TESTS_DIR) |
|---|
| 736 | |
|---|
| 737 | # all object files are precious. Make should not delete them even if they are intermediate |
|---|
| 738 | .PRECIOUS : $(OUTPUT_OBJ_DIR)/%.o |
|---|
| 739 | |
|---|
| 740 | # If we are cross compiling, then we must also look in our native dirs for objects and libraries. |
|---|
| 741 | ifeq ($(CROSS_COMPILING),1) |
|---|
| 742 | vpath %.o $(NATIVE_OUTPUT_OBJ_DIR) |
|---|
| 743 | vpath %.a $(NATIVE_OUTPUT_LIB_DIR) |
|---|
| 744 | .PRECIOUS : $(NATIVE_OUTPUT_OBJ_DIR)/%.o |
|---|
| 745 | endif |
|---|
| 746 | |
|---|
| 747 | |
|---|
| 748 | ############################################################################################## |
|---|
| 749 | # |
|---|
| 750 | # Make's rules. |
|---|
| 751 | |
|---|
| 752 | |
|---|
| 753 | # Remove make's built-in rules that we do not want |
|---|
| 754 | |
|---|
| 755 | (%.o) : %.o |
|---|
| 756 | |
|---|
| 757 | %.o : %.cpp |
|---|
| 758 | |
|---|
| 759 | %.o : %.cc |
|---|
| 760 | |
|---|
| 761 | %.o : %.rc |
|---|
| 762 | |
|---|
| 763 | %.o : %.c |
|---|
| 764 | |
|---|
| 765 | %.o : %.m |
|---|
| 766 | |
|---|
| 767 | %.o : %.mm |
|---|
| 768 | |
|---|
| 769 | %$(EXE) : %.cpp |
|---|
| 770 | |
|---|
| 771 | %$(EXE) : %.cc |
|---|
| 772 | |
|---|
| 773 | %$(EXE) : %.c |
|---|
| 774 | |
|---|
| 775 | %$(EXE) : %.m |
|---|
| 776 | |
|---|
| 777 | %$(EXE) : %.mm |
|---|
| 778 | |
|---|
| 779 | COMPILE.cpp=$(CXX) $(CXXFLAGS) -c |
|---|
| 780 | COMPILE.cc=$(CXX) $(CXXFLAGS) -c |
|---|
| 781 | COMPILE.c=$(CC) $(CFLAGS) -c |
|---|
| 782 | COMPILE.mm=$(CXX) $(MMFLAGS) -c |
|---|
| 783 | COMPILE.m=$(CC) $(MFLAGS) -c |
|---|
| 784 | COMPILE.rc=$(WINDRES) |
|---|
| 785 | |
|---|
| 786 | LINK.cpp=$(CXX) $(CXXFLAGS) $(LDFLAGS) $(LDLIBS) |
|---|
| 787 | LINK.cc=$(CXX) $(CXXFLAGS) $(LDFLAGS) $(LDLIBS) |
|---|
| 788 | LINK.c=$(CC) $(CFLAGS) $(LDFLAGS) $(LDLIBS) |
|---|
| 789 | LINK.mm=$(CXX) $(MMFLAGS) $(LDFLAGS) $(LDLIBS) |
|---|
| 790 | LINK.m=$(CC) $(MFLAGS) $(LDFLAGS) $(LDLIBS) |
|---|
| 791 | |
|---|
| 792 | NATIVE_COMPILE.cpp=$(NATIVE_CXX) $(NATIVE_CXXFLAGS) -c |
|---|
| 793 | NATIVE_COMPILE.cc=$(NATIVE_CX) $(NATIVE_CXXFLAGS) -c |
|---|
| 794 | NATIVE_COMPILE.c=$(NATIVE_CC) $(NATIVE_CFLAGS) -c |
|---|
| 795 | NATIVE_COMPILE.mm=$(NATIVE_CXX) $(NATIVE_MMFLAGS) -c |
|---|
| 796 | NATIVE_COMPILE.m=$(NATIVE_CC) $(NATIVE_MFLAGS) -c |
|---|
| 797 | NATIVE_COMPILE.rc=$(NATIVE_WINDRES) |
|---|
| 798 | |
|---|
| 799 | NATIVE_LINK.cpp=$(NATIVE_CXX) $(NATIVE_CXXFLAGS) $(NATIVE_LDFLAGS) $(NATIVE_LDLIBS) |
|---|
| 800 | NATIVE_LINK.cc=$(NATIVE_CXX) $(NATIVE_CXXFLAGS) $(NATIVE_LDFLAGS) $(NATIVE_LDLIBS) |
|---|
| 801 | NATIVE_LINK.c=$(NATIVE_CC) $(NATIVE_CFLAGS) $(NATIVE_LDFLAGS) $(NATIVE_LDLIBS) |
|---|
| 802 | NATIVE_LINK.mm=$(NATIVE_CXX) $(NATIVE_MMFLAGS) $(NATIVE_LDFLAGS) $(NATIVE_LDLIBS) |
|---|
| 803 | NATIVE_LINK.m=$(NATIVE_CC) $(NATIVE_MFLAGS) $(NATIVE_LDFLAGS) $(NATIVE_LDLIBS) |
|---|
| 804 | |
|---|
| 805 | |
|---|
| 806 | ############################################################################################## |
|---|
| 807 | # |
|---|
| 808 | # Replace make's original rules with our special rules, which place output objects |
|---|
| 809 | # directly in $(OUTPUT_OBJ_DIR), and also perform include file dependancy file creation. |
|---|
| 810 | |
|---|
| 811 | # For Objective C++: |
|---|
| 812 | $(OUTPUT_OBJ_DIR)/%.o $(OUTPUT_OBJ_DIR)/%.d : %.mm |
|---|
| 813 | @echo "CXX mm : $(notdir $<)" |
|---|
| 814 | @$(CXX) $(PREPROCESS_FLAGS) $(MMFLAGS) $(DEPENDENCY_OPTIONS) -MT '$(OUTPUT_OBJ_DIR)'/$*.o -MF $(OUTPUT_OBJ_DIR)/$*.d $< && $(COMPILE.cpp) $(PREPROCESS_FLAGS) $(COMPILE_FLAGS) -o $(OUTPUT_OBJ_DIR)/$*.o $< |
|---|
| 815 | |
|---|
| 816 | # For Objective C: |
|---|
| 817 | $(OUTPUT_OBJ_DIR)/%.o $(OUTPUT_OBJ_DIR)/%.d : %.m |
|---|
| 818 | @echo "CC m : $(notdir $<)" |
|---|
| 819 | @$(CC) $(PREPROCESS_FLAGS) $(MFLAGS) $(DEPENDENCY_OPTIONS) -MT '$(OUTPUT_OBJ_DIR)'/$*.o -MF $(OUTPUT_OBJ_DIR)/$*.d $< && $(COMPILE.c) $(PREPROCESS_FLAGS) $(COMPILE_FLAGS) -o $(OUTPUT_OBJ_DIR)/$*.o $< |
|---|
| 820 | |
|---|
| 821 | # For C++: (cpp) |
|---|
| 822 | $(OUTPUT_OBJ_DIR)/%.o $(OUTPUT_OBJ_DIR)/%.d : %.cpp |
|---|
| 823 | @echo "CXX : $(notdir $<)" |
|---|
| 824 | @$(CXX) $(PREPROCESS_FLAGS) $(DEPENDENCY_OPTIONS) -MT '$(OUTPUT_OBJ_DIR)'/$*.o -MF $(OUTPUT_OBJ_DIR)/$*.d $< && $(COMPILE.cpp) $(PREPROCESS_FLAGS) $(COMPILE_FLAGS) -o $(OUTPUT_OBJ_DIR)/$*.o $< |
|---|
| 825 | |
|---|
| 826 | # Asm For C++: (cpp) |
|---|
| 827 | $(OUTPUT_OBJ_DIR)/%.asm : %.cpp |
|---|
| 828 | @echo "CXX asm : $(notdir $<)" |
|---|
| 829 | @$(COMPILE.cc) $(PREPROCESS_FLAGS) $(COMPILE_FLAGS) -S -o $(OUTPUT_OBJ_DIR)/$*.asm $< |
|---|
| 830 | |
|---|
| 831 | # For C++: (cc) |
|---|
| 832 | $(OUTPUT_OBJ_DIR)/%.o $(OUTPUT_OBJ_DIR)/%.d : %.cc |
|---|
| 833 | @echo "CXX : $(notdir $<)" |
|---|
| 834 | @$(CXX) $(PREPROCESS_FLAGS) $(DEPENDENCY_OPTIONS) -MT '$(OUTPUT_OBJ_DIR)'/$*.o -MF $(OUTPUT_OBJ_DIR)/$*.d $< && $(COMPILE.cc) $(PREPROCESS_FLAGS) $(COMPILE_FLAGS) -o $(OUTPUT_OBJ_DIR)/$*.o $< |
|---|
| 835 | |
|---|
| 836 | # Asm For C++: (cc) |
|---|
| 837 | $(OUTPUT_OBJ_DIR)/%.asm : %.cc |
|---|
| 838 | @echo "CXX asm : $(notdir $<)" |
|---|
| 839 | @$(COMPILE.cc) $(PREPROCESS_FLAGS) $(COMPILE_FLAGS) -S -o $(OUTPUT_OBJ_DIR)/$*.asm $< |
|---|
| 840 | |
|---|
| 841 | # For C: |
|---|
| 842 | $(OUTPUT_OBJ_DIR)/%.o $(OUTPUT_OBJ_DIR)/%.d : %.c |
|---|
| 843 | @echo "CC : $(notdir $<)" |
|---|
| 844 | @$(CC) $(PREPROCESS_FLAGS) $(DEPENDENCY_OPTIONS) -MT '$(OUTPUT_OBJ_DIR)'/$*.o -MF $(OUTPUT_OBJ_DIR)/$*.d $< && $(COMPILE.c) $(PREPROCESS_FLAGS) $(COMPILE_FLAGS) -o $(OUTPUT_OBJ_DIR)/$*.o $< |
|---|
| 845 | |
|---|
| 846 | # Asm For C: |
|---|
| 847 | $(OUTPUT_OBJ_DIR)/%.asm : %.c |
|---|
| 848 | @echo "C asm : $(notdir $<)" |
|---|
| 849 | @$(COMPILE.c) $(PREPROCESS_FLAGS) $(COMPILE_FLAGS) -S -o $(OUTPUT_OBJ_DIR)/$*.asm $< |
|---|
| 850 | |
|---|
| 851 | # For RC (windows): |
|---|
| 852 | $(OUTPUT_OBJ_DIR)/%.o : %.rc |
|---|
| 853 | @echo "WINDRES : $(notdir $<)" |
|---|
| 854 | @$(COMPILE.rc) -I$(dir $<) $(PREPROCESS_FLAGS) $< $@ |
|---|
| 855 | |
|---|
| 856 | ifeq ($(TARGET_PLATFORM_MACOSX_UNIVERSAL),1) |
|---|
| 857 | # For disassembly of object files for mac 'fat' binaries, i386 and ppc archs |
|---|
| 858 | $(OUTPUT_OBJ_DIR)/%.disasm : $(OUTPUT_OBJ_DIR)/%.o |
|---|
| 859 | @echo "DISASM (2) : $(notdir $<)" |
|---|
| 860 | @echo '# disassembly of ' $(notdir $<) >$(OUTPUT_OBJ_DIR)/$*.disasm |
|---|
| 861 | @for i in $(MACOSX_UNIVERSAL_ARCHS); do \ |
|---|
| 862 | echo '#---------- ' $$i >>$(OUTPUT_OBJ_DIR)/$*.disasm; \ |
|---|
| 863 | $(LIPO) -thin $$i $< -o $(OUTPUT_OBJ_DIR)/$*.$$i.o && \ |
|---|
| 864 | $(DISASM) $(DISASM_FLAGS) $(OUTPUT_OBJ_DIR)/$*.$$i.o >>$(OUTPUT_OBJ_DIR)/$*.disasm; \ |
|---|
| 865 | $(RM) $(OUTPUT_OBJ_DIR)/$*.$$i.o; \ |
|---|
| 866 | done |
|---|
| 867 | else |
|---|
| 868 | # For disassembly of object files |
|---|
| 869 | $(OUTPUT_OBJ_DIR)/%.disasm : $(OUTPUT_OBJ_DIR)/%.o |
|---|
| 870 | @echo "DISASM : $(notdir $<)" |
|---|
| 871 | @$(OBJDUMP) $(OBJDUMP_FLAGS) $< >$(OUTPUT_OBJ_DIR)/$*.disasm |
|---|
| 872 | endif |
|---|
| 873 | |
|---|
| 874 | |
|---|
| 875 | ifeq ($(CROSS_COMPILING),1) |
|---|
| 876 | |
|---|
| 877 | $(NATIVE_OUTPUT_OBJ_DIR)/%.o $(NATIVE_OUTPUT_OBJ_DIR)/%.d : %.mm |
|---|
| 878 | @echo "NATIVE_CXX mm : $(notdir $<)" |
|---|
| 879 | @$(NATIVE_CXX) $(NATIVE_PREPROCESS_FLAGS) $(DEPENDENCY_OPTIONS) '$(NATIVE_OUTPUT_OBJ_DIR)'/$*.o -MF $(NATIVE_OUTPUT_OBJ_DIR)/$*.d $< && $(NATIVE_COMPILE.mm) $(NATIVE_PREPROCESS_FLAGS) $(NATIVE_COMPILE_FLAGS) -o $(NATIVE_OUTPUT_OBJ_DIR)/$*.o $< |
|---|
| 880 | |
|---|
| 881 | $(NATIVE_OUTPUT_OBJ_DIR)/%.o $(NATIVE_OUTPUT_OBJ_DIR)/%.d : %.m |
|---|
| 882 | @echo "NATIVE_CC m : $(notdir $<)" |
|---|
| 883 | @$(NATIVE_CC) $(NATIVE_PREPROCESS_FLAGS) $(DEPENDENCY_OPTIONS) -MT '$(NATIVE_OUTPUT_OBJ_DIR)'/$*.o -MF $(NATIVE_OUTPUT_OBJ_DIR)/$*.d $< && $(NATIVE_COMPILE.m) $(NATIVE_PREPROCESS_FLAGS) $(NATIVE_COMPILE_FLAGS) -o $(NATIVE_OUTPUT_OBJ_DIR)/$*.o $< |
|---|
| 884 | |
|---|
| 885 | $(NATIVE_OUTPUT_OBJ_DIR)/%.o $(NATIVE_OUTPUT_OBJ_DIR)/%.d : %.cpp |
|---|
| 886 | @echo "NATIVE_CXX : $(notdir $<)" |
|---|
| 887 | @$(NATIVE_CXX) $(NATIVE_PREPROCESS_FLAGS) $(DEPENDENCY_OPTIONS) -MT '$(NATIVE_OUTPUT_OBJ_DIR)'/$*.o -MF $(NATIVE_OUTPUT_OBJ_DIR)/$*.d $< && $(NATIVE_COMPILE.cpp) $(NATIVE_PREPROCESS_FLAGS) $(NATIVE_COMPILE_FLAGS) -o $(NATIVE_OUTPUT_OBJ_DIR)/$*.o $< |
|---|
| 888 | |
|---|
| 889 | $(NATIVE_OUTPUT_OBJ_DIR)/%.o $(NATIVE_OUTPUT_OBJ_DIR)/%.d : %.cc |
|---|
| 890 | @echo "NATIVE_CXX : $(notdir $<)" |
|---|
| 891 | @$(NATIVE_CXX) $(NATIVE_PREPROCESS_FLAGS) $(DEPENDENCY_OPTIONS) -MT '$(NATIVE_OUTPUT_OBJ_DIR)'/$*.o -MF $(NATIVE_OUTPUT_OBJ_DIR)/$*.d $< && $(NATIVE_COMPILE.cpp) $(NATIVE_PREPROCESS_FLAGS) $(NATIVE_COMPILE_FLAGS) -o $(NATIVE_OUTPUT_OBJ_DIR)/$*.o $< |
|---|
| 892 | |
|---|
| 893 | $(NATIVE_OUTPUT_OBJ_DIR)/%.o $(NATIVE_OUTPUT_OBJ_DIR)/%.d : %.c |
|---|
| 894 | @echo "NATIVE_CC : $(notdir $<)" |
|---|
| 895 | @$(NATIVE_CC) $(NATIVE_PREPROCESS_FLAGS) $(DEPENDENCY_OPTIONS) -MT -MF '$(NATIVE_OUTPUT_OBJ_DIR)'/$*.d $(NATIVE_OUTPUT_OBJ_DIR)/$*.d $< && $(NATIVE_COMPILE.c) $(NATIVE_PREPROCESS_FLAGS) $(NATIVE_COMPILE_FLAGS) -o $(NATIVE_OUTPUT_OBJ_DIR)/$*.o $< |
|---|
| 896 | |
|---|
| 897 | $(NATIVE_OUTPUT_OBJ_DIR)/%.o : %.rc |
|---|
| 898 | @echo "NATIVE_WINDRES : $(notdir $<)" |
|---|
| 899 | @$(NATIVE_COMPILE.rc) -I$(dir $<) $(NATIVE_PREPROCESS_FLAGS) $< $@ |
|---|
| 900 | endif |
|---|
| 901 | |
|---|
| 902 | |
|---|
| 903 | $(OUTPUT_TOOLS_DIR)/%$(EXE) : $(OUTPUT_OBJ_DIR)/%.o |
|---|
| 904 | @echo "LINKING tool: $(notdir $<)" |
|---|
| 905 | @$(LINK.cpp) $(LINK_FLAGS) $(LDFLAGS) -o $(OUTPUT_TOOLS_DIR)/$*$(EXE) $< -L$(OUTPUT_LIB_DIR) $(PROJECT_LDLIB) $(LDLIBS) |
|---|
| 906 | |
|---|
| 907 | |
|---|
| 908 | $(OUTPUT_GUI_DIR)/%$(EXE) : $(OUTPUT_OBJ_DIR)/%.o |
|---|
| 909 | @echo "LINKING gui: $(notdir $<)" |
|---|
| 910 | @$(LINK.cpp) $(LINK_FLAGS) $(LDFLAGS) $(LINK_FLAGS_GUI) -o $(OUTPUT_GUI_DIR)/$*$(EXE) $< -L$(OUTPUT_LIB_DIR) $(PROJECT_LDLIB) $(LDLIBS) $(LDLIBS_GUI) |
|---|
| 911 | |
|---|
| 912 | |
|---|
| 913 | $(OUTPUT_EXAMPLES_DIR)/%$(EXE) : $(OUTPUT_OBJ_DIR)/%.o |
|---|
| 914 | @echo "LINKING example: $(notdir $<)" |
|---|
| 915 | @$(LINK.cpp) $(LINK_FLAGS) $(LDFLAGS) -o $(OUTPUT_EXAMPLES_DIR)/$*$(EXE) $< -L$(OUTPUT_LIB_DIR) $(PROJECT_LDLIB) $(LDLIBS) |
|---|
| 916 | |
|---|
| 917 | $(OUTPUT_TESTS_DIR)/%$(EXE) : $(OUTPUT_OBJ_DIR)/%.o |
|---|
| 918 | @echo "LINKING test: $(notdir $<)" |
|---|
| 919 | @$(LINK.cpp) $(LINK_FLAGS) $(LDFLAGS) -o $(OUTPUT_TESTS_DIR)/$*$(EXE) $< -L$(OUTPUT_LIB_DIR) $(PROJECT_LDLIB) $(LDLIBS) |
|---|
| 920 | |
|---|
| 921 | |
|---|
| 922 | ifeq ($(CROSS_COMPILING),1) |
|---|
| 923 | |
|---|
| 924 | $(NATIVE_OUTPUT_TOOLS_DIR)/%$(NATIVE_EXE) : $(NATIVE_OUTPUT_OBJ_DIR)/%.o |
|---|
| 925 | @echo "NATIVE_LINKING tool: $(notdir $<)" |
|---|
| 926 | @$(NATIVE_LINK.cpp) $(NATIVE_LINK_FLAGS) $(NATIVE_LDFLAGS) -o $(NATIVE_OUTPUT_TOOLS_DIR)/$*$(NATIVE_EXE) $< -L$(NATIVE_OUTPUT_LIB_DIR) $(NATIVE_PROJECT_LDLIB) $(NATIVE_LDLIBS) |
|---|
| 927 | |
|---|
| 928 | $(NATIVE_OUTPUT_EXAMPLES_DIR)/%$(NATIVE_EXE) : $(NATIVE_OUTPUT_OBJ_DIR)/%.o |
|---|
| 929 | @echo "NATIVE_LINKING example: $(notdir $<)" |
|---|
| 930 | @$(NATIVE_LINK.cpp) $(NATIVE_LINK_FLAGS) $(NATIVE_LDFLAGS) -o $(NATIVE_OUTPUT_EXAMPLES_DIR)/$*$(NATIVE_EXE) $< -L$(NATIVE_OUTPUT_LIB_DIR) $(NATIVE_PROJECT_LDLIB) $(NATIVE_LDLIBS) |
|---|
| 931 | |
|---|
| 932 | $(NATIVE_OUTPUT_TESTS_DIR)/%$(NATIVE_EXE) : $(NATIVE_OUTPUT_OBJ_DIR)/%.o |
|---|
| 933 | @echo "NATIVE_LINKING test: $(notdir $<)" |
|---|
| 934 | @$(NATIVE_LINK.cpp) $(NATIVE_LINK_FLAGS) $(NATIVE_LDFLAGS) -o $(NATIVE_OUTPUT_TESTS_DIR)/$*$(NATIVE_EXE) $< -L$(NATIVE_OUTPUT_LIB_DIR) $(NATIVE_PROJECT_LDLIB) $(NATIVE_LDLIBS) |
|---|
| 935 | endif |
|---|
| 936 | |
|---|
| 937 | |
|---|
| 938 | |
|---|
| 939 | # get the list of library source files from the src directory |
|---|
| 940 | LIB_CPP_FILES=$(call get_src_file_list,cpp) |
|---|
| 941 | LIB_CC_FILES=$(call get_src_file_list,cc) |
|---|
| 942 | LIB_C_FILES=$(call get_src_file_list,c) |
|---|
| 943 | LIB_M_FILES=$(call get_src_file_list,m) |
|---|
| 944 | LIB_MM_FILES=$(call get_src_file_list,mm) |
|---|
| 945 | LIB_RC_FILES=$(call get_src_file_list,rc) |
|---|
| 946 | LIB_O_FILES=$(call get_cpp_o_files,$(LIB_CPP_FILES)) \ |
|---|
| 947 | $(call get_cc_o_files,$(LIB_CC_FILES)) \ |
|---|
| 948 | $(call get_c_o_files,$(LIB_C_FILES)) \ |
|---|
| 949 | $(call get_m_o_files,$(LIB_M_FILES)) \ |
|---|
| 950 | $(call get_mm_o_files,$(LIB_MM_FILES)) \ |
|---|
| 951 | $(call get_rc_o_files,$(LIB_RC_FILES)) |
|---|
| 952 | |
|---|
| 953 | LIB_DISASM_FILES=$(LIB_O_FILES:.o=.disasm) |
|---|
| 954 | LIB_ASM_FILES=$(LIB_O_FILES:.o=.asm) |
|---|
| 955 | |
|---|
| 956 | |
|---|
| 957 | ifeq ($(CROSS_COMPILING),1) |
|---|
| 958 | NATIVE_LIB_CPP_FILES=$(call get_native_src_file_list,cpp) |
|---|
| 959 | NATIVE_LIB_CC_FILES=$(call get_native_src_file_list,cc) |
|---|
| 960 | NATIVE_LIB_C_FILES=$(call get_native_src_file_list,c) |
|---|
| 961 | NATIVE_LIB_M_FILES=$(call get_native_src_file_list,m) |
|---|
| 962 | NATIVE_LIB_MM_FILES=$(call get_native_src_file_list,mm) |
|---|
| 963 | NATIVE_LIB_RC_FILES=$(call get_native_src_file_list,rc) |
|---|
| 964 | |
|---|
| 965 | NATIVE_LIB_O_FILES=$(call get_native_cpp_o_files,$(NATIVE_LIB_CPP_FILES)) \ |
|---|
| 966 | $(call get_native_cc_o_files,$(NATIVE_LIB_CC_FILES)) \ |
|---|
| 967 | $(call get_native_c_o_files,$(NATIVE_LIB_C_FILES)) \ |
|---|
| 968 | $(call get_native_m_o_files,$(NATIVE_LIB_M_FILES)) \ |
|---|
| 969 | $(call get_native_mm_o_files,$(NATIVE_LIB_MM_FILES)) \ |
|---|
| 970 | $(call get_native_rc_o_files,$(NATIVE_LIB_RC_FILES)) |
|---|
| 971 | endif |
|---|
| 972 | |
|---|
| 973 | LIB_INCLUDE_FILES=$(wildcard $(LIB_INCLUDE_DIR)/*.h) |
|---|
| 974 | |
|---|
| 975 | |
|---|
| 976 | # get the list of tool program source files from the tools directories |
|---|
| 977 | |
|---|
| 978 | $(eval $(call search_program_group,TOOLS)) |
|---|
| 979 | |
|---|
| 980 | # get the list of test program source files from the tests directories |
|---|
| 981 | |
|---|
| 982 | $(eval $(call search_program_group,TESTS)) |
|---|
| 983 | |
|---|
| 984 | # get the list of example program source files from the examples directories |
|---|
| 985 | |
|---|
| 986 | $(eval $(call search_program_group,EXAMPLES)) |
|---|
| 987 | |
|---|
| 988 | # get the list of example program source files from the gui directories |
|---|
| 989 | |
|---|
| 990 | $(eval $(call search_program_group,GUI)) |
|---|
| 991 | |
|---|
| 992 | |
|---|
| 993 | # if there are no O files to build, do not build or link a lib! |
|---|
| 994 | |
|---|
| 995 | ifeq ($(strip $(LIB_O_FILES)),) |
|---|
| 996 | DO_NOT_BUILD_LIB=1 |
|---|
| 997 | else |
|---|
| 998 | DO_NOT_BUILD_LIB=0 |
|---|
| 999 | endif |
|---|
| 1000 | |
|---|
| 1001 | ifeq ($(strip $(NATIVE_LIB_O_FILES)),) |
|---|
| 1002 | NATIVE_DO_NOT_BUILD_LIB=1 |
|---|
| 1003 | else |
|---|
| 1004 | NATIVE_DO_NOT_BUILD_LIB=0 |
|---|
| 1005 | endif |
|---|
| 1006 | |
|---|
| 1007 | |
|---|
| 1008 | ifeq ($(DO_NOT_BUILD_LIB),1) |
|---|
| 1009 | PROJECT_LDLIB= |
|---|
| 1010 | else |
|---|
| 1011 | PROJECT_LDLIB=-l$(PROJECT) |
|---|
| 1012 | endif |
|---|
| 1013 | |
|---|
| 1014 | ifeq ($(NATIVE_DO_NOT_BUILD_LIB),1) |
|---|
| 1015 | NATIVE_PROJECT_LDLIB= |
|---|
| 1016 | else |
|---|
| 1017 | NATIVE_PROJECT_LDLIB=-l$(PROJECT) |
|---|
| 1018 | endif |
|---|
| 1019 | |
|---|
| 1020 | ifeq ($(DO_NOT_BUILD_LIB),1) |
|---|
| 1021 | OUTPUT_LIB= |
|---|
| 1022 | else |
|---|
| 1023 | OUTPUT_LIB?=$(OUTPUT_LIB_DIR)/lib$(PROJECT).a |
|---|
| 1024 | endif |
|---|
| 1025 | |
|---|
| 1026 | ifeq ($(DO_NOT_BUILD_LIB),1) |
|---|
| 1027 | NATIVE_OUTPUT_LIB= |
|---|
| 1028 | else |
|---|
| 1029 | NATIVE_OUTPUT_LIB?=$(NATIVE_OUTPUT_LIB_DIR)/lib$(PROJECT).a |
|---|
| 1030 | endif |
|---|
| 1031 | |
|---|
| 1032 | |
|---|
| 1033 | |
|---|
| 1034 | |
|---|
| 1035 | |
|---|
| 1036 | |
|---|
| 1037 | # manipulate these file lists to create our desired output files in the proper place |
|---|
| 1038 | |
|---|
| 1039 | # this first target, 'everything' is a placeholder which makes the required subdirectories and then |
|---|
| 1040 | # calls make again with the required directories made. Since these subdirectories are part of the |
|---|
| 1041 | # search paths, make must see them when invoked otherwise it gets confused. |
|---|
| 1042 | |
|---|
| 1043 | .PHONY : everything |
|---|
| 1044 | |
|---|
| 1045 | ifeq ($(CROSS_COMPILING),1) |
|---|
| 1046 | everything : native-dirs dirs |
|---|
| 1047 | @$(MAKE) all |
|---|
| 1048 | else |
|---|
| 1049 | everything : dirs |
|---|
| 1050 | @$(MAKE) all |
|---|
| 1051 | endif |
|---|
| 1052 | |
|---|
| 1053 | |
|---|
| 1054 | # load in any custom makefiles in every source directory |
|---|
| 1055 | #-include $(wildcard $(foreach dir,$(ALL_SOURCES_DIRS),$(dir)/*.mak)) |
|---|
| 1056 | |
|---|
| 1057 | |
|---|
| 1058 | # win32_gui_program is a bit of a hack but it shows the future plan of allowing multi object programs being built. |
|---|
| 1059 | # a program is defined my a dirname in gui/win32 - this dirname is the application name. Any sources in the dir are |
|---|
| 1060 | # compiled and linked with the library |
|---|
| 1061 | |
|---|
| 1062 | define win32_gui_program |
|---|
| 1063 | |
|---|
| 1064 | vpath %.cpp $(PROJECT_TOP_DIR)/gui/win32/$(1)/ |
|---|
| 1065 | vpath %.cc $(PROJECT_TOP_DIR)/gui/win32/$(1)/ |
|---|
| 1066 | vpath %.c $(PROJECT_TOP_DIR)/gui/win32/$(1)/ |
|---|
| 1067 | vpath %.rc $(PROJECT_TOP_DIR)/gui/win32/$(1)/ |
|---|
| 1068 | |
|---|
| 1069 | LIB_GUI_EXE_FILES += $$(OUTPUT_GUI_DIR)/$(1)$$(EXE) |
|---|
| 1070 | |
|---|
| 1071 | WIN32_GUI_DIR_$(1)=$$(PROJECT_TOP_DIR)/gui/win32/$(1) |
|---|
| 1072 | |
|---|
| 1073 | #LIB_GUI_DIR += $$(WIN32_GUI_DIR_$(1)) |
|---|
| 1074 | |
|---|
| 1075 | WIN32_GUI_CPP_$(1)= $$(notdir $$(wildcard $$(PROJECT_TOP_DIR)/gui/win32/$(1)/*.cpp)) |
|---|
| 1076 | WIN32_GUI_CC_$(1)= $$(notdir $$(wildcard $$(PROJECT_TOP_DIR)/gui/win32/$(1)/*.cc)) |
|---|
| 1077 | WIN32_GUI_C_$(1)= $$(notdir $$(wildcard $$(PROJECT_TOP_DIR)/gui/win32/$(1)/*.c)) |
|---|
| 1078 | WIN32_GUI_RC_$(1)= $$(notdir $$(wildcard $$(PROJECT_TOP_DIR)/gui/win32/$(1)/*.rc)) |
|---|
| 1079 | |
|---|
| 1080 | WIN32_GUI_O_$(1)= $$(strip $$(WIN32_GUI_CPP_$(1):.cpp=.o) $$(WIN32_GUI_CC_$(1):.cc=.o) $$(WIN32_GUI_C_$(1):.c=.o) $$(WIN32_GUI_RC_$(1):.rc=.o)) |
|---|
| 1081 | |
|---|
| 1082 | gui : $$(OUTPUT_GUI_DIR)/$(1)$$(EXE) |
|---|
| 1083 | |
|---|
| 1084 | $$(OUTPUT_GUI_DIR)/$(1)$$(EXE) : $$(addprefix $$(OUTPUT_OBJ_DIR)/, $$(WIN32_GUI_O_$(1))) |
|---|
| 1085 | @echo "LINKING MULTI-OBJECT GUI: $$(notdir $$@) from $$(notdir $$^)" |
|---|
| 1086 | @$$(LINK.cpp) $$(LINK_FLAGS) $$(LDFLAGS) $$(LINK_FLAGS_GUI) -o $$@ $$^ -L$$(OUTPUT_LIB_DIR) $$(PROJECT_LDLIB) $$(LDLIBS) $$(LDLIBS_GUI) |
|---|
| 1087 | |
|---|
| 1088 | |
|---|
| 1089 | endef |
|---|
| 1090 | |
|---|
| 1091 | ifeq ($(TARGET_PLATFORM_MINGW32),1) |
|---|
| 1092 | $(foreach prog,$(call bare_subdirs_in_path,$(PROJECT_TOP_DIR)/gui/win32),$(eval $(call win32_gui_program,$(prog)))) |
|---|
| 1093 | endif |
|---|
| 1094 | |
|---|
| 1095 | |
|---|
| 1096 | .PHONY : all |
|---|
| 1097 | |
|---|
| 1098 | ifdef ALL |
|---|
| 1099 | all : $(ALL) |
|---|
| 1100 | else |
|---|
| 1101 | ifeq ($(CROSS_COMPILING),1) |
|---|
| 1102 | all : native-dirs dirs native-lib native-tools native-tests native-examples dirs lib tools tests examples gui |
|---|
| 1103 | else |
|---|
| 1104 | all : dirs lib tools tests examples gui |
|---|
| 1105 | endif |
|---|
| 1106 | endif |
|---|
| 1107 | |
|---|
| 1108 | .PHONY : dirs |
|---|
| 1109 | |
|---|
| 1110 | dirs : |
|---|
| 1111 | -@$(MKDIR) -p $(ALL_OUTPUT_DIRS) |
|---|
| 1112 | |
|---|
| 1113 | |
|---|
| 1114 | .PHONY : lib |
|---|
| 1115 | |
|---|
| 1116 | |
|---|
| 1117 | |
|---|
| 1118 | ifeq ($(DO_NOT_BUILD_LIB),0) |
|---|
| 1119 | lib : dirs $(OUTPUT_LIB) |
|---|
| 1120 | |
|---|
| 1121 | $(OUTPUT_LIB) : $(LIB_O_FILES) |
|---|
| 1122 | ifeq ($(TARGET_USE_AR),1) |
|---|
| 1123 | @echo "AR : $(notdir $@)($(notdir $?))" |
|---|
| 1124 | @$(AR) $(ARFLAGS) $@ $? >/dev/null |
|---|
| 1125 | @$(RANLIB) $@ |
|---|
| 1126 | endif |
|---|
| 1127 | ifeq ($(TARGET_USE_MACOSX_LIBTOOL),1) |
|---|
| 1128 | @echo "LIBTOOL: $(notdir $@)($(notdir $?))" |
|---|
| 1129 | # @echo $(MACOSX_LIBTOOL) $(MACOSX_LIBTOOLFLAGS) -o $@ $^ |
|---|
| 1130 | @$(MACOSX_LIBTOOL) $(MACOSX_LIBTOOLFLAGS) -o $@ $^ |
|---|
| 1131 | endif |
|---|
| 1132 | else |
|---|
| 1133 | lib : dirs |
|---|
| 1134 | endif |
|---|
| 1135 | |
|---|
| 1136 | |
|---|
| 1137 | .PHONY : tools |
|---|
| 1138 | |
|---|
| 1139 | tools : lib $(LIB_TOOLS_EXE_FILES) config-tool |
|---|
| 1140 | |
|---|
| 1141 | $(LIB_TOOLS_EXE_FILES) : $(OUTPUT_LIB) |
|---|
| 1142 | |
|---|
| 1143 | .PHONY : examples |
|---|
| 1144 | |
|---|
| 1145 | examples: lib $(LIB_EXAMPLES_EXE_FILES) |
|---|
| 1146 | |
|---|
| 1147 | $(LIB_EXAMPLES_EXE_FILES) : $(OUTPUT_LIB) |
|---|
| 1148 | |
|---|
| 1149 | .PHONY : tests |
|---|
| 1150 | |
|---|
| 1151 | tests: lib $(LIB_TESTS_EXE_FILES) |
|---|
| 1152 | |
|---|
| 1153 | $(LIB_TESTS_EXE_FILES) : $(OUTPUT_LIB) |
|---|
| 1154 | |
|---|
| 1155 | .PHONY : gui |
|---|
| 1156 | |
|---|
| 1157 | gui: lib $(LIB_GUI_EXE_FILES) |
|---|
| 1158 | |
|---|
| 1159 | $(LIB_GUI_EXE_FILES) : $(OUTPUT_LIB) |
|---|
| 1160 | |
|---|
| 1161 | .PHONY : install |
|---|
| 1162 | |
|---|
| 1163 | install : lib tools tests examples |
|---|
| 1164 | @-$(MKDIR) -p $(INSTALL_BIN_DIR) |
|---|
| 1165 | @for i in $(LIB_TOOLS_EXE_FILES) $(LIB_GUI_EXE_FILES); do echo "$${i}"; $(INSTALL) "$${i}" "$(INSTALL_BIN_DIR)"; done |
|---|
| 1166 | |
|---|
| 1167 | .PHONY : install-dev |
|---|
| 1168 | |
|---|
| 1169 | install-dev : install |
|---|
| 1170 | @-$(MKDIR) -p $(INSTALL_INCLUDE_DIR) $(INSTALL_LIB_DIR) |
|---|
| 1171 | @for i in $(LIB_INCLUDE_DIR); do if [ -d "$${i}" ]; then $(RSYNC) $(RSYNC_OPTIONS) "$${i}"/* $(INSTALL_INCLUDE_DIR); fi; done |
|---|
| 1172 | @$(RSYNC) $(RSYNC_OPTIONS) $(OUTPUT_LIB) $(INSTALL_LIB_DIR) |
|---|
| 1173 | @echo $(PROJECT_CONFIG_TOOL) |
|---|
| 1174 | @$(INSTALL) "$(CONFIG_TOOL_FILE)" "$(INSTALL_BIN_DIR)" |
|---|
| 1175 | |
|---|
| 1176 | .PHONY : install-dev-docs |
|---|
| 1177 | |
|---|
| 1178 | install-dev-docs : docs install-dev |
|---|
| 1179 | @-$(MKDIR) -p $(INSTALL_DOCS_DIR) |
|---|
| 1180 | @$(RSYNC) $(RSYNC_OPTIONS) $(OUTPUT_DOCS_DIR)/* $(INSTALL_DOCS_DIR) |
|---|
| 1181 | |
|---|
| 1182 | .PHONY : test |
|---|
| 1183 | |
|---|
| 1184 | ifeq ($(CROSS_COMPILING),1) |
|---|
| 1185 | test : native-test |
|---|
| 1186 | else |
|---|
| 1187 | test: lib tools $(LIB_TESTS_SH_FILES) $(LIB_TESTS_EXE_FILES) |
|---|
| 1188 | @cd "$(OUTPUT_TESTS_DIR)"; \ |
|---|
| 1189 | for i in $(LIB_TESTS_EXE_FILES); \ |
|---|
| 1190 | do \ |
|---|
| 1191 | n=$$(basename $$i); \ |
|---|
| 1192 | if $(VALGRIND) $(VALGRIND_OPTIONS) "./$${n}" >"$${n}.out" 2>"$${n}.err"; then rm "$${n}.err"; echo SUCCESS:$${n}; else echo FAIL:$${n}; fi;\ |
|---|
| 1193 | done; \ |
|---|
| 1194 | for i in $(LIB_TESTS_SH_FILES); \ |
|---|
| 1195 | do \ |
|---|
| 1196 | n=$$(basename $$i); \ |
|---|
| 1197 | if bash "$${i}" >"$${n}.out" 2>"$${n}.err"; then rm "$${n}.err"; echo SUCCESS:$${n}; else echo FAIL:$${n}; fi;\ |
|---|
| 1198 | done |
|---|
| 1199 | endif |
|---|
| 1200 | |
|---|
| 1201 | .PHONY : docs |
|---|
| 1202 | |
|---|
| 1203 | docs : lib $(LIB_DOCS_DIR)/Doxyfile |
|---|
| 1204 | @echo "DOCS :" |
|---|
| 1205 | @( export TOP="$(PROJECT_TOP_DIR)"; export PROJECT="$(PROJECT)"; export PROJECT_VERSION=$(PROJECT_VERSION); cd "$(OUTPUT_DOCS_DIR)" && $(DOXYGEN) $(LIB_DOCS_DIR)/Doxyfile ) |
|---|
| 1206 | |
|---|
| 1207 | .PHONY : clean |
|---|
| 1208 | |
|---|
| 1209 | clean : |
|---|
| 1210 | -@$(RM) $(LIB_TESTS_O_FILES) $(LIB_EXAMPLES_O_FILES) $(LIB_TOOLS_O_FILES) $(LIB_O_FILES) $(OUTPUT_OBJ_DIR)/*.d 2>/dev/null |
|---|
| 1211 | -@$(RM) $(LIB_TESTS_EXE_FILES) $(LIB_EXAMPLES_EXE_FILES) $(LIB_TOOLS_EXE_FILES) 2>/dev/null |
|---|
| 1212 | -@$(RM) -r -f $(LIB_GUI_EXE_FILES) 2>/dev/null |
|---|
| 1213 | ifeq ($(CROSS_COMPILING),1) |
|---|
| 1214 | -@$(RM) $(NATIVE_LIB_TESTS_O_FILES) $(NATIVE_LIB_EXAMPLES_O_FILES) $(NATIVE_LIB_TOOLS_O_FILES) $(NATIVE_LIB_O_FILES) $(NATIVE_OUTPUT_OBJ_DIR)/*.d 2>/dev/null |
|---|
| 1215 | -@$(RM) $(NATIVE_LIB_TESTS_EXE_FILES) $(NATIVE_LIB_EXAMPLES_EXE_FILES) $(NATIVE_LIB_TOOLS_EXE_FILES) 2>/dev/null |
|---|
| 1216 | endif |
|---|
| 1217 | |
|---|
| 1218 | .PHONY : realclean |
|---|
| 1219 | |
|---|
| 1220 | realclean : distclean |
|---|
| 1221 | |
|---|
| 1222 | .PHONY : distclean |
|---|
| 1223 | |
|---|
| 1224 | distclean : clean |
|---|
| 1225 | -@$(RM) $(OUTPUT_LIB) 2>/dev/null |
|---|
| 1226 | ifeq ($(CROSS_COMPILING),1) |
|---|
| 1227 | -@$(RM) $(NATIVE_OUTPUT_LIB) 2>/dev/null |
|---|
| 1228 | endif |
|---|
| 1229 | |
|---|
| 1230 | |
|---|
| 1231 | ifeq ($(CROSS_COMPILING),1) |
|---|
| 1232 | .PHONY : native-dirs |
|---|
| 1233 | |
|---|
| 1234 | native-dirs : |
|---|
| 1235 | -@$(MKDIR) -p $(NATIVE_ALL_OUTPUT_DIRS) |
|---|
| 1236 | |
|---|
| 1237 | .PHONY : native-lib |
|---|
| 1238 | |
|---|
| 1239 | ifeq ($(NATIVE_DO_NOT_BUILD_LIB),0) |
|---|
| 1240 | native-lib : native-dirs $(NATIVE_OUTPUT_LIB) |
|---|
| 1241 | |
|---|
| 1242 | |
|---|
| 1243 | $(NATIVE_OUTPUT_LIB) : $(NATIVE_LIB_O_FILES) |
|---|
| 1244 | ifeq ($(NATIVE_USE_AR),1) |
|---|
| 1245 | @echo "NATIVE_AR : $(notdir $@)($(notdir $?))" |
|---|
| 1246 | @$(NATIVE_AR) $(NATIVE_ARFLAGS) $@ $? >/dev/null |
|---|
| 1247 | @$(NATIVE_RANLIB) $@ |
|---|
| 1248 | endif |
|---|
| 1249 | ifeq ($(NATIVE_USE_MACOSX_LIBTOOL),1) |
|---|
| 1250 | @echo "NATIVE_LIBTOOL: $(notdir $@)($(notdir $?))" |
|---|
| 1251 | # @echo $(NATIVE_MACOSX_LIBTOOL) $(NATIVE_MACOSX_LIBTOOLFLAGS) -o $@ $^ |
|---|
| 1252 | @$(NATIVE_MACOSX_LIBTOOL) $(NATIVE_MACOSX_LIBTOOLFLAGS) -o $@ $^ |
|---|
| 1253 | endif |
|---|
| 1254 | endif |
|---|
| 1255 | |
|---|
| 1256 | .PHONY : native-tools |
|---|
| 1257 | |
|---|
| 1258 | native-tools : native-lib $(NATIVE_LIB_TOOLS_EXE_FILES) |
|---|
| 1259 | |
|---|
| 1260 | $(NATIVE_LIB_TOOLS_EXE_FILES) : $(NATIVE_OUTPUT_LIB) |
|---|
| 1261 | |
|---|
| 1262 | .PHONY : native-examples |
|---|
| 1263 | |
|---|
| 1264 | native-examples: native-lib $(NATIVE_LIB_EXAMPLES_EXE_FILES) |
|---|
| 1265 | |
|---|
| 1266 | $(NATIVE_LIB_EXAMPLES_EXE_FILES) : $(NATIVE_OUTPUT_LIB) |
|---|
| 1267 | |
|---|
| 1268 | .PHONY : native-tests |
|---|
| 1269 | |
|---|
| 1270 | native-tests: native-lib $(NATIVE_LIB_TESTS_EXE_FILES) |
|---|
| 1271 | |
|---|
| 1272 | $(NATIVE_LIB_TESTS_EXE_FILES) : $(NATIVE_OUTPUT_LIB) |
|---|
| 1273 | |
|---|
| 1274 | .PHONY : native-test |
|---|
| 1275 | |
|---|
| 1276 | native-test: native-lib native-tools $(LIB_TESTS_SH_FILES) $(NATIVE_LIB_TESTS_EXE_FILES) |
|---|
| 1277 | @cd "$(NATIVE_OUTPUT_TESTS_DIR)"; \ |
|---|
| 1278 | for i in $(NATIVE_LIB_TESTS_EXE_FILES); \ |
|---|
| 1279 | do \ |
|---|
| 1280 | n=$$(basename $$i); \ |
|---|
| 1281 | if $(VALGRIND) $(VALGRIND_OPTIONS) "./$${n}" >"$${n}.out" 2>"$${n}.err"; then rm "$${n}.err"; echo SUCCESS:$${n}; else echo FAIL:$${n}; fi;\ |
|---|
| 1282 | done; \ |
|---|
| 1283 | for i in $(LIB_TESTS_SH_FILES); \ |
|---|
| 1284 | do \ |
|---|
| 1285 | n=$$(basename $$i); \ |
|---|
| 1286 | if bash "$${i}" >"$${n}.out" 2>"$${n}.err"; then rm "$${n}.err"; echo SUCCESS:$${n}; else echo FAIL:$${n}; fi;\ |
|---|
| 1287 | done |
|---|
| 1288 | |
|---|
| 1289 | endif |
|---|
| 1290 | |
|---|
| 1291 | .PHONY : disasm |
|---|
| 1292 | |
|---|
| 1293 | disasm : $(LIB_DISASM_FILES) $(LIB_EXAMPLES_DISASM_FILES) $(LIB_TOOLS_DISASM_FILES) $(LIB_TESTS_DISASM_FILES) |
|---|
| 1294 | |
|---|
| 1295 | .PHONY : asm |
|---|
| 1296 | |
|---|
| 1297 | asm : $(LIB_ASM_FILES) |
|---|
| 1298 | |
|---|
| 1299 | .PHONY : config-tool |
|---|
| 1300 | |
|---|
| 1301 | config-tool : $(CONFIG_TOOL_FILE) |
|---|
| 1302 | |
|---|
| 1303 | $(CONFIG_TOOL_FILE) : |
|---|
| 1304 | @-rm -f $(CONFIG_TOOL_FILE) |
|---|
| 1305 | @echo '#!/bin/bash' >$(CONFIG_TOOL_FILE) |
|---|
| 1306 | @echo 'for i in $$*; do' >>$(CONFIG_TOOL_FILE) |
|---|
| 1307 | @echo ' case $$i in ' >>$(CONFIG_TOOL_FILE) |
|---|
| 1308 | @echo ' (--ldflags) echo -n "$(LINK_FLAGS) $(LDFLAGS) -L$(INSTALL_LIB_DIR) ";;' >>$(CONFIG_TOOL_FILE) |
|---|
| 1309 | @echo ' (--ldlibs) echo -n "$(LDLIBS) $(PROJECT_LDLIB) ";;' >>$(CONFIG_TOOL_FILE) |
|---|
| 1310 | @echo ' (--cflags) echo -n "$(CFLAGS) $(CONFIG_TOOL_COMPILE_FLAGS) ";;' >>$(CONFIG_TOOL_FILE) |
|---|
| 1311 | @echo ' (--cxxflags) echo -n "$(CXXFLAGS) $(CONFIG_TOOL_COMPILE_FLAGS) ";;' >>$(CONFIG_TOOL_FILE) |
|---|
| 1312 | @echo ' (--cppflags) echo -n "$(addprefix -D,$(DEFINES)) ";;' >>$(CONFIG_TOOL_FILE) |
|---|
| 1313 | @echo ' (--mflags) echo -n "$(MFLAGS) $(CONFIG_TOOL_COMPILE_FLAGS) ";;' >>$(CONFIG_TOOL_FILE) |
|---|
| 1314 | @echo ' (--mmflags) echo -n "$(MMFLAGS) $(CONFIG_TOOL_COMPILE_FLAGS) ";;' >>$(CONFIG_TOOL_FILE) |
|---|
| < |
|---|