[72] | 1 | # $Id: footer.kmk 131 2004-06-30 16:01:52Z bird $
|
---|
| 2 | ## @file
|
---|
| 3 | #
|
---|
| 4 | # kBuild - File included at top of makefile.
|
---|
| 5 | #
|
---|
[106] | 6 | # Copyright (c) source004 knut st. osmundsen <bird-srcspam@anduin.net>
|
---|
[72] | 7 | #
|
---|
| 8 | #
|
---|
| 9 | # This file is part of kBuild.
|
---|
| 10 | #
|
---|
| 11 | # kBuild is free software; you can redistribute it and/or modify
|
---|
| 12 | # it under the terms of the GNU General Public License as published by
|
---|
[106] | 13 | # the Free Software Foundation; either version source of the License, or
|
---|
[72] | 14 | # (at your option) any later version.
|
---|
| 15 | #
|
---|
| 16 | # kBuild is distributed in the hope that it will be useful,
|
---|
| 17 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 18 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
| 19 | # GNU General Public License for more details.
|
---|
| 20 | #
|
---|
| 21 | # You should have received a copy of the GNU General Public License
|
---|
| 22 | # along with kBuild; if not, write to the Free Software
|
---|
[106] | 23 | # Foundation, Inc., 59 Temple Place, Suite typetype0, Boston, MA 0sourcetargettargettarget-targettype07 USA
|
---|
[72] | 24 | #
|
---|
| 25 | #
|
---|
| 26 |
|
---|
| 27 | ifndef __footer_kmk__
|
---|
| 28 | # start-of-file-content
|
---|
| 29 |
|
---|
| 30 | #
|
---|
| 31 | # Variables.
|
---|
[73] | 32 | # (Some of these need initialization before including definitions using them.)
|
---|
[72] | 33 | #
|
---|
| 34 |
|
---|
| 35 | # all targets.
|
---|
[83] | 36 | ALL_TARGETS := $(LIBRARIES) $(PROGRAMS) $(DLLS) $(SYSMODS) $(OTHERS)
|
---|
[72] | 37 |
|
---|
[75] | 38 | # dependency files.
|
---|
| 39 | _DEPFILES :=
|
---|
| 40 |
|
---|
| 41 | # All kind of output files except for _OBJS and _DEPFILES.
|
---|
| 42 | # Compiling or linking definition outputting other things that $@ and any
|
---|
| 43 | # required dependency file must add those output files to this variable.
|
---|
| 44 | _OUT_FILES :=
|
---|
| 45 |
|
---|
[72] | 46 | # all of a type
|
---|
| 47 | _OBJS :=
|
---|
| 48 | _LIBS :=
|
---|
| 49 | _DLLS :=
|
---|
| 50 | _EXES :=
|
---|
[83] | 51 | _SYSMODS:=
|
---|
[72] | 52 | _DIRS :=
|
---|
| 53 |
|
---|
| 54 | # all objs of a specific target
|
---|
| 55 | define def_objs_var
|
---|
[106] | 56 | _OBJS_$target :=
|
---|
[72] | 57 | endef
|
---|
| 58 | $(foreach target, $(ALL_TARGETS), $(eval _OBJS_$(target) := ))
|
---|
| 59 |
|
---|
[73] | 60 |
|
---|
[72] | 61 | #
|
---|
[73] | 62 | # Basic macros
|
---|
| 63 | #
|
---|
| 64 |
|
---|
| 65 | ## Figure out the tool for a source
|
---|
[106] | 66 | # @param $target source file
|
---|
| 67 | # @param $source normalized main target
|
---|
| 68 | # @param $type tooltype
|
---|
[79] | 69 | _SOURCE_TOOL = $(strip $(firstword \
|
---|
[106] | 70 | $($(target)_$(source)_$(type)TOOL.$(BUILD_TARGET)) \
|
---|
| 71 | $($(target)_$(source)_$(type)TOOL) \
|
---|
| 72 | $($(target)_$(source)_TOOL.$(BUILD_TARGET)) \
|
---|
| 73 | $($(target)_$(source)_TOOL) \
|
---|
| 74 | $($(target)_$(type)TOOL.$(BUILD_TARGET)) \
|
---|
| 75 | $($(target)_$(type)TOOL) \
|
---|
| 76 | $($(target)_TOOL.$(BUILD_TARGET)) \
|
---|
| 77 | $($(target)_TOOL) \
|
---|
| 78 | $($(source)_$(type)TOOL.$(BUILD_TARGET)) \
|
---|
| 79 | $($(source)_$(type)TOOL) \
|
---|
| 80 | $($(source)_TOOL.$(BUILD_TARGET)) \
|
---|
| 81 | $($(source)_TOOL) \
|
---|
| 82 | $($(type)TOOL.$(BUILD_TARGET)) \
|
---|
| 83 | $($(type)TOOL) \
|
---|
| 84 | $(TOOL.$(BUILD_TARGET)) \
|
---|
| 85 | $(TOOL) ))
|
---|
[73] | 86 |
|
---|
[106] | 87 | _SOURCE_TOOL_OLD = $(strip $(firstword \
|
---|
| 88 | $($(target)_$(source)_$(type)TOOL.$(BUILD_TARGET)) $($(target)_$(source)_TOOL.$(BUILD_TARGET)) \
|
---|
| 89 | $($(target)_$(source)_$(type)TOOL) $($target_$source_TOOL) \
|
---|
| 90 | $($(target)_$(type)TOOL.$(BUILD_TARGET)) $($(target)_TOOL.$(BUILD_TARGET)) \
|
---|
| 91 | $($(target)_$(type)TOOL) $($target_TOOL) \
|
---|
| 92 | $($(source)_$(type)TOOL.$(BUILD_TARGET)) $($(source)_TOOL.$(BUILD_TARGET)) \
|
---|
| 93 | $($(source)_$(type)TOOL) $($(source)_TOOL) \
|
---|
| 94 | $($(type)TOOL.$(BUILD_TARGET)) $(TOOL.$(BUILD_TARGET)) \
|
---|
| 95 | $($(type)TOOL) $(TOOL) ))
|
---|
| 96 |
|
---|
[78] | 97 | ## Figure out the tool for a target.
|
---|
[106] | 98 | # @param $target normalized target.
|
---|
| 99 | # @param $source tooltype.
|
---|
[79] | 100 | _TARGET_TOOL = $(strip $(firstword \
|
---|
[106] | 101 | $($(target)_$(source)TOOL.$(BUILD_TARGET)) \
|
---|
| 102 | $($(target)_$(source)TOOL) \
|
---|
| 103 | $($(target)_TOOL.$(BUILD_TARGET)) \
|
---|
| 104 | $($(target)_TOOL) \
|
---|
| 105 | $($(source)TOOL) \
|
---|
| 106 | $($(source)TOOL.$(BUILD_TARGET)) \
|
---|
| 107 | $(TOOL.$(BUILD_TARGET)) \
|
---|
| 108 | $(TOOL) \
|
---|
[79] | 109 | ))
|
---|
[78] | 110 |
|
---|
[73] | 111 | ## Figure out where to put object files.
|
---|
[110] | 112 | # @param $1 source file
|
---|
| 113 | # @param $2 normalized main target
|
---|
| 114 | _OBJECT_BASE = $(PATH_TARGET)/$(2)/$(basename $(1))
|
---|
[73] | 115 |
|
---|
| 116 | ## Figure out where to put object files.
|
---|
[110] | 117 | # @param $1 real target name.
|
---|
| 118 | # @param $2 normalized main target
|
---|
| 119 | _TARGET_BASE = $(PATH_TARGET)/$(2)/$(basename $(1))
|
---|
[73] | 120 |
|
---|
| 121 |
|
---|
| 122 | #
|
---|
[72] | 123 | # Include templates
|
---|
| 124 | #
|
---|
| 125 | _TEMPLATES := $(TEMPLATE)
|
---|
| 126 | define def_templates
|
---|
| 127 | ifdef $(target)_TEMPLATE
|
---|
| 128 | _TEMPLATES += $($(target)_TEMPLATE)
|
---|
| 129 | endif
|
---|
| 130 | endef
|
---|
| 131 | $(foreach target, $(ALL_TARGETS), $(eval $(def_templates)))
|
---|
| 132 | _TEMPLATES := $(sort $(_TEMPLATES))
|
---|
| 133 | # $ (warning dbg: _TEMPLATES=$(_TEMPLATES))
|
---|
| 134 |
|
---|
| 135 | define def_templates_include
|
---|
| 136 | ifndef TEMPLATE_$(template)
|
---|
| 137 | include $(firstword $(wildcard $(PATH_KBUILD)/templates/$(template).kmk))
|
---|
| 138 | endif
|
---|
| 139 | endef
|
---|
| 140 | $(foreach template, $(_TEMPLATES), $(eval $(def_templates)))
|
---|
| 141 |
|
---|
[74] | 142 |
|
---|
[72] | 143 | #
|
---|
| 144 | # Common Inheritance
|
---|
| 145 | #
|
---|
| 146 |
|
---|
| 147 | ## Inherit defaults property
|
---|
| 148 | # @param $(prop) Property name
|
---|
| 149 | # @param $(target) Target name.
|
---|
| 150 | define def_inherit_defaults_one
|
---|
[74] | 151 | ifndef $(target)_$(prop)
|
---|
[109] | 152 | ifndef $(target)_$(prop).$(BUILD_TARGET)
|
---|
[72] | 153 | ifdef $(prop)
|
---|
[105] | 154 | $$(eval $(target)_$(prop) := $($(prop)))
|
---|
[72] | 155 | endif
|
---|
[109] | 156 | ifdef $(prop).$(BUILD_TARGET)
|
---|
| 157 | $$(eval $(target)_$(prop).$(BUILD_TARGET) := $($(prop).$(BUILD_TARGET)))
|
---|
[72] | 158 | endif
|
---|
[109] | 159 | endif
|
---|
| 160 | endif
|
---|
[72] | 161 | endef
|
---|
| 162 |
|
---|
| 163 | ## Inherit default properties for one target.
|
---|
| 164 | # A bit tricky this one, but it depends a bit on whether or not TEMPLATE
|
---|
| 165 | # is inherited from the default properties.
|
---|
| 166 | # @param $(target) Target name
|
---|
[78] | 167 | #
|
---|
[72] | 168 | define def_inherit_defaults
|
---|
| 169 | ifdef $(target)_TEMPLATE
|
---|
[107] | 170 | ifeq ($(strip $(TEMPLATE_$($(target)_TEMPLATE)_TOOL) $(TEMPLATE_$($(target)_TEMPLATE)_TOOL.$(BUILD_TARGET))),)
|
---|
[109] | 171 | $$(foreach prop,TOOL, $$(eval $$(def_inherit_defaults_one)))
|
---|
[72] | 172 | endif
|
---|
[107] | 173 | ifeq ($(strip $(TEMPLATE_$($(target)_TEMPLATE)_SDKS) $(TEMPLATE_$($(target)_TEMPLATE)_SDKS.$(BUILD_TARGET))),)
|
---|
[109] | 174 | $$(foreach prop,SDKS, $$(eval $$(def_inherit_defaults_one)))
|
---|
[72] | 175 | endif
|
---|
| 176 | else
|
---|
[109] | 177 | $$(foreach prop,TEMPLATE TOOL SDKS, $$(eval $$(def_inherit_defaults_one)))
|
---|
[72] | 178 | endif
|
---|
| 179 | endef
|
---|
| 180 | # Inherit default properties.
|
---|
[109] | 181 | # !!!!!!THIS IS MESSY AND NOT NECESSARY!!!!!!
|
---|
[105] | 182 | $(foreach target, $(ALL_TARGETS),$(eval $(def_inherit_defaults)))
|
---|
[72] | 183 |
|
---|
| 184 |
|
---|
[78] | 185 | ## Inherit one template property in a accumulative manner.
|
---|
[72] | 186 | # @param $(prop) Property name
|
---|
| 187 | # @param $(target) Target name
|
---|
[78] | 188 | # @todo fix the precedence order for some properties.
|
---|
[72] | 189 | define def_inherit_template_one
|
---|
[78] | 190 | ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop)
|
---|
[72] | 191 | ifndef $(target)_$(prop)
|
---|
[106] | 192 | #$$ (warning dbgtarget: $(target)_$(prop):='$(TEMPLATE_$($(target)_TEMPLATE)_$(prop))' TEMPLATE_$($(target)_TEMPLATE)_$(prop))
|
---|
[105] | 193 | $$(target)_$$(prop) := $$(TEMPLATE_$$($$(target)_TEMPLATE)_$$(prop))
|
---|
[72] | 194 | endif
|
---|
| 195 | endif
|
---|
[79] | 196 | ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(BUILD_TARGET)
|
---|
| 197 | ifndef $(target)_$(prop).$(BUILD_TARGET)
|
---|
[106] | 198 | #$$ (warning dbgsource: $(target)_$(prop).$(BUILD_TARGET)="TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(BUILD_TARGET)" TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(BUILD_TARGET))
|
---|
[105] | 199 | $$(target)_$$(prop).$$(BUILD_TARGET) := $$(TEMPLATE_$$($$(target)_TEMPLATE)_$$(prop).$$(BUILD_TARGET))
|
---|
[79] | 200 | endif
|
---|
| 201 | endif
|
---|
[72] | 202 | endef
|
---|
| 203 |
|
---|
[78] | 204 | ## Inherit one template property.
|
---|
| 205 | # @param $(prop) Property name
|
---|
| 206 | # @param $(target) Target name
|
---|
| 207 | define def_inherit_template_one_accumulate
|
---|
| 208 | ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop)
|
---|
[106] | 209 | #$$ (warning dbgtype: TEMPLATE_$($(target)_TEMPLATE)_$(prop) $(target)_$(prop)=$($(target)_$(prop)) $(TEMPLATE_$($(target)_TEMPLATE)_$(prop)))
|
---|
[105] | 210 | $$(eval $(target)_$(prop) := $($(target)_$(prop)) $(TEMPLATE_$($(target)_TEMPLATE)_$(prop)))
|
---|
[106] | 211 | #$$ (warning dbgtype: $(target)_$(prop)=$($(target)_$(prop)))
|
---|
[78] | 212 | endif
|
---|
[79] | 213 | ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(BUILD_TARGET)
|
---|
[105] | 214 | #$$ (warning dbg4: TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(BUILD_TARGET))
|
---|
| 215 | $$(eval $(target)_$(prop).$(BUILD_TARGET) := $($(target)_$(prop).$(BUILD_TARGET)) $(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(BUILD_TARGET)))
|
---|
[79] | 216 | endif
|
---|
| 217 | ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(BUILD_TARGET_CPU)
|
---|
[105] | 218 | #$$ (warning dbg5: TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(BUILD_TARGET_CPU))
|
---|
| 219 | $$(eval $(target)_$(prop).$(BUILD_TARGET_CPU) := $($(target)_$(prop).$(BUILD_TARGET)) $(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(BUILD_TARGET_CPU)))
|
---|
[79] | 220 | endif
|
---|
| 221 | ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(BUILD_TARGET_ARCH)
|
---|
[105] | 222 | #$$ (warning dbg6: TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(BUILD_TARGET_ARCH))
|
---|
| 223 | $$(eval $(target)_$(prop).$(BUILD_TARGET_ARCH) := $($(target)_$(prop).$(BUILD_TARGET)) $(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(BUILD_TARGET_ARCH)))
|
---|
[79] | 224 | endif
|
---|
[78] | 225 | endef
|
---|
| 226 |
|
---|
[106] | 227 |
|
---|
[72] | 228 | ## Inherit template properties for on target.
|
---|
| 229 | # @param $(target) Target name.
|
---|
| 230 | define def_inherit_template
|
---|
[105] | 231 | $$(foreach prop, TOOL ARTOOL CTOOL CXXTOOL ASTOOL LDTOOL\
|
---|
| 232 | ,$$(eval $$(def_inherit_template_one)))
|
---|
| 233 | $$(foreach prop,SDKS DEFS INCS COPTS CFLAGS CDEFS CINCS CXXOPTS CXXFLAGS CXXDEFS CXXINCS ASOPTS ASFLAGS ASDEFS ASINCS LDFLAGS LIBS LIBPATH \
|
---|
| 234 | ,$$(eval $$(def_inherit_template_one_accumulate)))
|
---|
[72] | 235 | endef
|
---|
| 236 | # Inherit template properties
|
---|
[105] | 237 | $(foreach target, $(ALL_TARGETS),$(eval $(def_inherit_template)))
|
---|
[72] | 238 |
|
---|
| 239 |
|
---|
| 240 | #
|
---|
| 241 | # Include tools
|
---|
| 242 | #
|
---|
| 243 | _TOOLS := $(TOOL)
|
---|
| 244 | define def_tools_target_source
|
---|
[78] | 245 | $(foreach tool,\
|
---|
[79] | 246 | $($(source)_TOOL.$(BUILD_TARGET)) $($(target)_$(source)_TOOL.$(BUILD_TARGET))\
|
---|
[78] | 247 | $($(source)_TOOL) $($(target)_$(source)_TOOL)\
|
---|
[79] | 248 | $($(source)_CTOOL.$(BUILD_TARGET)) $($(target)_$(source)_CTOOL.$(BUILD_TARGET))\
|
---|
[78] | 249 | $($(source)_CTOOL) $($(target)_$(source)_CTOOL)\
|
---|
[79] | 250 | $($(source)_CXXTOOL.$(BUILD_TARGET)) $($(target)_$(source)_CXXTOOL.$(BUILD_TARGET))\
|
---|
[78] | 251 | $($(source)_CXXTOOL) $($(target)_$(source)_CXXTOOL)\
|
---|
[79] | 252 | $($(source)_ASTOOL.$(BUILD_TARGET)) $($(target)_$(source)_ASTOOL.$(BUILD_TARGET))\
|
---|
[78] | 253 | $($(source)_ASTOOL) $($(target)_$(source)_ASTOOL)\
|
---|
[79] | 254 | $($(source)_ARTOOL.$(BUILD_TARGET)) $($(target)_$(source)_ARTOOL.$(BUILD_TARGET))\
|
---|
[78] | 255 | $($(source)_ARTOOL) $($(target)_$(source)_ARTOOL)\
|
---|
[79] | 256 | $($(source)_LDTOOL.$(BUILD_TARGET)) $($(target)_$(source)_LDTOOL.$(BUILD_TARGET))\
|
---|
[78] | 257 | $($(source)_LDTOOL) $($(target)_$(source)_LDTOOL)\
|
---|
| 258 | ,$(eval _TOOLS += $(tool)))
|
---|
[72] | 259 | endef
|
---|
| 260 | define def_tools_target
|
---|
[78] | 261 | $(foreach tool,\
|
---|
[79] | 262 | $($(target)_TOOL.$(BUILD_TARGET))\
|
---|
[78] | 263 | $($(target)_TOOL)\
|
---|
[79] | 264 | $($(target)_CTOOL.$(BUILD_TARGET))\
|
---|
[78] | 265 | $($(target)_CTOOL)\
|
---|
[79] | 266 | $($(target)_CXXTOOL.$(BUILD_TARGET))\
|
---|
[78] | 267 | $($(target)_CXXTOOL)\
|
---|
[79] | 268 | $($(target)_ASTOOL.$(BUILD_TARGET))\
|
---|
[78] | 269 | $($(target)_ASTOOL)\
|
---|
[79] | 270 | $($(target)_ARTOOL.$(BUILD_TARGET))\
|
---|
[78] | 271 | $($(target)_ARTOOL)\
|
---|
[79] | 272 | $($(target)_LDTOOL.$(BUILD_TARGET))\
|
---|
[78] | 273 | $($(target)_LDTOOL)\
|
---|
[79] | 274 | ,$(eval _TOOLS += $(tool)))
|
---|
[120] | 275 | $(foreach source, $($(target)_SOURCES) $($(target)_SOURCES.$(BUILD_TARGET)) $($(target)_SOURCES.$(BUILD_MODE)) \
|
---|
| 276 | , $(eval $(def_tools_target_source)))
|
---|
[72] | 277 | endef
|
---|
| 278 | $(foreach target, $(ALL_TARGETS), $(eval $(def_tools_target)))
|
---|
| 279 | _TOOLS := $(sort $(_TOOLS))
|
---|
| 280 |
|
---|
| 281 | define def_tools_include
|
---|
| 282 | ifndef TOOL_$(tool)
|
---|
| 283 | include $(firstword $(wildcard $(PATH_KBUILD)/tools/$(tool).kmk))
|
---|
| 284 | endif
|
---|
| 285 | endef
|
---|
| 286 | $(foreach tool, $(_TOOLS), $(eval $(def_tools_include)))
|
---|
| 287 |
|
---|
| 288 |
|
---|
| 289 | #
|
---|
| 290 | # Include SDKs
|
---|
[73] | 291 | #
|
---|
[72] | 292 | _SDKS := $(SDKS)
|
---|
| 293 | define def_sdks_target_source
|
---|
[122] | 294 | $(foreach sdk, $($(source)_SDKS) $($(source)_SDKS.$(BUILD_TARGET)) $($(source)_SDKS.$(BUILD_MODE)) \
|
---|
| 295 | $($(target)_$(source)_SDKS) $($(target)_$(source)_SDKS.$(BUILD_TARGET)) $($(target)_$(source)_SDKS.$(BUILD_MODE)), \
|
---|
[72] | 296 | $(eval _SDKS += $(sdk)))
|
---|
| 297 | endef
|
---|
| 298 | define def_sdks_target
|
---|
[122] | 299 | $(foreach sdk, $($(target)_SDKS) $($(target)_SDKS.$(BUILD_TARGET)) $($(target)_SDKS.$(BUILD_MODE))\
|
---|
| 300 | , $(eval _SDKS += $(sdk)))
|
---|
[120] | 301 | $(foreach source, $($(target)_SOURCES) $($(target)_SOURCES.$(BUILD_TARGET)) $($(target)_SOURCES.$(BUILD_MODE))\
|
---|
| 302 | , $(eval $(def_sdks_target_source)))
|
---|
[72] | 303 | endef
|
---|
| 304 | $(foreach target, $(ALL_TARGETS), $(eval $(def_sdks_target)))
|
---|
| 305 | _SDKS := $(sort $(_SDKS))
|
---|
| 306 |
|
---|
[122] | 307 | define def_sdks_include_one
|
---|
[72] | 308 | ifndef SDK_$(sdk)
|
---|
| 309 | include $(firstword $(wildcard $(PATH_KBUILD)/sdks/$(sdk).kmk))
|
---|
| 310 | endif
|
---|
| 311 | endef
|
---|
[122] | 312 | $(foreach sdk, $(_SDKS), $(eval $(def_sdks_include_one)))
|
---|
[72] | 313 |
|
---|
[73] | 314 | #
|
---|
| 315 | # Object processing.
|
---|
| 316 | #
|
---|
[72] | 317 |
|
---|
[73] | 318 | ## Generic macro for processing C, C++ and Assembly sources.
|
---|
| 319 | # @param $(target) Normalized target name.
|
---|
| 320 | # @param $(source) Source file name.
|
---|
| 321 | # @param $(type) Source type. {C,CXX,AS}
|
---|
[72] | 322 | #
|
---|
[73] | 323 | # @remark I've no clue why I've to $(eval ..) everything in this define. MAKE bug?
|
---|
[105] | 324 | # @remark I now have a clue. Have to use $$ if not.
|
---|
[73] | 325 | define def_target_source_c_cpp_asm
|
---|
[105] | 326 | #$ (warning dbg: def_target_source_c_cpp_asm: source='$(source)' target='$(target)' type='$(type)')
|
---|
[73] | 327 |
|
---|
[78] | 328 | $(eval tool:=$(call _SOURCE_TOOL,$(source),$(target),$(type)))
|
---|
[111] | 329 | $(eval outbase := $(call _OBJECT_BASE,$(source),$(target)))
|
---|
| 330 | $(eval PATH_$(target)_$(source) := $(patsubst %/,%,$(dir $(outbase))))
|
---|
| 331 | $(eval dirdep := $(dir $(outbase)).dir_created)
|
---|
[73] | 332 | $(eval defs :=\
|
---|
[78] | 333 | $(TOOL_$(tool)_DEFS)\
|
---|
| 334 | $(TOOL_$(tool)_DEFS.$(BUILD_TYPE))\
|
---|
| 335 | $(TOOL_$(tool)_DEFS.$(BUILD_TARGET))\
|
---|
| 336 | $(TOOL_$(tool)_DEFS.$(BUILD_TARGET_ARCH))\
|
---|
| 337 | $(TOOL_$(tool)_DEFS.$(BUILD_TARGET_CPU))\
|
---|
[74] | 338 | $(TOOL_$(tool)_$(type)DEFS)\
|
---|
| 339 | $(TOOL_$(tool)_$(type)DEFS.$(BUILD_TYPE))\
|
---|
[78] | 340 | $(foreach sdk, $(SDKS.$(BUILD_TARGET)) \
|
---|
| 341 | $(SDKS.$(BUILD_TYPE)) \
|
---|
| 342 | $(SDKS),\
|
---|
| 343 | $(SDK_$(sdk)_DEFS)\
|
---|
| 344 | $(SDK_$(sdk)_DEFS.$(BUILD_TYPE))\
|
---|
| 345 | $(SDK_$(sdk)_DEFS.$(BUILD_TARGET))\
|
---|
| 346 | $(SDK_$(sdk)_DEFS.$(BUILD_TARGET_ARCH))\
|
---|
| 347 | $(SDK_$(sdk)_DEFS.$(BUILD_TARGET_CPU))
|
---|
| 348 | $(SDK_$(sdk)_$(type)DEFS)\
|
---|
| 349 | $(SDK_$(sdk)_$(type)DEFS.$(BUILD_TYPE))\
|
---|
| 350 | $(SDK_$(sdk)_$(type)DEFS.$(BUILD_TARGET))\
|
---|
| 351 | $(SDK_$(sdk)_$(type)DEFS.$(BUILD_TARGET_ARCH))\
|
---|
| 352 | $(SDK_$(sdk)_$(type)DEFS.$(BUILD_TARGET_CPU)))\
|
---|
[74] | 353 | $(DEFS)\
|
---|
| 354 | $(DEFS.$(BUILD_TYPE))\
|
---|
[78] | 355 | $(DEFS.$(BUILD_TARGET))\
|
---|
| 356 | $(DEFS.$(BUILD_TARGET_ARCH))\
|
---|
| 357 | $(DEFS.$(BUILD_TARGET_CPU))\
|
---|
| 358 | $($(type)DEFS)\
|
---|
| 359 | $($(type)DEFS.$(BUILD_TYPE))\
|
---|
| 360 | $($(type)DEFS.$(BUILD_TARGET))\
|
---|
| 361 | $($(type)DEFS.$(BUILD_TARGET_ARCH))\
|
---|
| 362 | $($(type)DEFS.$(BUILD_TARGET_CPU))\
|
---|
| 363 | $(foreach sdk, $($(target)_SDKS.$(BUILD_TARGET)) \
|
---|
| 364 | $($(target)_SDKS.$(BUILD_TYPE)) \
|
---|
| 365 | $($(target)_SDKS),\
|
---|
| 366 | $(SDK_$(sdk)_DEFS)\
|
---|
| 367 | $(SDK_$(sdk)_DEFS.$(BUILD_TYPE))\
|
---|
| 368 | $(SDK_$(sdk)_DEFS.$(BUILD_TARGET))\
|
---|
| 369 | $(SDK_$(sdk)_DEFS.$(BUILD_TARGET_ARCH))\
|
---|
| 370 | $(SDK_$(sdk)_DEFS.$(BUILD_TARGET_CPU))
|
---|
| 371 | $(SDK_$(sdk)_$(type)DEFS)\
|
---|
| 372 | $(SDK_$(sdk)_$(type)DEFS.$(BUILD_TYPE))\
|
---|
| 373 | $(SDK_$(sdk)_$(type)DEFS.$(BUILD_TARGET))\
|
---|
| 374 | $(SDK_$(sdk)_$(type)DEFS.$(BUILD_TARGET_ARCH))\
|
---|
| 375 | $(SDK_$(sdk)_$(type)DEFS.$(BUILD_TARGET_CPU)))\
|
---|
[74] | 376 | $($(target)_DEFS)\
|
---|
| 377 | $($(target)_DEFS.$(BUILD_TYPE))\
|
---|
| 378 | $($(target)_DEFS.$(BUILD_TARGET))\
|
---|
[78] | 379 | $($(target)_DEFS.$(BUILD_TARGET_ARCH))\
|
---|
| 380 | $($(target)_DEFS.$(BUILD_TARGET_CPU))\
|
---|
| 381 | $($(target)_$(type)DEFS)\
|
---|
| 382 | $($(target)_$(type)DEFS.$(BUILD_TYPE))\
|
---|
| 383 | $($(target)_$(type)DEFS.$(BUILD_TARGET))\
|
---|
| 384 | $($(target)_$(type)DEFS.$(BUILD_TARGET_ARCH))\
|
---|
| 385 | $($(target)_$(type)DEFS.$(BUILD_TARGET_CPU))\
|
---|
| 386 | $(foreach sdk, $($(source)_SDKS.$(BUILD_TARGET)) \
|
---|
| 387 | $($(source)_SDKS.$(BUILD_TYPE)) \
|
---|
| 388 | $($(source)_SDKS),\
|
---|
| 389 | $(SDK_$(sdk)_DEFS)\
|
---|
| 390 | $(SDK_$(sdk)_DEFS.$(BUILD_TYPE))\
|
---|
| 391 | $(SDK_$(sdk)_DEFS.$(BUILD_TARGET))\
|
---|
| 392 | $(SDK_$(sdk)_DEFS.$(BUILD_TARGET_ARCH))\
|
---|
| 393 | $(SDK_$(sdk)_DEFS.$(BUILD_TARGET_CPU))
|
---|
| 394 | $(SDK_$(sdk)_$(type)DEFS)\
|
---|
| 395 | $(SDK_$(sdk)_$(type)DEFS.$(BUILD_TYPE))\
|
---|
| 396 | $(SDK_$(sdk)_$(type)DEFS.$(BUILD_TARGET))\
|
---|
| 397 | $(SDK_$(sdk)_$(type)DEFS.$(BUILD_TARGET_ARCH))\
|
---|
| 398 | $(SDK_$(sdk)_$(type)DEFS.$(BUILD_TARGET_CPU)))\
|
---|
[74] | 399 | $($(source)_DEFS)\
|
---|
| 400 | $($(source)_DEFS.$(BUILD_TYPE))\
|
---|
| 401 | $($(source)_DEFS.$(BUILD_TARGET))\
|
---|
[78] | 402 | $($(source)_DEFS.$(BUILD_TARGET_ARCH))\
|
---|
| 403 | $($(source)_DEFS.$(BUILD_TARGET_CPU))\
|
---|
[73] | 404 | $($(source)_$(type)DEFS)\
|
---|
[74] | 405 | $($(source)_$(type)DEFS.$(BUILD_TYPE))\
|
---|
| 406 | $($(source)_$(type)DEFS.$(BUILD_TARGET))\
|
---|
[78] | 407 | $($(source)_$(type)DEFS.$(BUILD_TARGET_ARCH))\
|
---|
| 408 | $($(source)_$(type)DEFS.$(BUILD_TARGET_CPU))\
|
---|
| 409 | $(foreach sdk, $($(target)_$(source)_SDKS.$(BUILD_TARGET)) \
|
---|
| 410 | $($(target)_$(source)_SDKS.$(BUILD_TYPE)) \
|
---|
| 411 | $($(target)_$(source)_SDKS),\
|
---|
| 412 | $(SDK_$(sdk)_DEFS)\
|
---|
| 413 | $(SDK_$(sdk)_DEFS.$(BUILD_TYPE))\
|
---|
| 414 | $(SDK_$(sdk)_DEFS.$(BUILD_TARGET))\
|
---|
| 415 | $(SDK_$(sdk)_DEFS.$(BUILD_TARGET_ARCH))\
|
---|
| 416 | $(SDK_$(sdk)_DEFS.$(BUILD_TARGET_CPU))
|
---|
| 417 | $(SDK_$(sdk)_$(type)DEFS)\
|
---|
| 418 | $(SDK_$(sdk)_$(type)DEFS.$(BUILD_TYPE))\
|
---|
| 419 | $(SDK_$(sdk)_$(type)DEFS.$(BUILD_TARGET))\
|
---|
| 420 | $(SDK_$(sdk)_$(type)DEFS.$(BUILD_TARGET_ARCH))\
|
---|
| 421 | $(SDK_$(sdk)_$(type)DEFS.$(BUILD_TARGET_CPU)))\
|
---|
[74] | 422 | $($(target)_$(source)_DEFS)\
|
---|
| 423 | $($(target)_$(source)_DEFS.$(BUILD_TYPE))\
|
---|
| 424 | $($(target)_$(source)_DEFS.$(BUILD_TARGET))\
|
---|
[78] | 425 | $($(target)_$(source)_DEFS.$(BUILD_TARGET_ARCH))\
|
---|
| 426 | $($(target)_$(source)_DEFS.$(BUILD_TARGET_CPU))\
|
---|
[74] | 427 | $($(target)_$(source)_$(type)DEFS)\
|
---|
| 428 | $($(target)_$(source)_$(type)DEFS.$(BUILD_TYPE))\
|
---|
| 429 | $($(target)_$(source)_$(type)DEFS.$(BUILD_TARGET))\
|
---|
[78] | 430 | $($(target)_$(source)_$(type)DEFS.$(BUILD_TARGET_ARCH))\
|
---|
| 431 | $($(target)_$(source)_$(type)DEFS.$(BUILD_TARGET_CPU))\
|
---|
[73] | 432 | )
|
---|
| 433 | $(eval incs :=\
|
---|
[78] | 434 | $($(target)_$(source)_$(type)INCS.$(BUILD_TARGET_CPU))\
|
---|
| 435 | $($(target)_$(source)_$(type)INCS.$(BUILD_TARGET_ARCH))\
|
---|
[74] | 436 | $($(target)_$(source)_$(type)INCS.$(BUILD_TARGET))\
|
---|
| 437 | $($(target)_$(source)_$(type)INCS.$(BUILD_TYPE))\
|
---|
[73] | 438 | $($(target)_$(source)_$(type)INCS)\
|
---|
[78] | 439 | $($(target)_$(source)_INCS.$(BUILD_TARGET_CPU))\
|
---|
| 440 | $($(target)_$(source)_INCS.$(BUILD_TARGET_ARCH))\
|
---|
[74] | 441 | $($(target)_$(source)_INCS.$(BUILD_TARGET))\
|
---|
| 442 | $($(target)_$(source)_INCS.$(BUILD_TYPE))\
|
---|
[73] | 443 | $($(target)_$(source)_INCS)\
|
---|
[78] | 444 | $(foreach sdk, $($(target)_$(source)_SDKS.$(BUILD_TARGET)) \
|
---|
| 445 | $($(target)_$(source)_SDKS.$(BUILD_TYPE)) \
|
---|
| 446 | $($(target)_$(source)_SDKS),
|
---|
| 447 | $(SDK_$(sdk)_$(type)INCS.$(BUILD_TARGET_CPU))\
|
---|
| 448 | $(SDK_$(sdk)_$(type)INCS.$(BUILD_TARGET_ARCH))\
|
---|
| 449 | $(SDK_$(sdk)_$(type)INCS.$(BUILD_TARGET))\
|
---|
| 450 | $(SDK_$(sdk)_$(type)INCS.$(BUILD_TYPE))\
|
---|
| 451 | $(SDK_$(sdk)_$(type)INCS)\
|
---|
| 452 | $(SDK_$(sdk)_INCS.$(BUILD_TARGET_CPU))\
|
---|
| 453 | $(SDK_$(sdk)_INCS.$(BUILD_TARGET_ARCH))\
|
---|
| 454 | $(SDK_$(sdk)_INCS.$(BUILD_TARGET))\
|
---|
| 455 | $(SDK_$(sdk)_INCS.$(BUILD_TYPE))\
|
---|
| 456 | $(SDK_$(sdk)_INCS))\
|
---|
| 457 | $($(source)_$(type)INCS.$(BUILD_TARGET_CPU))\
|
---|
| 458 | $($(source)_$(type)INCS.$(BUILD_TARGET_ARCH))\
|
---|
[74] | 459 | $($(source)_$(type)INCS.$(BUILD_TARGET))\
|
---|
| 460 | $($(source)_$(type)INCS.$(BUILD_TYPE))\
|
---|
[73] | 461 | $($(source)_$(type)INCS)\
|
---|
[78] | 462 | $($(source)_INCS.$(BUILD_TARGET_CPU))\
|
---|
| 463 | $($(source)_INCS.$(BUILD_TARGET_ARCH))\
|
---|
[74] | 464 | $($(source)_INCS.$(BUILD_TARGET))\
|
---|
| 465 | $($(source)_INCS.$(BUILD_TYPE))\
|
---|
[73] | 466 | $($(source)_INCS)\
|
---|
[78] | 467 | $(foreach sdk, $($(source)_SDKS.$(BUILD_TARGET)) \
|
---|
| 468 | $($(source)_SDKS.$(BUILD_TYPE)) \
|
---|
| 469 | $($(source)_SDKS),\
|
---|
| 470 | $(SDK_$(sdk)_$(type)INCS.$(BUILD_TARGET_CPU))\
|
---|
| 471 | $(SDK_$(sdk)_$(type)INCS.$(BUILD_TARGET_ARCH))\
|
---|
| 472 | $(SDK_$(sdk)_$(type)INCS.$(BUILD_TARGET))\
|
---|
| 473 | $(SDK_$(sdk)_$(type)INCS.$(BUILD_TYPE))\
|
---|
| 474 | $(SDK_$(sdk)_$(type)INCS)\
|
---|
| 475 | $(SDK_$(sdk)_INCS.$(BUILD_TARGET_CPU))\
|
---|
| 476 | $(SDK_$(sdk)_INCS.$(BUILD_TARGET_ARCH))\
|
---|
| 477 | $(SDK_$(sdk)_INCS.$(BUILD_TARGET))\
|
---|
| 478 | $(SDK_$(sdk)_INCS.$(BUILD_TYPE))\
|
---|
| 479 | $(SDK_$(sdk)_INCS))\
|
---|
| 480 | $($(target)_$(type)INCS.$(BUILD_TARGET_CPU))\
|
---|
| 481 | $($(target)_$(type)INCS.$(BUILD_TARGET_ARCH))\
|
---|
[74] | 482 | $($(target)_$(type)INCS.$(BUILD_TARGET))\
|
---|
| 483 | $($(target)_$(type)INCS.$(BUILD_TYPE))\
|
---|
[73] | 484 | $($(target)_$(type)INCS)\
|
---|
[78] | 485 | $($(target)_INCS.$(BUILD_TARGET_CPU))\
|
---|
| 486 | $($(target)_INCS.$(BUILD_TARGET_ARCH))\
|
---|
[74] | 487 | $($(target)_INCS.$(BUILD_TARGET))\
|
---|
| 488 | $($(target)_INCS.$(BUILD_TYPE))\
|
---|
[73] | 489 | $($(target)_INCS)\
|
---|
[78] | 490 | $(foreach sdk, $($(target)_SDKS.$(BUILD_TARGET)) \
|
---|
| 491 | $($(target)_SDKS.$(BUILD_TYPE)) \
|
---|
| 492 | $($(target)_SDKS),\
|
---|
| 493 | $(SDK_$(sdk)_$(type)INCS.$(BUILD_TARGET_CPU))\
|
---|
| 494 | $(SDK_$(sdk)_$(type)INCS.$(BUILD_TARGET_ARCH))\
|
---|
| 495 | $(SDK_$(sdk)_$(type)INCS.$(BUILD_TARGET))\
|
---|
| 496 | $(SDK_$(sdk)_$(type)INCS.$(BUILD_TYPE))\
|
---|
| 497 | $(SDK_$(sdk)_$(type)INCS)\
|
---|
| 498 | $(SDK_$(sdk)_INCS.$(BUILD_TARGET_CPU))\
|
---|
| 499 | $(SDK_$(sdk)_INCS.$(BUILD_TARGET_ARCH))\
|
---|
| 500 | $(SDK_$(sdk)_INCS.$(BUILD_TARGET))\
|
---|
| 501 | $(SDK_$(sdk)_INCS.$(BUILD_TYPE))\
|
---|
| 502 | $(SDK_$(sdk)_INCS))\
|
---|
| 503 | $(INCS.$(BUILD_TARGET_CPU))\
|
---|
| 504 | $(INCS.$(BUILD_TARGET_ARCH))\
|
---|
[74] | 505 | $(INCS.$(BUILD_TARGET))\
|
---|
| 506 | $(INCS.$(BUILD_TYPE))\
|
---|
[73] | 507 | $(INCS)\
|
---|
[78] | 508 | $(foreach sdk, $(SDKS.$(BUILD_TARGET)) \
|
---|
| 509 | $(SDKS.$(BUILD_TYPE)) \
|
---|
| 510 | $(SDKS),\
|
---|
| 511 | $(SDK_$(sdk)_$(type)INCS.$(BUILD_TARGET_CPU))\
|
---|
| 512 | $(SDK_$(sdk)_$(type)INCS.$(BUILD_TARGET_ARCH))\
|
---|
| 513 | $(SDK_$(sdk)_$(type)INCS.$(BUILD_TARGET))\
|
---|
| 514 | $(SDK_$(sdk)_$(type)INCS.$(BUILD_TYPE))\
|
---|
| 515 | $(SDK_$(sdk)_$(type)INCS)\
|
---|
| 516 | $(SDK_$(sdk)_INCS.$(BUILD_TARGET_CPU))\
|
---|
| 517 | $(SDK_$(sdk)_INCS.$(BUILD_TARGET_ARCH))\
|
---|
| 518 | $(SDK_$(sdk)_INCS.$(BUILD_TARGET))\
|
---|
| 519 | $(SDK_$(sdk)_INCS.$(BUILD_TYPE))\
|
---|
| 520 | $(SDK_$(sdk)_INCS))\
|
---|
| 521 | $(TOOL_$(tool)_$(type)INCS.$(BUILD_TARGET_CPU))\
|
---|
| 522 | $(TOOL_$(tool)_$(type)INCS.$(BUILD_TARGET_ARCH))\
|
---|
[74] | 523 | $(TOOL_$(tool)_$(type)INCS.$(BUILD_TARGET))\
|
---|
| 524 | $(TOOL_$(tool)_$(type)INCS.$(BUILD_TYPE))\
|
---|
[73] | 525 | $(TOOL_$(tool)_$(type)INCS)\
|
---|
| 526 | )
|
---|
| 527 | $(eval flags :=\
|
---|
| 528 | $(TOOL_$(tool)_$(type)FLAGS)\
|
---|
| 529 | $(TOOL_$(tool)_$(type)FLAGS.$(BUILD_TYPE))\
|
---|
[74] | 530 | $(TOOL_$(tool)_$(type)FLAGS.$(BUILD_TARGET))\
|
---|
[78] | 531 | $(TOOL_$(tool)_$(type)FLAGS.$(BUILD_TARGET_ARCH))\
|
---|
| 532 | $(TOOL_$(tool)_$(type)FLAGS.$(BUILD_TARGET_CPU))\
|
---|
[73] | 533 | $($(type)FLAGS)\
|
---|
| 534 | $($(type)FLAGS.$(BUILD_TYPE))\
|
---|
[74] | 535 | $($(type)FLAGS.$(BUILD_TARGET))\
|
---|
[78] | 536 | $($(type)FLAGS.$(BUILD_TARGET_ARCH))\
|
---|
| 537 | $($(type)FLAGS.$(BUILD_TARGET_CPU))\
|
---|
[73] | 538 | $($(target)_$(type)FLAGS)\
|
---|
| 539 | $($(target)_$(type)FLAGS.$(BUILD_TYPE))\
|
---|
[74] | 540 | $($(target)_$(type)FLAGS.$(BUILD_TARGET))\
|
---|
[78] | 541 | $($(target)_$(type)FLAGS.$(BUILD_TARGET_ARCH))\
|
---|
| 542 | $($(target)_$(type)FLAGS.$(BUILD_TARGET_CPU))\
|
---|
[73] | 543 | $($(source)_$(type)FLAGS)\
|
---|
| 544 | $($(source)_$(type)FLAGS.$(BUILD_TYPE))\
|
---|
[74] | 545 | $($(source)_$(type)FLAGS.$(BUILD_TARGET))\
|
---|
[78] | 546 | $($(source)_$(type)FLAGS.$(BUILD_TARGET_ARCH))\
|
---|
| 547 | $($(source)_$(type)FLAGS.$(BUILD_TARGET_CPU))\
|
---|
[73] | 548 | $($(target)_$(source)_$(type)FLAGS)\
|
---|
| 549 | $($(target)_$(source)_$(type)FLAGS.$(BUILD_TYPE))\
|
---|
[74] | 550 | $($(target)_$(source)_$(type)FLAGS.$(BUILD_TARGET))\
|
---|
[78] | 551 | $($(target)_$(source)_$(type)FLAGS.$(BUILD_TARGET_ARCH))\
|
---|
| 552 | $($(target)_$(source)_$(type)FLAGS.$(BUILD_TARGET_CPU))\
|
---|
[73] | 553 | )
|
---|
[74] | 554 | $(eval objsuff := $(firstword \
|
---|
| 555 | $($(target)_$(source)_OBJSUFF.$(BUILD_TARGET))\
|
---|
| 556 | $($(target)_$(source)_OBJSUFF)\
|
---|
| 557 | $($(source)_OBJSUFF.$(BUILD_TARGET))\
|
---|
| 558 | $($(source)_OBJSUFF)\
|
---|
| 559 | $($(target)_OBJSUFF.$(BUILD_TARGET))\
|
---|
| 560 | $($(target)_OBJSUFF)\
|
---|
| 561 | $(TOOL_$(tool)_$(type)OBJSUFF.$(BUILD_TARGET))\
|
---|
| 562 | $(TOOL_$(tool)_$(type)OBJSUFF)\
|
---|
| 563 | $(SUFF_OBJ)\
|
---|
| 564 | ))
|
---|
[73] | 565 | $(eval obj := $(outbase)$(objsuff))
|
---|
[74] | 566 | $(eval dep := $(outbase)$(SUFF_DEP))
|
---|
[73] | 567 |
|
---|
| 568 | #$ (warning dbg: target=$(target) source=$(source) tool=$(tool) obj=$(obj) dep=$(dep) flags=$(flags) defs=$(defs) incs=$(incs) dirdep=$(dirdep) outbase=$(outbase) objsuff=$(objsuff))
|
---|
[97] | 569 | ifndef TOOL_$(tool)_COMPILE_$(type)
|
---|
| 570 | $$(warning kBuild: TOOL_$(tool)_COMPILE_$(type) is not defined. source=$(source) target=$(target) )
|
---|
| 571 | $$(warning kBuild: tools: \
|
---|
[106] | 572 | 1 $($(target)_$(source)_$(type)TOOL.$(BUILD_TARGET)) \
|
---|
| 573 | 2 $($(target)_$(source)_$(type)TOOL) \
|
---|
| 574 | 3 $($(target)_$(source)_TOOL.$(BUILD_TARGET)) \
|
---|
| 575 | 4 $($(target)_$(source)_TOOL) \
|
---|
| 576 | 5 $($(target)_$(type)TOOL.$(BUILD_TARGET)) \
|
---|
| 577 | 6 $($(target)_$(type)TOOL) \
|
---|
| 578 | 7 $($(target)_TOOL.$(BUILD_TARGET)) \
|
---|
| 579 | 8 $($(target)_TOOL) \
|
---|
| 580 | 9 $($(source)_$(type)TOOL.$(BUILD_TARGET)) \
|
---|
| 581 | 10 $($(source)_$(type)TOOL) \
|
---|
| 582 | 11 $($(source)_TOOL.$(BUILD_TARGET)) \
|
---|
| 583 | 12 $($(source)_TOOL) \
|
---|
| 584 | 13 $($(type)TOOL.$(BUILD_TARGET)) \
|
---|
| 585 | 14 $($(type)TOOL) \
|
---|
| 586 | 15 $(TOOL.$(BUILD_TARGET)) \
|
---|
| 587 | 16 $(TOOL) )
|
---|
[97] | 588 | endif
|
---|
[73] | 589 | $(eval $(TOOL_$(tool)_COMPILE_$(type)))
|
---|
| 590 |
|
---|
| 591 | $(eval _OBJS_$(target) += $(obj))
|
---|
| 592 | $(eval _DEPFILES += $(dep))
|
---|
| 593 |
|
---|
| 594 | endef
|
---|
| 595 |
|
---|
| 596 | ## Generic macro for processing all target sources.
|
---|
[74] | 597 | # @param $(target) Normalized target name.
|
---|
[73] | 598 | define def_target_sources
|
---|
| 599 | #$ (warning def_target_sources)
|
---|
| 600 | # C sources
|
---|
[120] | 601 | $(foreach type,C,$(foreach source, $(filter %.c, $($(target)_SOURCES) $($(target)_SOURCES.$(BUILD_TARGET)) $($(target)_SOURCES.$(BUILD_MODE)))\
|
---|
[73] | 602 | ,$(eval $(def_target_source_c_cpp_asm)) ))
|
---|
| 603 |
|
---|
| 604 | # C++ sources
|
---|
[120] | 605 | $(foreach type,CXX,$(foreach source, $(filter %.cpp %.cxx %.xx, $($(target)_SOURCES) $($(target)_SOURCES.$(BUILD_TARGET)) $($(target)_SOURCES.$(BUILD_MODE)))\
|
---|
[73] | 606 | ,$(eval $(def_target_source_c_cpp_asm)) ))
|
---|
| 607 |
|
---|
| 608 | # ASM sources
|
---|
[120] | 609 | $(foreach type,AS,$(foreach source, $(filter %.asm %.s %.S, $($(target)_SOURCES) $($(target)_SOURCES.$(BUILD_TARGET)) $($(target)_SOURCES.$(BUILD_MODE)))\
|
---|
[73] | 610 | ,$(eval $(def_target_source_c_cpp_asm)) ))
|
---|
| 611 | endef
|
---|
| 612 |
|
---|
| 613 |
|
---|
| 614 | #
|
---|
[72] | 615 | # LIBRARIES
|
---|
[73] | 616 | #
|
---|
[72] | 617 |
|
---|
| 618 | ## Library (one).
|
---|
[74] | 619 | # @param $(target) Normalized library (target) name.
|
---|
[72] | 620 | define def_lib
|
---|
[73] | 621 | # source -> object
|
---|
| 622 | $(eval $(def_target_sources))
|
---|
[72] | 623 |
|
---|
[73] | 624 | # library
|
---|
[78] | 625 | $(eval tool := $(call _TARGET_TOOL,$(target),AR))
|
---|
| 626 | ifeq ($(tool),)
|
---|
| 627 | $$(error kBuild: Library target $(target) doesn't have a tool defined!)
|
---|
| 628 | endif
|
---|
[111] | 629 | ## @todo prefix
|
---|
| 630 | $(eval outbase := $(call _TARGET_BASE,$(target),$(target)))
|
---|
| 631 | $(eval PATH_$(target) := $(patsubst %/,%,$(dir $(outbase))))
|
---|
[126] | 632 | $(eval libsuff := $(firstword\
|
---|
| 633 | $($(target)_LIBSUFF.$(BUILD_TARGET))\
|
---|
| 634 | $($(target)_LIBSUFF)\
|
---|
| 635 | $(TOOL_$(tool)_ARLIBSUFF.$(BUILD_TARGET))\
|
---|
| 636 | $(TOOL_$(tool)_ARLIBSUFF)\
|
---|
| 637 | $(SUFF_LIB)\
|
---|
| 638 | ))
|
---|
[111] | 639 | $(eval lib := $(outbase)$(libsuff))
|
---|
[74] | 640 | $(eval flags :=\
|
---|
| 641 | $(TOOL_$(tool)_ARFLAGS)\
|
---|
| 642 | $(TOOL_$(tool)_ARFLAGS.$(BUILD_TYPE))\
|
---|
| 643 | $(ARFLAGS)\
|
---|
| 644 | $(ARFLAGS.$(BUILD_TYPE))\
|
---|
| 645 | $($(target)_ARFLAGS)\
|
---|
| 646 | $($(target)_ARFLAGS.$(BUILD_TYPE))\
|
---|
| 647 | )
|
---|
[73] | 648 | $(eval objs = $(_OBJS_$(target)))
|
---|
[120] | 649 | $(eval othersrc := $(filter-out %.c %.cpp %.cxx %.cc %.s %.S %.asm,$($(target)_SOURCES) $($(target)_SOURCES.$(BUILD_TARGET)) $($(target)_SOURCES.$(BUILD_MODE))))
|
---|
[73] | 650 | $(eval dirdep := $(dir $(lib)).dir_created)
|
---|
[78] | 651 | ## @todo fix dependencies on makefiles an such
|
---|
[73] | 652 | $(eval deps := )
|
---|
[72] | 653 |
|
---|
[73] | 654 | $(eval $(TOOL_$(tool)_LINK_LIBRARY))
|
---|
[72] | 655 |
|
---|
[126] | 656 | # publish rule (still need work)
|
---|
[131] | 657 | ifndef $(target)_NOINST
|
---|
[126] | 658 | $(eval publib := $(PATH_LIB)/$(notdir $(lib)))
|
---|
| 659 | $(publib) : $(lib) $(dir $(publib)).dir_created
|
---|
[130] | 660 | $(CP) $(lib) $(publib)
|
---|
[126] | 661 |
|
---|
| 662 | _LIBS += $(publib)
|
---|
| 663 | _OUT_FILES += $(lib) $(publib)
|
---|
| 664 | else
|
---|
[73] | 665 | _LIBS += $(lib)
|
---|
[75] | 666 | _OUT_FILES += $(lib)
|
---|
[126] | 667 | endif
|
---|
| 668 | _OBJS += $(_OBJS_$(target))
|
---|
[72] | 669 | endef
|
---|
| 670 |
|
---|
| 671 | # Process libraries
|
---|
| 672 | $(foreach target, $(LIBRARIES), $(eval $(def_lib)))
|
---|
| 673 |
|
---|
| 674 |
|
---|
| 675 |
|
---|
| 676 | #
|
---|
| 677 | # PROGRAMS
|
---|
| 678 | #
|
---|
| 679 |
|
---|
[74] | 680 | ## Program (one).
|
---|
| 681 | # @param $(target) Normalized target (program) name.
|
---|
| 682 | define def_program
|
---|
| 683 | # source -> object
|
---|
| 684 | $(eval $(def_target_sources))
|
---|
[72] | 685 |
|
---|
[74] | 686 | # library
|
---|
[78] | 687 | $(eval tool := $(call _TARGET_TOOL,$(target),LD))
|
---|
[111] | 688 | $(eval outbase := $(call _TARGET_BASE,$(target),$(target)))
|
---|
| 689 | $(eval PATH_$(target) := $(patsubst %/,%,$(dir $(outbase))))
|
---|
| 690 | $(eval exesuff := $(firstword $($(target)_EXESUFF) $($(target)_EXESUFF) $(TOOL_$(tool)_LDEXESUFF) $(SUFF_EXE)))
|
---|
| 691 | $(eval exe := $(outbase)$(exesuff))
|
---|
| 692 | $(eval objs = $(_OBJS_$(target)))
|
---|
[74] | 693 | $(eval flags :=\
|
---|
| 694 | $(TOOL_$(tool)_LDFLAGS)\
|
---|
| 695 | $(TOOL_$(tool)_LDFLAGS.$(BUILD_TYPE))\
|
---|
[89] | 696 | $(TOOL_$(tool)_LDFLAGS.$(BUILD_TARGET))\
|
---|
| 697 | $(TOOL_$(tool)_LDFLAGS.$(BUILD_TARGET_ARCH))\
|
---|
| 698 | $(TOOL_$(tool)_LDFLAGS.$(BUILD_TARGET_CPU))\
|
---|
[74] | 699 | $(LDFLAGS)\
|
---|
| 700 | $(LDFLAGS.$(BUILD_TYPE))\
|
---|
[89] | 701 | $(LDFLAGS.$(BUILD_TARGET))\
|
---|
| 702 | $(LDFLAGS.$(BUILD_TARGET_ARCH))\
|
---|
| 703 | $(LDFLAGS.$(BUILD_TARGET_CPU))\
|
---|
[74] | 704 | $($(target)_LDFLAGS)\
|
---|
| 705 | $($(target)_LDFLAGS.$(BUILD_TYPE))\
|
---|
[89] | 706 | $($(target)_LDFLAGS.$(BUILD_TARGET))\
|
---|
| 707 | $($(target)_LDFLAGS.$(BUILD_TARGET_ARCH))\
|
---|
| 708 | $($(target)_LDFLAGS.$(BUILD_TARGET_CPU))\
|
---|
[74] | 709 | )
|
---|
| 710 | $(eval libs :=\
|
---|
[87] | 711 | $($(target)_LIBS.$(BUILD_TARGET_CPU))\
|
---|
| 712 | $($(target)_LIBS.$(BUILD_TARGET_ARCH))\
|
---|
| 713 | $($(target)_LIBS.$(BUILD_TARGET))\
|
---|
[74] | 714 | $($(target)_LIBS.$(BUILD_TYPE))\
|
---|
| 715 | $($(target)_LIBS)\
|
---|
[122] | 716 | $(foreach sdk, $($(target)_SDKS.$(BUILD_TARGET)) \
|
---|
| 717 | $($(target)_SDKS.$(BUILD_TYPE)) \
|
---|
| 718 | $($(target)_SDKS),\
|
---|
| 719 | $(SDK_$(sdk)_LIBS.$(BUILD_TARGET_CPU))\
|
---|
| 720 | $(SDK_$(sdk)_LIBS.$(BUILD_TARGET_ARCH))\
|
---|
| 721 | $(SDK_$(sdk)_LIBS.$(BUILD_TARGET))\
|
---|
| 722 | $(SDK_$(sdk)_LIBS.$(BUILD_TYPE))\
|
---|
| 723 | $(SDK_$(sdk)_LIBS))\
|
---|
[87] | 724 | $(LIBS.$(BUILD_TARGET_CPU))\
|
---|
| 725 | $(LIBS.$(BUILD_TARGET_ARCH))\
|
---|
| 726 | $(LIBS.$(BUILD_TARGET))\
|
---|
[74] | 727 | $(LIBS.$(BUILD_TYPE))\
|
---|
| 728 | $(LIBS)\
|
---|
[122] | 729 | $(foreach sdk, $(SDKS.$(BUILD_TARGET)) \
|
---|
| 730 | $(SDKS.$(BUILD_TYPE)) \
|
---|
| 731 | $(SDKS),\
|
---|
| 732 | $(SDK_$(sdk)_LIBS.$(BUILD_TARGET_CPU))\
|
---|
| 733 | $(SDK_$(sdk)_LIBS.$(BUILD_TARGET_ARCH))\
|
---|
| 734 | $(SDK_$(sdk)_LIBS.$(BUILD_TARGET))\
|
---|
| 735 | $(SDK_$(sdk)_LIBS.$(BUILD_TYPE))\
|
---|
| 736 | $(SDK_$(sdk)_LIBS))\
|
---|
| 737 | $(TOOL_$(tool)_LIBS.$(BUILD_TARGET_CPU))\
|
---|
| 738 | $(TOOL_$(tool)_LIBS.$(BUILD_TARGET_ARCH))\
|
---|
| 739 | $(TOOL_$(tool)_LIBS.$(BUILD_TARGET))\
|
---|
[74] | 740 | $(TOOL_$(tool)_LIBS.$(BUILD_TYPE))\
|
---|
| 741 | $(TOOL_$(tool)_LIBS)\
|
---|
| 742 | )
|
---|
| 743 | $(eval libpath :=\
|
---|
[87] | 744 | $($(target)_LIBPATH.$(BUILD_TARGET_CPU))\
|
---|
| 745 | $($(target)_LIBPATH.$(BUILD_TARGET_ARCH))\
|
---|
| 746 | $($(target)_LIBPATH.$(BUILD_TARGET))\
|
---|
[74] | 747 | $($(target)_LIBPATH.$(BUILD_TYPE))\
|
---|
| 748 | $($(target)_LIBPATH)\
|
---|
[122] | 749 | $(foreach sdk, $($(target)_SDKS.$(BUILD_TARGET)) \
|
---|
| 750 | $($(target)_SDKS.$(BUILD_TYPE)) \
|
---|
| 751 | $($(target)_SDKS),\
|
---|
| 752 | $(SDK_$(sdk)_LIBPATH.$(BUILD_TARGET_CPU))\
|
---|
| 753 | $(SDK_$(sdk)_LIBPATH.$(BUILD_TARGET_ARCH))\
|
---|
| 754 | $(SDK_$(sdk)_LIBPATH.$(BUILD_TARGET))\
|
---|
| 755 | $(SDK_$(sdk)_LIBPATH.$(BUILD_TYPE))\
|
---|
| 756 | $(SDK_$(sdk)_LIBPATH))\
|
---|
[87] | 757 | $(LIBPATH.$(BUILD_TARGET_CPU))\
|
---|
| 758 | $(LIBPATH.$(BUILD_TARGET_ARCH))\
|
---|
| 759 | $(LIBPATH.$(BUILD_TARGET))\
|
---|
[74] | 760 | $(LIBPATH.$(BUILD_TYPE))\
|
---|
| 761 | $(LIBPATH)\
|
---|
[122] | 762 | $(foreach sdk, $(SDKS.$(BUILD_TARGET)) \
|
---|
| 763 | $(SDKS.$(BUILD_TYPE)) \
|
---|
| 764 | $(SDKS),\
|
---|
| 765 | $(SDK_$(sdk)_LIBPATH.$(BUILD_TARGET_CPU))\
|
---|
| 766 | $(SDK_$(sdk)_LIBPATH.$(BUILD_TARGET_ARCH))\
|
---|
| 767 | $(SDK_$(sdk)_LIBPATH.$(BUILD_TARGET))\
|
---|
| 768 | $(SDK_$(sdk)_LIBPATH.$(BUILD_TYPE))\
|
---|
| 769 | $(SDK_$(sdk)_LIBPATH))\
|
---|
[87] | 770 | $(TOOL_$(tool)_LIBPATH.$(BUILD_TARGET_CPU))\
|
---|
| 771 | $(TOOL_$(tool)_LIBPATH.$(BUILD_TARGET_ARCH))\
|
---|
| 772 | $(TOOL_$(tool)_LIBPATH.$(BUILD_TARGET))\
|
---|
[74] | 773 | $(TOOL_$(tool)_LIBPATH.$(BUILD_TYPE))\
|
---|
| 774 | $(TOOL_$(tool)_LIBPATH)\
|
---|
| 775 | )
|
---|
| 776 | $(eval dirdep := $(dir $(exe)).dir_created)
|
---|
| 777 | ## @todo fix dependencies
|
---|
| 778 | $(eval deps := )
|
---|
| 779 | #
|
---|
| 780 | $(eval custom_pre := $(strip $(firstword
|
---|
| 781 | $($(target)_CUSTOM_PRE.$(BUILD_TARGET).$(BUILD_TYPE))\
|
---|
| 782 | $($(target)_CUSTOM_PRE.$(BUILD_TARGET))\
|
---|
| 783 | $($(target)_CUSTOM_PRE.$(BUILD_TYPE))\
|
---|
| 784 | $($(target)_CUSTOM_PRE)\
|
---|
| 785 | $(CUSTOM_PRE.$(BUILD_TARGET).$(BUILD_TYPE))\
|
---|
| 786 | $(CUSTOM_PRE.$(BUILD_TARGET))\
|
---|
| 787 | $(CUSTOM_PRE.$(BUILD_TYPE))\
|
---|
| 788 | $(CUSTOM_PRE)\
|
---|
| 789 | )))
|
---|
| 790 | $(eval custom_post := $(strip $(firstword
|
---|
| 791 | $($(target)_CUSTOM_POST.$(BUILD_TARGET).$(BUILD_TYPE))\
|
---|
| 792 | $($(target)_CUSTOM_POST.$(BUILD_TARGET))\
|
---|
| 793 | $($(target)_CUSTOM_POST.$(BUILD_TYPE))\
|
---|
| 794 | $($(target)_CUSTOM_POST)\
|
---|
| 795 | $(CUSTOM_POST.$(BUILD_TARGET).$(BUILD_TYPE))\
|
---|
| 796 | $(CUSTOM_POST.$(BUILD_TARGET))\
|
---|
| 797 | $(CUSTOM_POST.$(BUILD_TYPE))\
|
---|
| 798 | $(CUSTOM_POST)\
|
---|
| 799 | )))
|
---|
[120] | 800 | $(eval othersrc := $(filter-out %.c %.cpp %.cxx %.cc %.s %.S %.asm,$($(target)_SOURCES) $($(target)_SOURCES.$(BUILD_TARGET)) $($(target)_SOURCES.$(BUILD_MODE))))
|
---|
[72] | 801 |
|
---|
[74] | 802 | $(eval $(TOOL_$(tool)_LINK_PROGRAM))
|
---|
[130] | 803 | # publish rule (still need work)
|
---|
[131] | 804 | ifndef $(target)_NOINST
|
---|
| 805 | $(eval pubexe := $(PATH_BIN)/$(notdir $(exe)))
|
---|
[130] | 806 | $(pubexe) : $(exe) $(dir $(pubexe)).dir_created
|
---|
| 807 | $(CP) $(exe) $(pubexe)
|
---|
| 808 |
|
---|
| 809 | _DLLS += $(pubexe)
|
---|
| 810 | _OUT_FILES += $(exe) $(pubexe)
|
---|
| 811 | else
|
---|
| 812 | _DLLS += $(exe)
|
---|
| 813 | _OUT_FILES += $(exe)
|
---|
| 814 | endif
|
---|
[74] | 815 | _OBJS += $(_OBJS_$(target))
|
---|
| 816 | endef
|
---|
| 817 |
|
---|
| 818 | # Process libraries
|
---|
| 819 | $(foreach target, $(PROGRAMS), $(eval $(def_program)))
|
---|
| 820 |
|
---|
| 821 |
|
---|
| 822 |
|
---|
[72] | 823 | #
|
---|
| 824 | # DLLS
|
---|
| 825 | #
|
---|
| 826 |
|
---|
[130] | 827 | ## DLL (one).
|
---|
| 828 | # @param $(target) Normalized target (program) name.
|
---|
| 829 | define def_dll
|
---|
| 830 | # source -> object
|
---|
| 831 | $(eval $(def_target_sources))
|
---|
[72] | 832 |
|
---|
[130] | 833 | # dllmod
|
---|
| 834 | $(eval tool := $(call _TARGET_TOOL,$(target),LD))
|
---|
| 835 | $(eval outbase := $(call _TARGET_BASE,$(target),$(target)))
|
---|
| 836 | $(eval PATH_$(target) := $(patsubst %/,%,$(dir $(outbase))))
|
---|
| 837 | $(eval dllsuff := $(firstword $($(target)_DLLSUFF) $($(target)_DLLSUFF) $(TOOL_$(tool)_LDDLLSUFF) $(SUFF_DLL)))
|
---|
| 838 | $(eval dll := $(outbase)$(dllsuff))
|
---|
| 839 | $(eval objs = $(_OBJS_$(target)))
|
---|
| 840 | $(eval flags :=\
|
---|
| 841 | $(TOOL_$(tool)_LDFLAGS)\
|
---|
| 842 | $(TOOL_$(tool)_LDFLAGS.$(BUILD_TYPE))\
|
---|
| 843 | $(TOOL_$(tool)_LDFLAGS.$(BUILD_TARGET))\
|
---|
| 844 | $(TOOL_$(tool)_LDFLAGS.$(BUILD_TARGET_ARCH))\
|
---|
| 845 | $(TOOL_$(tool)_LDFLAGS.$(BUILD_TARGET_CPU))\
|
---|
| 846 | $(LDFLAGS)\
|
---|
| 847 | $(LDFLAGS.$(BUILD_TYPE))\
|
---|
| 848 | $(LDFLAGS.$(BUILD_TARGET))\
|
---|
| 849 | $(LDFLAGS.$(BUILD_TARGET_ARCH))\
|
---|
| 850 | $(LDFLAGS.$(BUILD_TARGET_CPU))\
|
---|
| 851 | $($(target)_LDFLAGS)\
|
---|
| 852 | $($(target)_LDFLAGS.$(BUILD_TYPE))\
|
---|
| 853 | $($(target)_LDFLAGS.$(BUILD_TARGET))\
|
---|
| 854 | $($(target)_LDFLAGS.$(BUILD_TARGET_ARCH))\
|
---|
| 855 | $($(target)_LDFLAGS.$(BUILD_TARGET_CPU))\
|
---|
| 856 | )
|
---|
| 857 | $(eval libs :=\
|
---|
| 858 | $($(target)_LIBS.$(BUILD_TARGET_CPU))\
|
---|
| 859 | $($(target)_LIBS.$(BUILD_TARGET_ARCH))\
|
---|
| 860 | $($(target)_LIBS.$(BUILD_TARGET))\
|
---|
| 861 | $($(target)_LIBS.$(BUILD_TYPE))\
|
---|
| 862 | $($(target)_LIBS)\
|
---|
| 863 | $(foreach sdk, $($(target)_SDKS.$(BUILD_TARGET)) \
|
---|
| 864 | $($(target)_SDKS.$(BUILD_TYPE)) \
|
---|
| 865 | $($(target)_SDKS),\
|
---|
| 866 | $(SDK_$(sdk)_LIBS.$(BUILD_TARGET_CPU))\
|
---|
| 867 | $(SDK_$(sdk)_LIBS.$(BUILD_TARGET_ARCH))\
|
---|
| 868 | $(SDK_$(sdk)_LIBS.$(BUILD_TARGET))\
|
---|
| 869 | $(SDK_$(sdk)_LIBS.$(BUILD_TYPE))\
|
---|
| 870 | $(SDK_$(sdk)_LIBS))\
|
---|
| 871 | $(LIBS.$(BUILD_TARGET_CPU))\
|
---|
| 872 | $(LIBS.$(BUILD_TARGET_ARCH))\
|
---|
| 873 | $(LIBS.$(BUILD_TARGET))\
|
---|
| 874 | $(LIBS.$(BUILD_TYPE))\
|
---|
| 875 | $(LIBS)\
|
---|
| 876 | $(foreach sdk, $(SDKS.$(BUILD_TARGET)) \
|
---|
| 877 | $(SDKS.$(BUILD_TYPE)) \
|
---|
| 878 | $(SDKS),\
|
---|
| 879 | $(SDK_$(sdk)_LIBS.$(BUILD_TARGET_CPU))\
|
---|
| 880 | $(SDK_$(sdk)_LIBS.$(BUILD_TARGET_ARCH))\
|
---|
| 881 | $(SDK_$(sdk)_LIBS.$(BUILD_TARGET))\
|
---|
| 882 | $(SDK_$(sdk)_LIBS.$(BUILD_TYPE))\
|
---|
| 883 | $(SDK_$(sdk)_LIBS))\
|
---|
| 884 | $(TOOL_$(tool)_LIBS.$(BUILD_TARGET_CPU))\
|
---|
| 885 | $(TOOL_$(tool)_LIBS.$(BUILD_TARGET_ARCH))\
|
---|
| 886 | $(TOOL_$(tool)_LIBS.$(BUILD_TARGET))\
|
---|
| 887 | $(TOOL_$(tool)_LIBS.$(BUILD_TYPE))\
|
---|
| 888 | $(TOOL_$(tool)_LIBS)\
|
---|
| 889 | )
|
---|
| 890 | $(eval libpath :=\
|
---|
| 891 | $($(target)_LIBPATH.$(BUILD_TARGET_CPU))\
|
---|
| 892 | $($(target)_LIBPATH.$(BUILD_TARGET_ARCH))\
|
---|
| 893 | $($(target)_LIBPATH.$(BUILD_TARGET))\
|
---|
| 894 | $($(target)_LIBPATH.$(BUILD_TYPE))\
|
---|
| 895 | $($(target)_LIBPATH)\
|
---|
| 896 | $(foreach sdk, $($(target)_SDKS.$(BUILD_TARGET)) \
|
---|
| 897 | $($(target)_SDKS.$(BUILD_TYPE)) \
|
---|
| 898 | $($(target)_SDKS),\
|
---|
| 899 | $(SDK_$(sdk)_LIBPATH.$(BUILD_TARGET_CPU))\
|
---|
| 900 | $(SDK_$(sdk)_LIBPATH.$(BUILD_TARGET_ARCH))\
|
---|
| 901 | $(SDK_$(sdk)_LIBPATH.$(BUILD_TARGET))\
|
---|
| 902 | $(SDK_$(sdk)_LIBPATH.$(BUILD_TYPE))\
|
---|
| 903 | $(SDK_$(sdk)_LIBPATH))\
|
---|
| 904 | $(LIBPATH.$(BUILD_TARGET_CPU))\
|
---|
| 905 | $(LIBPATH.$(BUILD_TARGET_ARCH))\
|
---|
| 906 | $(LIBPATH.$(BUILD_TARGET))\
|
---|
| 907 | $(LIBPATH.$(BUILD_TYPE))\
|
---|
| 908 | $(LIBPATH)\
|
---|
| 909 | $(foreach sdk, $(SDKS.$(BUILD_TARGET)) \
|
---|
| 910 | $(SDKS.$(BUILD_TYPE)) \
|
---|
| 911 | $(SDKS),\
|
---|
| 912 | $(SDK_$(sdk)_LIBPATH.$(BUILD_TARGET_CPU))\
|
---|
| 913 | $(SDK_$(sdk)_LIBPATH.$(BUILD_TARGET_ARCH))\
|
---|
| 914 | $(SDK_$(sdk)_LIBPATH.$(BUILD_TARGET))\
|
---|
| 915 | $(SDK_$(sdk)_LIBPATH.$(BUILD_TYPE))\
|
---|
| 916 | $(SDK_$(sdk)_LIBPATH))\
|
---|
| 917 | $(TOOL_$(tool)_LIBPATH.$(BUILD_TARGET_CPU))\
|
---|
| 918 | $(TOOL_$(tool)_LIBPATH.$(BUILD_TARGET_ARCH))\
|
---|
| 919 | $(TOOL_$(tool)_LIBPATH.$(BUILD_TARGET))\
|
---|
| 920 | $(TOOL_$(tool)_LIBPATH.$(BUILD_TYPE))\
|
---|
| 921 | $(TOOL_$(tool)_LIBPATH)\
|
---|
| 922 | )
|
---|
| 923 | $(eval dirdep := $(dir $(dll)).dir_created)
|
---|
| 924 | ## @todo fix dependencies
|
---|
| 925 | $(eval deps := )
|
---|
| 926 | #
|
---|
| 927 | $(eval custom_pre := $(strip $(firstword
|
---|
| 928 | $($(target)_CUSTOM_PRE.$(BUILD_TARGET).$(BUILD_TYPE))\
|
---|
| 929 | $($(target)_CUSTOM_PRE.$(BUILD_TARGET))\
|
---|
| 930 | $($(target)_CUSTOM_PRE.$(BUILD_TYPE))\
|
---|
| 931 | $($(target)_CUSTOM_PRE)\
|
---|
| 932 | $(CUSTOM_PRE.$(BUILD_TARGET).$(BUILD_TYPE))\
|
---|
| 933 | $(CUSTOM_PRE.$(BUILD_TARGET))\
|
---|
| 934 | $(CUSTOM_PRE.$(BUILD_TYPE))\
|
---|
| 935 | $(CUSTOM_PRE)\
|
---|
| 936 | )))
|
---|
| 937 | $(eval custom_post := $(strip $(firstword
|
---|
| 938 | $($(target)_CUSTOM_POST.$(BUILD_TARGET).$(BUILD_TYPE))\
|
---|
| 939 | $($(target)_CUSTOM_POST.$(BUILD_TARGET))\
|
---|
| 940 | $($(target)_CUSTOM_POST.$(BUILD_TYPE))\
|
---|
| 941 | $($(target)_CUSTOM_POST)\
|
---|
| 942 | $(CUSTOM_POST.$(BUILD_TARGET).$(BUILD_TYPE))\
|
---|
| 943 | $(CUSTOM_POST.$(BUILD_TARGET))\
|
---|
| 944 | $(CUSTOM_POST.$(BUILD_TYPE))\
|
---|
| 945 | $(CUSTOM_POST)\
|
---|
| 946 | )))
|
---|
| 947 | $(eval othersrc := $(filter-out %.c %.cpp %.cxx %.cc %.s %.S %.asm,$($(target)_SOURCES) $($(target)_SOURCES.$(BUILD_TARGET)) $($(target)_SOURCES.$(BUILD_MODE))))
|
---|
[72] | 948 |
|
---|
[130] | 949 | ifndef TOOL_$(tool)_LINK_DLL
|
---|
| 950 | $$(warning kBuild: TOOL_$(tool)_LINK_DLL is not defined. target=$(target) )
|
---|
| 951 | $$(warning kBuild: tools: \
|
---|
| 952 | 1 $($(target)_$(source)TOOL.$(BUILD_TARGET)) \
|
---|
| 953 | 2 $($(target)_$(source)TOOL) \
|
---|
| 954 | 3 $($(target)_TOOL.$(BUILD_TARGET)) \
|
---|
| 955 | 4 $($(target)_TOOL) \
|
---|
| 956 | 5 $($(source)TOOL) \
|
---|
| 957 | 6 $($(source)TOOL.$(BUILD_TARGET)) \
|
---|
| 958 | 7 $(TOOL.$(BUILD_TARGET)) \
|
---|
| 959 | 8 $(TOOL) )
|
---|
| 960 | endif
|
---|
| 961 |
|
---|
| 962 | $(eval $(TOOL_$(tool)_LINK_DLL))
|
---|
| 963 |
|
---|
| 964 |
|
---|
| 965 | # publish rule (still need work)
|
---|
[131] | 966 | ifndef $(target)_NOINST
|
---|
| 967 | $(eval pubdll := $(PATH_BIN)/$(notdir $(dll)))
|
---|
[130] | 968 | $(pubdll) : $(dll) $(dir $(pubdll)).dir_created
|
---|
| 969 | $(CP) $(dll) $(pubdll)
|
---|
| 970 |
|
---|
| 971 | _DLLS += $(pubdll)
|
---|
| 972 | _OUT_FILES += $(dll) $(pubdll)
|
---|
| 973 | else
|
---|
| 974 | _DLLS += $(dll)
|
---|
| 975 | _OUT_FILES += $(dll)
|
---|
| 976 | endif
|
---|
| 977 | _OBJS += $(_OBJS_$(target))
|
---|
| 978 | endef
|
---|
| 979 |
|
---|
| 980 | # Process dlls
|
---|
| 981 | $(foreach target, $(DLLS), $(eval $(def_dll)))
|
---|
| 982 |
|
---|
| 983 |
|
---|
[72] | 984 | #
|
---|
[83] | 985 | # SYSMODS
|
---|
[72] | 986 | #
|
---|
| 987 |
|
---|
[130] | 988 | ## System module (one).
|
---|
[83] | 989 | # @param $(target) Normalized target (program) name.
|
---|
| 990 | define def_sysmod
|
---|
| 991 | # source -> object
|
---|
| 992 | $(eval $(def_target_sources))
|
---|
[72] | 993 |
|
---|
[110] | 994 | # sysmod
|
---|
[83] | 995 | $(eval tool := $(call _TARGET_TOOL,$(target),LD))
|
---|
[111] | 996 | $(eval outbase := $(call _TARGET_BASE,$(target),$(target)))
|
---|
| 997 | $(eval PATH_$(target) := $(patsubst %/,%,$(dir $(outbase))))
|
---|
| 998 | $(eval syssuff := $(firstword $($(target)_SYSSUFF) $($(target)_SYSSUFF) $(TOOL_$(tool)_LDSYSSUFF) $(SUFF_SYS)))
|
---|
| 999 | $(eval sys := $(outbase)$(syssuff))
|
---|
| 1000 | $(eval objs = $(_OBJS_$(target)))
|
---|
[83] | 1001 | $(eval flags :=\
|
---|
| 1002 | $(TOOL_$(tool)_LDFLAGS)\
|
---|
| 1003 | $(TOOL_$(tool)_LDFLAGS.$(BUILD_TYPE))\
|
---|
[89] | 1004 | $(TOOL_$(tool)_LDFLAGS.$(BUILD_TARGET))\
|
---|
| 1005 | $(TOOL_$(tool)_LDFLAGS.$(BUILD_TARGET_ARCH))\
|
---|
| 1006 | $(TOOL_$(tool)_LDFLAGS.$(BUILD_TARGET_CPU))\
|
---|
[83] | 1007 | $(LDFLAGS)\
|
---|
| 1008 | $(LDFLAGS.$(BUILD_TYPE))\
|
---|
[89] | 1009 | $(LDFLAGS.$(BUILD_TARGET))\
|
---|
| 1010 | $(LDFLAGS.$(BUILD_TARGET_ARCH))\
|
---|
| 1011 | $(LDFLAGS.$(BUILD_TARGET_CPU))\
|
---|
[83] | 1012 | $($(target)_LDFLAGS)\
|
---|
| 1013 | $($(target)_LDFLAGS.$(BUILD_TYPE))\
|
---|
[89] | 1014 | $($(target)_LDFLAGS.$(BUILD_TARGET))\
|
---|
| 1015 | $($(target)_LDFLAGS.$(BUILD_TARGET_ARCH))\
|
---|
| 1016 | $($(target)_LDFLAGS.$(BUILD_TARGET_CPU))\
|
---|
[83] | 1017 | )
|
---|
| 1018 | $(eval libs :=\
|
---|
[87] | 1019 | $($(target)_LIBS.$(BUILD_TARGET_CPU))\
|
---|
| 1020 | $($(target)_LIBS.$(BUILD_TARGET_ARCH))\
|
---|
| 1021 | $($(target)_LIBS.$(BUILD_TARGET))\
|
---|
[83] | 1022 | $($(target)_LIBS.$(BUILD_TYPE))\
|
---|
| 1023 | $($(target)_LIBS)\
|
---|
[122] | 1024 | $(foreach sdk, $($(target)_SDKS.$(BUILD_TARGET)) \
|
---|
| 1025 | $($(target)_SDKS.$(BUILD_TYPE)) \
|
---|
| 1026 | $($(target)_SDKS),\
|
---|
| 1027 | $(SDK_$(sdk)_LIBS.$(BUILD_TARGET_CPU))\
|
---|
| 1028 | $(SDK_$(sdk)_LIBS.$(BUILD_TARGET_ARCH))\
|
---|
| 1029 | $(SDK_$(sdk)_LIBS.$(BUILD_TARGET))\
|
---|
| 1030 | $(SDK_$(sdk)_LIBS.$(BUILD_TYPE))\
|
---|
| 1031 | $(SDK_$(sdk)_LIBS))\
|
---|
[87] | 1032 | $(LIBS.$(BUILD_TARGET_CPU))\
|
---|
| 1033 | $(LIBS.$(BUILD_TARGET_ARCH))\
|
---|
| 1034 | $(LIBS.$(BUILD_TARGET))\
|
---|
[83] | 1035 | $(LIBS.$(BUILD_TYPE))\
|
---|
| 1036 | $(LIBS)\
|
---|
[122] | 1037 | $(foreach sdk, $(SDKS.$(BUILD_TARGET)) \
|
---|
| 1038 | $(SDKS.$(BUILD_TYPE)) \
|
---|
| 1039 | $(SDKS),\
|
---|
| 1040 | $(SDK_$(sdk)_LIBS.$(BUILD_TARGET_CPU))\
|
---|
| 1041 | $(SDK_$(sdk)_LIBS.$(BUILD_TARGET_ARCH))\
|
---|
| 1042 | $(SDK_$(sdk)_LIBS.$(BUILD_TARGET))\
|
---|
| 1043 | $(SDK_$(sdk)_LIBS.$(BUILD_TYPE))\
|
---|
| 1044 | $(SDK_$(sdk)_LIBS))\
|
---|
| 1045 | $(TOOL_$(tool)_LIBS.$(BUILD_TARGET_CPU))\
|
---|
| 1046 | $(TOOL_$(tool)_LIBS.$(BUILD_TARGET_ARCH))\
|
---|
| 1047 | $(TOOL_$(tool)_LIBS.$(BUILD_TARGET))\
|
---|
[83] | 1048 | $(TOOL_$(tool)_LIBS.$(BUILD_TYPE))\
|
---|
| 1049 | $(TOOL_$(tool)_LIBS)\
|
---|
| 1050 | )
|
---|
| 1051 | $(eval libpath :=\
|
---|
[87] | 1052 | $($(target)_LIBPATH.$(BUILD_TARGET_CPU))\
|
---|
| 1053 | $($(target)_LIBPATH.$(BUILD_TARGET_ARCH))\
|
---|
| 1054 | $($(target)_LIBPATH.$(BUILD_TARGET))\
|
---|
[83] | 1055 | $($(target)_LIBPATH.$(BUILD_TYPE))\
|
---|
| 1056 | $($(target)_LIBPATH)\
|
---|
[122] | 1057 | $(foreach sdk, $($(target)_SDKS.$(BUILD_TARGET)) \
|
---|
| 1058 | $($(target)_SDKS.$(BUILD_TYPE)) \
|
---|
| 1059 | $($(target)_SDKS),\
|
---|
| 1060 | $(SDK_$(sdk)_LIBPATH.$(BUILD_TARGET_CPU))\
|
---|
| 1061 | $(SDK_$(sdk)_LIBPATH.$(BUILD_TARGET_ARCH))\
|
---|
| 1062 | $(SDK_$(sdk)_LIBPATH.$(BUILD_TARGET))\
|
---|
| 1063 | $(SDK_$(sdk)_LIBPATH.$(BUILD_TYPE))\
|
---|
| 1064 | $(SDK_$(sdk)_LIBPATH))\
|
---|
[87] | 1065 | $(LIBPATH.$(BUILD_TARGET_CPU))\
|
---|
| 1066 | $(LIBPATH.$(BUILD_TARGET_ARCH))\
|
---|
| 1067 | $(LIBPATH.$(BUILD_TARGET))\
|
---|
[83] | 1068 | $(LIBPATH.$(BUILD_TYPE))\
|
---|
| 1069 | $(LIBPATH)\
|
---|
[122] | 1070 | $(foreach sdk, $(SDKS.$(BUILD_TARGET)) \
|
---|
| 1071 | $(SDKS.$(BUILD_TYPE)) \
|
---|
| 1072 | $(SDKS),\
|
---|
| 1073 | $(SDK_$(sdk)_LIBPATH.$(BUILD_TARGET_CPU))\
|
---|
| 1074 | $(SDK_$(sdk)_LIBPATH.$(BUILD_TARGET_ARCH))\
|
---|
| 1075 | $(SDK_$(sdk)_LIBPATH.$(BUILD_TARGET))\
|
---|
| 1076 | $(SDK_$(sdk)_LIBPATH.$(BUILD_TYPE))\
|
---|
| 1077 | $(SDK_$(sdk)_LIBPATH))\
|
---|
[87] | 1078 | $(TOOL_$(tool)_LIBPATH.$(BUILD_TARGET_CPU))\
|
---|
| 1079 | $(TOOL_$(tool)_LIBPATH.$(BUILD_TARGET_ARCH))\
|
---|
| 1080 | $(TOOL_$(tool)_LIBPATH.$(BUILD_TARGET))\
|
---|
[83] | 1081 | $(TOOL_$(tool)_LIBPATH.$(BUILD_TYPE))\
|
---|
| 1082 | $(TOOL_$(tool)_LIBPATH)\
|
---|
| 1083 | )
|
---|
| 1084 | $(eval dirdep := $(dir $(sys)).dir_created)
|
---|
| 1085 | ## @todo fix dependencies
|
---|
| 1086 | $(eval deps := )
|
---|
| 1087 | #
|
---|
| 1088 | $(eval custom_pre := $(strip $(firstword
|
---|
| 1089 | $($(target)_CUSTOM_PRE.$(BUILD_TARGET).$(BUILD_TYPE))\
|
---|
| 1090 | $($(target)_CUSTOM_PRE.$(BUILD_TARGET))\
|
---|
| 1091 | $($(target)_CUSTOM_PRE.$(BUILD_TYPE))\
|
---|
| 1092 | $($(target)_CUSTOM_PRE)\
|
---|
| 1093 | $(CUSTOM_PRE.$(BUILD_TARGET).$(BUILD_TYPE))\
|
---|
| 1094 | $(CUSTOM_PRE.$(BUILD_TARGET))\
|
---|
| 1095 | $(CUSTOM_PRE.$(BUILD_TYPE))\
|
---|
| 1096 | $(CUSTOM_PRE)\
|
---|
| 1097 | )))
|
---|
| 1098 | $(eval custom_post := $(strip $(firstword
|
---|
| 1099 | $($(target)_CUSTOM_POST.$(BUILD_TARGET).$(BUILD_TYPE))\
|
---|
| 1100 | $($(target)_CUSTOM_POST.$(BUILD_TARGET))\
|
---|
| 1101 | $($(target)_CUSTOM_POST.$(BUILD_TYPE))\
|
---|
| 1102 | $($(target)_CUSTOM_POST)\
|
---|
| 1103 | $(CUSTOM_POST.$(BUILD_TARGET).$(BUILD_TYPE))\
|
---|
| 1104 | $(CUSTOM_POST.$(BUILD_TARGET))\
|
---|
| 1105 | $(CUSTOM_POST.$(BUILD_TYPE))\
|
---|
| 1106 | $(CUSTOM_POST)\
|
---|
| 1107 | )))
|
---|
[120] | 1108 | $(eval othersrc := $(filter-out %.c %.cpp %.cxx %.cc %.s %.S %.asm,$($(target)_SOURCES) $($(target)_SOURCES.$(BUILD_TARGET)) $($(target)_SOURCES.$(BUILD_MODE))))
|
---|
[72] | 1109 |
|
---|
[106] | 1110 | ifndef TOOL_$(tool)_LINK_SYSMOD
|
---|
| 1111 | $$(warning kBuild: TOOL_$(tool)_LINK_SYSMOD is not defined. target=$(target) )
|
---|
| 1112 | $$(warning kBuild: tools: \
|
---|
| 1113 | 1 $($(target)_$(source)TOOL.$(BUILD_TARGET)) \
|
---|
| 1114 | 2 $($(target)_$(source)TOOL) \
|
---|
| 1115 | 3 $($(target)_TOOL.$(BUILD_TARGET)) \
|
---|
| 1116 | 4 $($(target)_TOOL) \
|
---|
| 1117 | 5 $($(source)TOOL) \
|
---|
| 1118 | 6 $($(source)TOOL.$(BUILD_TARGET)) \
|
---|
| 1119 | 7 $(TOOL.$(BUILD_TARGET)) \
|
---|
| 1120 | 8 $(TOOL) )
|
---|
| 1121 | endif
|
---|
| 1122 |
|
---|
[83] | 1123 | $(eval $(TOOL_$(tool)_LINK_SYSMOD))
|
---|
| 1124 |
|
---|
[130] | 1125 | # publish rule (still need work)
|
---|
[131] | 1126 | ifndef $(target)_NOINST
|
---|
| 1127 | $(eval pubsys := $(PATH_BIN)/$(notdir $(sys)))
|
---|
| 1128 | $(pubsys): $(sys) $(dir $(pubsys)).dir_created
|
---|
[130] | 1129 | $(CP) $(sys) $(pubsys)
|
---|
| 1130 |
|
---|
[131] | 1131 | $(eval _SYSMODS += $(pubsys))
|
---|
| 1132 | $(eval _OUT_FILES += $(sys) $(pubsys))
|
---|
[130] | 1133 | else
|
---|
[131] | 1134 | $(eval _SYSMODS += $(sys))
|
---|
| 1135 | $(eval _OUT_FILES += $(sys))
|
---|
[130] | 1136 | endif
|
---|
| 1137 | _OBJS += $(_OBJS_$(target))
|
---|
[83] | 1138 | endef
|
---|
| 1139 |
|
---|
[130] | 1140 | # Process sysmods
|
---|
[83] | 1141 | $(foreach target, $(SYSMODS), $(eval $(def_sysmod)))
|
---|
| 1142 |
|
---|
| 1143 |
|
---|
| 1144 |
|
---|
[72] | 1145 | #
|
---|
| 1146 | # OTHERS
|
---|
| 1147 | #
|
---|
| 1148 |
|
---|
| 1149 |
|
---|
| 1150 |
|
---|
| 1151 | #
|
---|
| 1152 | # DOCS
|
---|
| 1153 | #
|
---|
| 1154 |
|
---|
| 1155 |
|
---|
| 1156 | #
|
---|
| 1157 | # Directories.
|
---|
| 1158 | #
|
---|
[130] | 1159 | _DIRFILES := $(sort $(addsuffix /.dir_created,$(_DIRS)) $(addsuffix .dir_created,$(sort $(dir $(_OUT_FILES) $(_OBJS)))))
|
---|
[72] | 1160 |
|
---|
| 1161 | define def_createdir
|
---|
| 1162 | $(dirfile):
|
---|
[106] | 1163 | $(call MSG_Ltarget,Creating directory $$(@D))
|
---|
[72] | 1164 | $(MKDIR) -p $$(@D)
|
---|
[73] | 1165 | @echo dir_created > $$@
|
---|
[72] | 1166 | endef
|
---|
| 1167 |
|
---|
| 1168 | $(foreach dirfile,$(_DIRFILES),$(eval $(def_createdir)))
|
---|
| 1169 |
|
---|
[75] | 1170 |
|
---|
[72] | 1171 | #
|
---|
[75] | 1172 | # Include dependency files.
|
---|
[72] | 1173 | #
|
---|
[75] | 1174 | $(foreach dep,$(wildcard $(_DEPFILES)),$(eval include $(dep)))
|
---|
[72] | 1175 |
|
---|
[75] | 1176 |
|
---|
| 1177 | #
|
---|
| 1178 | # PASSES (including directory and makefile walking)
|
---|
| 1179 | #
|
---|
| 1180 | # Do all the default passes if it's unspecified.
|
---|
[72] | 1181 |
|
---|
[98] | 1182 | #PASSES ?= needed libraries binaries others publish
|
---|
| 1183 | PASSES ?= libraries binaries
|
---|
| 1184 |
|
---|
[75] | 1185 | ## Proritized list of the default makefile when walking subdirectories.
|
---|
| 1186 | # The user can overload this list.
|
---|
| 1187 | DEFAULT_MAKEFILE ?= Makefile.kmk makefile.kmk Makefile makefile
|
---|
[72] | 1188 |
|
---|
[75] | 1189 | ## Subdir
|
---|
| 1190 | # @param $(pass) Lowercase pass name.
|
---|
| 1191 | # @param $(PASS) Uppercase pass name.
|
---|
| 1192 | # @param $(subdir) Subdirectory
|
---|
| 1193 | # @param $(tag) tag to attach to the rule name.
|
---|
| 1194 | define def_pass_subdir
|
---|
| 1195 | pass_$(pass)$(tag)::
|
---|
| 1196 | $(QUIET)$$(MAKE) -C $(subdir) -f $$(notdir $$(firstword $$(wildcard $$(addprefix $(subdir)/,$$(DEFAULT_MAKEFILE))))) pass_$(pass)
|
---|
| 1197 | endef
|
---|
[72] | 1198 |
|
---|
[75] | 1199 | ## Submakefile
|
---|
| 1200 | # @param $(pass) Lowercase pass name.
|
---|
| 1201 | # @param $(PASS) Uppercase pass name.
|
---|
| 1202 | # @param $(makefile) Makefile.
|
---|
| 1203 | # @param $(tag) tag to attach to the rule name.
|
---|
| 1204 | define def_pass_makefile
|
---|
| 1205 | pass_$(pass)$(tag)::
|
---|
| 1206 | $(QUIET)$$(MAKE) -C $(patsubst %/,%,$(dir $(makefile))) -f $(notdir $(makefile)) pass_$(pass)
|
---|
| 1207 | endef
|
---|
[73] | 1208 |
|
---|
[74] | 1209 |
|
---|
[75] | 1210 | ## Execute a pass.
|
---|
| 1211 | # @param $(pass) Lowercase pass name.
|
---|
| 1212 | # @param $(PASS) Uppercase pass name.
|
---|
| 1213 | define def_pass
|
---|
| 1214 | $(eval SUBDIRS_$(PASS) ?= $(SUBDIRS))
|
---|
| 1215 | $(eval SUBDIRS_AFTER_$(PASS) ?= $(SUBDIRS_AFTER))
|
---|
| 1216 | $(eval MAKEFILES_BEFORE_$(PASS) ?= $(MAKEFILES_BEFORE))
|
---|
| 1217 | $(eval MAKEFILES_AFTER_$(PASS) ?= $(MAKEFILES_AFTER))
|
---|
| 1218 |
|
---|
| 1219 | $(eval tag:=_before)
|
---|
| 1220 | $(foreach subdir,$(SUBDIRS_$(PASS)),$(eval $(def_pass_subdir)))
|
---|
| 1221 | $(foreach makefile,$(MAKEFILES_BEFORE_$(PASS)),$(eval $(def_pass_makefile)))
|
---|
| 1222 |
|
---|
| 1223 | $(eval tag:=_after)
|
---|
| 1224 | $(foreach subdir,$(SUBDIRS_AFTER_$(PASS)),$(eval $(def_pass_subdir)))
|
---|
| 1225 | $(foreach makefile,$(MAKEFILES_AFTER_$(PASS)),$(eval $(def_pass_makefile)))
|
---|
| 1226 |
|
---|
| 1227 | .NOTPARALLEL: pass_$(pass)_before pass_$(pass)_after
|
---|
| 1228 | .PHONY: pass_$(pass) pass_$(pass)_before pass_$(pass)_doit pass_$(pass)_after
|
---|
| 1229 | pass_$(pass): \
|
---|
| 1230 | pass_$(pass)_before \
|
---|
| 1231 | pass_$(pass)_doit \
|
---|
| 1232 | pass_$(pass)_after
|
---|
| 1233 |
|
---|
| 1234 | endef
|
---|
| 1235 |
|
---|
[76] | 1236 |
|
---|
[75] | 1237 | ## PASS: needed
|
---|
| 1238 | # This pass builds targets which are required for building the rest.
|
---|
| 1239 | pass_needed_doit: $(_NEEDEDS)
|
---|
| 1240 | pass := needed
|
---|
| 1241 | PASS := NEEDED
|
---|
| 1242 | $(eval $(def_pass))
|
---|
| 1243 |
|
---|
| 1244 | ## PASS: libraries
|
---|
| 1245 | # This pass builds library targets.
|
---|
| 1246 | pass_libraries_doit: $(_LIBS) $(_IMPORT_LIBS) $(_OTHER_LIBRARIES)
|
---|
| 1247 | pass := libraries
|
---|
| 1248 | PASS := LIBRARIES
|
---|
| 1249 | $(eval $(def_pass))
|
---|
| 1250 |
|
---|
| 1251 | ## PASS: binaries
|
---|
[83] | 1252 | # This pass builds binary targets, i.e. programs, dlls, system modules and stuff.
|
---|
| 1253 | pass_binaries_doit: $(_DLLS) $(_EXES) $(_SYSMODS) $(_OTHER_BINARIES)
|
---|
[75] | 1254 | pass := binaries
|
---|
| 1255 | PASS := BINARIES
|
---|
| 1256 | $(eval $(def_pass))
|
---|
| 1257 |
|
---|
| 1258 | ## PASS: others
|
---|
[83] | 1259 | # This pass builds other targets.
|
---|
[75] | 1260 | pass_others_doit: $(_OTHERS)
|
---|
| 1261 | pass := others
|
---|
| 1262 | PASS := OTHERS
|
---|
| 1263 | $(eval $(def_pass))
|
---|
| 1264 |
|
---|
| 1265 | ## PASS: publish
|
---|
| 1266 | # This pass installs the built entities to a sandbox area.
|
---|
| 1267 | pass_publish_doit: publish
|
---|
| 1268 | publish::
|
---|
| 1269 | pass := publish
|
---|
| 1270 | PASS := PUBLISH
|
---|
[76] | 1271 | # $(sort).. not nice.
|
---|
[75] | 1272 | SUBDIRS_PUBLISH ?= $(sort $(SUBDIRS) $(SUBDIRS_LIBRARIES) $(SUBDIRS_BINARIES) $(SUBDIRS_OTHERS))
|
---|
| 1273 | SUBDIRS_AFTER_PUBLISH ?= $(sort $(SUBDIRS_AFTER) $(SUBDIRS_AFTER_LIBRARIES) $(SUBDIRS_AFTER_BINARIES) $(SUBDIRS_AFTER_OTHERS))
|
---|
| 1274 | MAKEFILES_BEFORE_PUBLISH?= $(sort $(MAKEFILES_BEFORE) $(MAKEFILES_BEFORE_LIBRARIES) $(MAKEFILES_BEFORE_BINARIES) $(MAKEFILES_BEFORE_OTHERS))
|
---|
| 1275 | MAKEFILES_AFTER_PUBLISH ?= $(sort $(MAKEFILES_AFTER) $(MAKEFILES_AFTER_LIBRARIES) $(MAKEFILES_AFTER_BINARIES) $(MAKEFILES_AFTER_OTHERS))
|
---|
| 1276 | $(eval $(def_pass))
|
---|
| 1277 |
|
---|
| 1278 | ## PASS: packing
|
---|
| 1279 | # This pass processes custom packing rules.
|
---|
| 1280 | pass_packing_doit: packing
|
---|
| 1281 | packing::
|
---|
| 1282 | pass := packing
|
---|
| 1283 | PASS := PACKING
|
---|
| 1284 | $(eval $(def_pass))
|
---|
| 1285 |
|
---|
| 1286 | ## PASS: clean
|
---|
| 1287 | # This pass removes all generated files.
|
---|
| 1288 | pass_clean_doit:
|
---|
| 1289 | $(RM) -f $(_OUT_FILES) $(_OBJS) $(_DEPFILES) $(_DIRFILES)
|
---|
| 1290 | pass := clean
|
---|
| 1291 | PASS := CLEAN
|
---|
| 1292 | $(eval $(def_pass))
|
---|
| 1293 | clean: pass_clean
|
---|
| 1294 |
|
---|
| 1295 | ## PASS: nothing
|
---|
| 1296 | # This pass just walks the tree.
|
---|
| 1297 | pass_nothing_doit:
|
---|
[106] | 1298 | $(call MSG_Ltarget,Did nothing in $(CURDIR))
|
---|
[75] | 1299 | pass := nothing
|
---|
| 1300 | PASS := NOTHING
|
---|
| 1301 | $(eval $(def_pass))
|
---|
| 1302 | nothing: pass_nothing
|
---|
| 1303 |
|
---|
[78] | 1304 |
|
---|
| 1305 |
|
---|
[75] | 1306 | #
|
---|
| 1307 | # THE MAIN RULES
|
---|
| 1308 | #
|
---|
| 1309 | all_recursive: $(foreach pass,$(PASSES),pass_$(pass))
|
---|
| 1310 |
|
---|
[130] | 1311 | rebuild: clean
|
---|
[120] | 1312 | $(MAKE) -f $(firstword $(MAKEFILE_LIST)) all_recursive
|
---|
[78] | 1313 |
|
---|
| 1314 |
|
---|
[75] | 1315 | # misc shortcuts.
|
---|
| 1316 | target: needed libraries binaries others
|
---|
| 1317 | objects: $(_OBJS)
|
---|
| 1318 | programs: $(_EXES)
|
---|
| 1319 | dlls: $(_DLLS)
|
---|
[83] | 1320 | sysmods: $(_SYSMODS)
|
---|
[75] | 1321 |
|
---|
| 1322 |
|
---|
[72] | 1323 | # end-of-file-content
|
---|
[106] | 1324 | __footer_kmk__ := target
|
---|
[72] | 1325 | endif # __footer_kmk__
|
---|