summaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorMasahiro Yamada <yamada.masahiro@socionext.com>2019-02-22 02:40:09 -0500
committerMasahiro Yamada <yamada.masahiro@socionext.com>2019-02-27 07:43:31 -0500
commit6b12de69ad82ceed317bdbae9ede1a256f84bf4e (patch)
treee4c4d7bd1268398b17966407d3675ebfd46dc13a /Makefile
parentb999923c29d69d795229e5bf1b49e1266491ff35 (diff)
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: Masahiro Yamada <yamada.masahiro@socionext.com>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile47
1 files changed, 18 insertions, 29 deletions
diff --git a/Makefile b/Makefile
index 418d205581d5..14dae59273ec 100644
--- a/Makefile
+++ b/Makefile
@@ -219,7 +219,7 @@ objtree := .
219src := $(srctree) 219src := $(srctree)
220obj := $(objtree) 220obj := $(objtree)
221 221
222VPATH := $(srctree)$(if $(KBUILD_EXTMOD),:$(KBUILD_EXTMOD)) 222VPATH := $(srctree)
223 223
224export srctree objtree VPATH 224export srctree objtree VPATH
225 225
@@ -1699,31 +1699,23 @@ tools/%: FORCE
1699# target-dir => where to store outputfile 1699# target-dir => where to store outputfile
1700# build-dir => directory in kernel source tree to use 1700# build-dir => directory in kernel source tree to use
1701 1701
1702ifeq ($(KBUILD_EXTMOD),) 1702build-target = $(if $(KBUILD_EXTMOD), $(KBUILD_EXTMOD)/)$@
1703 build-dir = $(patsubst %/,%,$(dir $@)) 1703build-dir = $(patsubst %/,%,$(dir $(build-target)))
1704 target-dir = $(dir $@) 1704
1705else 1705%.i: prepare FORCE
1706 zap-slash=$(filter-out .,$(patsubst %/,%,$(dir $@))) 1706 $(Q)$(MAKE) $(build)=$(build-dir) $(build-target)
1707 build-dir = $(KBUILD_EXTMOD)$(if $(zap-slash),/$(zap-slash)) 1707%.ll: prepare FORCE
1708 target-dir = $(if $(KBUILD_EXTMOD),$(dir $<),$(dir $@)) 1708 $(Q)$(MAKE) $(build)=$(build-dir) $(build-target)
1709endif 1709%.lst: prepare FORCE
1710 1710 $(Q)$(MAKE) $(build)=$(build-dir) $(build-target)
1711%.s: %.c prepare FORCE 1711%.o: prepare FORCE
1712 $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) 1712 $(Q)$(MAKE) $(build)=$(build-dir) $(build-target)
1713%.i: %.c prepare FORCE 1713%.s: prepare FORCE
1714 $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) 1714 $(Q)$(MAKE) $(build)=$(build-dir) $(build-target)
1715%.o: %.c prepare FORCE 1715%.symtypes: prepare FORCE
1716 $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) 1716 $(Q)$(MAKE) $(build)=$(build-dir) $(build-target)
1717%.lst: %.c prepare FORCE 1717%.ko: %.o
1718 $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) 1718 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
1719%.s: %.S prepare FORCE
1720 $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
1721%.o: %.S prepare FORCE
1722 $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
1723%.symtypes: %.c prepare FORCE
1724 $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
1725%.ll: %.c prepare FORCE
1726 $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
1727 1719
1728# Modules 1720# Modules
1729PHONY += / 1721PHONY += /
@@ -1733,9 +1725,6 @@ PHONY += /
1733Documentation/ samples/: headers_install 1725Documentation/ samples/: headers_install
1734%/: prepare FORCE 1726%/: prepare FORCE
1735 $(Q)$(MAKE) KBUILD_MODULES=1 $(build)=$(build-dir) 1727 $(Q)$(MAKE) KBUILD_MODULES=1 $(build)=$(build-dir)
1736%.ko: prepare FORCE
1737 $(Q)$(MAKE) $(build)=$(build-dir) $(@:.ko=.o)
1738 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
1739 1728
1740# FIXME Should go into a make.lib or something 1729# FIXME Should go into a make.lib or something
1741# =========================================================================== 1730# ===========================================================================