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>
This commit is contained in:
parent
630d23455b
commit
886d86e87d
52
Makefile
52
Makefile
@ -1267,6 +1267,58 @@ scripts: ;
|
|||||||
endif #ifeq ($(config-targets),1)
|
endif #ifeq ($(config-targets),1)
|
||||||
endif #ifeq ($(mixed-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)))
|
quiet_cmd_rmdirs = $(if $(wildcard $(rm-dirs)),CLEAN $(wildcard $(rm-dirs)))
|
||||||
cmd_rmdirs = rm -rf $(rm-dirs)
|
cmd_rmdirs = rm -rf $(rm-dirs)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user