Commit 6b12de69 authored by Masahiro Yamada's avatar Masahiro Yamada

kbuild: simplify single target rules

The dependency will be checked anyway after Kbuild descends into a
sub-directory. Skip object/source dependency checks in top Makefile.

VPATH can be simpler since the top Makefile no longer checks the
presence of the source file, which is located in in the external
module directory.

One good thing is, it can compile an object from a generated source
file.

  $ make crypto/rsapubkey.asn1.o
    ...
  ASN.1   crypto/rsapubkey.asn1.c
  CC      crypto/rsapubkey.asn1.o
Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
parent b999923c
...@@ -219,7 +219,7 @@ objtree := . ...@@ -219,7 +219,7 @@ objtree := .
src := $(srctree) src := $(srctree)
obj := $(objtree) obj := $(objtree)
VPATH := $(srctree)$(if $(KBUILD_EXTMOD),:$(KBUILD_EXTMOD)) VPATH := $(srctree)
export srctree objtree VPATH export srctree objtree VPATH
...@@ -1699,31 +1699,23 @@ tools/%: FORCE ...@@ -1699,31 +1699,23 @@ tools/%: FORCE
# target-dir => where to store outputfile # target-dir => where to store outputfile
# build-dir => directory in kernel source tree to use # build-dir => directory in kernel source tree to use
ifeq ($(KBUILD_EXTMOD),) build-target = $(if $(KBUILD_EXTMOD), $(KBUILD_EXTMOD)/)$@
build-dir = $(patsubst %/,%,$(dir $@)) build-dir = $(patsubst %/,%,$(dir $(build-target)))
target-dir = $(dir $@)
else %.i: prepare FORCE
zap-slash=$(filter-out .,$(patsubst %/,%,$(dir $@))) $(Q)$(MAKE) $(build)=$(build-dir) $(build-target)
build-dir = $(KBUILD_EXTMOD)$(if $(zap-slash),/$(zap-slash)) %.ll: prepare FORCE
target-dir = $(if $(KBUILD_EXTMOD),$(dir $<),$(dir $@)) $(Q)$(MAKE) $(build)=$(build-dir) $(build-target)
endif %.lst: prepare FORCE
$(Q)$(MAKE) $(build)=$(build-dir) $(build-target)
%.s: %.c prepare FORCE %.o: prepare FORCE
$(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) $(Q)$(MAKE) $(build)=$(build-dir) $(build-target)
%.i: %.c prepare FORCE %.s: prepare FORCE
$(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) $(Q)$(MAKE) $(build)=$(build-dir) $(build-target)
%.o: %.c prepare FORCE %.symtypes: prepare FORCE
$(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) $(Q)$(MAKE) $(build)=$(build-dir) $(build-target)
%.lst: %.c prepare FORCE %.ko: %.o
$(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
%.s: %.S prepare FORCE
$(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
%.o: %.S prepare FORCE
$(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
%.symtypes: %.c prepare FORCE
$(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
%.ll: %.c prepare FORCE
$(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
# Modules # Modules
PHONY += / PHONY += /
...@@ -1733,9 +1725,6 @@ PHONY += / ...@@ -1733,9 +1725,6 @@ PHONY += /
Documentation/ samples/: headers_install Documentation/ samples/: headers_install
%/: prepare FORCE %/: prepare FORCE
$(Q)$(MAKE) KBUILD_MODULES=1 $(build)=$(build-dir) $(Q)$(MAKE) KBUILD_MODULES=1 $(build)=$(build-dir)
%.ko: prepare FORCE
$(Q)$(MAKE) $(build)=$(build-dir) $(@:.ko=.o)
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
# FIXME Should go into a make.lib or something # FIXME Should go into a make.lib or something
# =========================================================================== # ===========================================================================
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment