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