diff options
author | Masahiro Yamada <yamada.m@jp.panasonic.com> | 2014-02-24 11:12:22 +0900 |
---|---|---|
committer | Tom Rini <trini@ti.com> | 2014-02-25 11:01:29 -0500 |
commit | 886d86e87d991dabcffdb98f71496b59c203e9cd (patch) | |
tree | 45899d092a8de3c61d99abde10131f02581fa581 | |
parent | 630d23455bf01ef92dba41589fdb338984717f2f (diff) | |
download | u-boot-imx-886d86e87d991dabcffdb98f71496b59c203e9cd.zip u-boot-imx-886d86e87d991dabcffdb98f71496b59c203e9cd.tar.gz u-boot-imx-886d86e87d991dabcffdb98f71496b59c203e9cd.tar.bz2 |
kbuild: support building signle targets
Import build rules of single targets from Linux 3.13.
Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
-rw-r--r-- | Makefile | 52 |
1 files changed, 52 insertions, 0 deletions
@@ -1267,6 +1267,58 @@ scripts: ; endif #ifeq ($(config-targets),1) endif #ifeq ($(mixed-targets),1) +# Single targets +# --------------------------------------------------------------------------- +# Single targets are compatible with: +# - build with mixed source and output +# - build with separate output dir 'make O=...' +# - external modules +# +# target-dir => where to store outputfile +# build-dir => directory in kernel source tree to use + +ifeq ($(KBUILD_EXTMOD),) + build-dir = $(patsubst %/,%,$(dir $@)) + target-dir = $(dir $@) +else + zap-slash=$(filter-out .,$(patsubst %/,%,$(dir $@))) + build-dir = $(KBUILD_EXTMOD)$(if $(zap-slash),/$(zap-slash)) + target-dir = $(if $(KBUILD_EXTMOD),$(dir $<),$(dir $@)) +endif + +%.s: %.c prepare scripts FORCE + $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) +%.i: %.c prepare scripts FORCE + $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) +%.o: %.c prepare scripts FORCE + $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) +%.lst: %.c prepare scripts FORCE + $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) +%.s: %.S prepare scripts FORCE + $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) +%.o: %.S prepare scripts FORCE + $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) +%.symtypes: %.c prepare scripts FORCE + $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) + +# Modules +/: prepare scripts FORCE + $(cmd_crmodverdir) + $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \ + $(build)=$(build-dir) +%/: prepare scripts FORCE + $(cmd_crmodverdir) + $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \ + $(build)=$(build-dir) +%.ko: prepare scripts FORCE + $(cmd_crmodverdir) + $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \ + $(build)=$(build-dir) $(@:.ko=.o) + $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost + +# FIXME Should go into a make.lib or something +# =========================================================================== + quiet_cmd_rmdirs = $(if $(wildcard $(rm-dirs)),CLEAN $(wildcard $(rm-dirs))) cmd_rmdirs = rm -rf $(rm-dirs) |