Commit b003d770 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'kbuild' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild

Pull kbuild changes from Michal Marek:
 - cleanups in the main Makefiles and Documentation/DocBook/Makefile
 - make O=...  directory is automatically created if needed
 - mrproper/distclean removes the old include/linux/version.h to make
   life easier when bisecting across the commit that moved the version.h
   file

* 'kbuild' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild:
  kbuild: docbook: fix the include error when executing "make help"
  kbuild: create a build directory automatically for out-of-tree build
  kbuild: remove redundant '.*.cmd' pattern from make distclean
  kbuild: move "quote" to Kbuild.include to be consistent
  kbuild: docbook: use $(obj) and $(src) rather than specific path
  kbuild: unconditionally clobber include/linux/version.h on distclean
  kbuild: docbook: specify KERNELDOC dependency correctly
  kbuild: docbook: include cmd files more simply
  kbuild: specify build_docproc as a phony target
parents 3573d386 b12f7374
...@@ -16,7 +16,7 @@ DOCBOOKS := z8530book.xml device-drivers.xml \ ...@@ -16,7 +16,7 @@ DOCBOOKS := z8530book.xml device-drivers.xml \
alsa-driver-api.xml writing-an-alsa-driver.xml \ alsa-driver-api.xml writing-an-alsa-driver.xml \
tracepoint.xml drm.xml media_api.xml w1.xml tracepoint.xml drm.xml media_api.xml w1.xml
include $(srctree)/Documentation/DocBook/media/Makefile include Documentation/DocBook/media/Makefile
### ###
# The build process is as follows (targets): # The build process is as follows (targets):
...@@ -36,6 +36,7 @@ PS_METHOD = $(prefer-db2x) ...@@ -36,6 +36,7 @@ PS_METHOD = $(prefer-db2x)
# The targets that may be used. # The targets that may be used.
PHONY += xmldocs sgmldocs psdocs pdfdocs htmldocs mandocs installmandocs cleandocs PHONY += xmldocs sgmldocs psdocs pdfdocs htmldocs mandocs installmandocs cleandocs
targets += $(DOCBOOKS)
BOOKS := $(addprefix $(obj)/,$(DOCBOOKS)) BOOKS := $(addprefix $(obj)/,$(DOCBOOKS))
xmldocs: $(BOOKS) xmldocs: $(BOOKS)
sgmldocs: xmldocs sgmldocs: xmldocs
...@@ -58,14 +59,14 @@ mandocs: $(MAN) ...@@ -58,14 +59,14 @@ mandocs: $(MAN)
installmandocs: mandocs installmandocs: mandocs
mkdir -p /usr/local/man/man9/ mkdir -p /usr/local/man/man9/
install Documentation/DocBook/man/*.9.gz /usr/local/man/man9/ install $(obj)/man/*.9.gz /usr/local/man/man9/
### ###
#External programs used #External programs used
KERNELDOC = $(srctree)/scripts/kernel-doc KERNELDOC = $(srctree)/scripts/kernel-doc
DOCPROC = $(objtree)/scripts/docproc DOCPROC = $(objtree)/scripts/docproc
XMLTOFLAGS = -m $(srctree)/Documentation/DocBook/stylesheet.xsl XMLTOFLAGS = -m $(srctree)/$(src)/stylesheet.xsl
XMLTOFLAGS += --skip-validation XMLTOFLAGS += --skip-validation
### ###
...@@ -87,21 +88,9 @@ define rule_docproc ...@@ -87,21 +88,9 @@ define rule_docproc
) > $(dir $@).$(notdir $@).cmd ) > $(dir $@).$(notdir $@).cmd
endef endef
%.xml: %.tmpl FORCE %.xml: %.tmpl $(KERNELDOC) $(DOCPROC) FORCE
$(call if_changed_rule,docproc) $(call if_changed_rule,docproc)
###
#Read in all saved dependency files
cmd_files := $(wildcard $(foreach f,$(BOOKS),$(dir $(f)).$(notdir $(f)).cmd))
ifneq ($(cmd_files),)
include $(cmd_files)
endif
###
# Changes in kernel-doc force a rebuild of all documentation
$(BOOKS): $(KERNELDOC)
# Tell kbuild to always build the programs # Tell kbuild to always build the programs
always := $(hostprogs-y) always := $(hostprogs-y)
...@@ -139,7 +128,7 @@ quiet_cmd_db2pdf = PDF $@ ...@@ -139,7 +128,7 @@ quiet_cmd_db2pdf = PDF $@
index = index.html index = index.html
main_idx = Documentation/DocBook/$(index) main_idx = $(obj)/$(index)
build_main_index = rm -rf $(main_idx); \ build_main_index = rm -rf $(main_idx); \
echo '<h1>Linux Kernel HTML Documentation</h1>' >> $(main_idx) && \ echo '<h1>Linux Kernel HTML Documentation</h1>' >> $(main_idx) && \
echo '<h2>Kernel Version: $(KERNELVERSION)</h2>' >> $(main_idx) && \ echo '<h2>Kernel Version: $(KERNELVERSION)</h2>' >> $(main_idx) && \
......
...@@ -120,9 +120,10 @@ ifneq ($(KBUILD_OUTPUT),) ...@@ -120,9 +120,10 @@ ifneq ($(KBUILD_OUTPUT),)
# Invoke a second make in the output directory, passing relevant variables # Invoke a second make in the output directory, passing relevant variables
# check that the output directory actually exists # check that the output directory actually exists
saved-output := $(KBUILD_OUTPUT) saved-output := $(KBUILD_OUTPUT)
KBUILD_OUTPUT := $(shell cd $(KBUILD_OUTPUT) && /bin/pwd) KBUILD_OUTPUT := $(shell mkdir -p $(KBUILD_OUTPUT) && cd $(KBUILD_OUTPUT) \
&& /bin/pwd)
$(if $(KBUILD_OUTPUT),, \ $(if $(KBUILD_OUTPUT),, \
$(error output directory "$(saved-output)" does not exist)) $(error failed to create output directory "$(saved-output)"))
PHONY += $(MAKECMDGOALS) sub-make PHONY += $(MAKECMDGOALS) sub-make
...@@ -1079,7 +1080,7 @@ MRPROPER_FILES += .config .config.old .version .old_version $(version_h) \ ...@@ -1079,7 +1080,7 @@ MRPROPER_FILES += .config .config.old .version .old_version $(version_h) \
Module.symvers tags TAGS cscope* GPATH GTAGS GRTAGS GSYMS \ Module.symvers tags TAGS cscope* GPATH GTAGS GRTAGS GSYMS \
signing_key.priv signing_key.x509 x509.genkey \ signing_key.priv signing_key.x509 x509.genkey \
extra_certificates signing_key.x509.keyid \ extra_certificates signing_key.x509.keyid \
signing_key.x509.signer signing_key.x509.signer include/linux/version.h
# clean - Delete most, but leave enough to build external modules # clean - Delete most, but leave enough to build external modules
# #
...@@ -1118,8 +1119,7 @@ distclean: mrproper ...@@ -1118,8 +1119,7 @@ distclean: mrproper
@find $(srctree) $(RCS_FIND_IGNORE) \ @find $(srctree) $(RCS_FIND_IGNORE) \
\( -name '*.orig' -o -name '*.rej' -o -name '*~' \ \( -name '*.orig' -o -name '*.rej' -o -name '*~' \
-o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \ -o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \
-o -name '.*.rej' \ -o -name '.*.rej' -o -name '*%' -o -name 'core' \) \
-o -name '*%' -o -name '.*.cmd' -o -name 'core' \) \
-type f -print | xargs rm -f -type f -print | xargs rm -f
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
# Convenient variables # Convenient variables
comma := , comma := ,
quote := "
squote := ' squote := '
empty := empty :=
space := $(empty) $(empty) space := $(empty) $(empty)
......
...@@ -27,10 +27,10 @@ always := $(hostprogs-y) $(hostprogs-m) ...@@ -27,10 +27,10 @@ always := $(hostprogs-y) $(hostprogs-m)
hostprogs-y += unifdef docproc hostprogs-y += unifdef docproc
# These targets are used internally to avoid "is up to date" messages # These targets are used internally to avoid "is up to date" messages
PHONY += build_unifdef PHONY += build_unifdef build_docproc
build_unifdef: scripts/unifdef FORCE build_unifdef: $(obj)/unifdef
@: @:
build_docproc: scripts/docproc FORCE build_docproc: $(obj)/docproc
@: @:
subdir-$(CONFIG_MODVERSIONS) += genksyms subdir-$(CONFIG_MODVERSIONS) += genksyms
......
...@@ -380,7 +380,3 @@ quiet_cmd_xzmisc = XZMISC $@ ...@@ -380,7 +380,3 @@ quiet_cmd_xzmisc = XZMISC $@
cmd_xzmisc = (cat $(filter-out FORCE,$^) | \ cmd_xzmisc = (cat $(filter-out FORCE,$^) | \
xz --check=crc32 --lzma2=dict=1MiB) > $@ || \ xz --check=crc32 --lzma2=dict=1MiB) > $@ || \
(rm -f $@ ; false) (rm -f $@ ; false)
# misc stuff
# ---------------------------------------------------------------------------
quote:="
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