docsrc: build Documentation/ sources
Currently source files in the Documentation/ sub-dir can easily bit-rot since they are not generally buildable, either because they are hidden in text files or because there are no Makefile rules for them. This needs to be fixed so that the source files remain usable and good examples of code instead of bad examples. Add the ability to build source files that are in the Documentation/ dir. Add to Kconfig as "BUILD_DOCSRC" config symbol. Use "CONFIG_BUILD_DOCSRC=1 make ..." to build objects from the Documentation/ sources. Or enable BUILD_DOCSRC in the *config system. However, this symbol depends on HEADERS_CHECK since the header files need to be installed (for userspace builds). Built (using cross-tools) for x86-64, i386, alpha, ia64, sparc32, sparc64, powerpc, sh, m68k, & mips. Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com> Reviewed-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
bc2aa80e18
commit
3794f3e812
15 changed files with 118 additions and 1 deletions
|
@ -102,6 +102,13 @@ C-procfs-example = procfs_example.xml
|
||||||
C-procfs-example2 = $(addprefix $(obj)/,$(C-procfs-example))
|
C-procfs-example2 = $(addprefix $(obj)/,$(C-procfs-example))
|
||||||
$(obj)/procfs-guide.xml: $(C-procfs-example2)
|
$(obj)/procfs-guide.xml: $(C-procfs-example2)
|
||||||
|
|
||||||
|
# List of programs to build
|
||||||
|
##oops, this is a kernel module::hostprogs-y := procfs_example
|
||||||
|
obj-m += procfs_example.o
|
||||||
|
|
||||||
|
# Tell kbuild to always build the programs
|
||||||
|
always := $(hostprogs-y)
|
||||||
|
|
||||||
notfoundtemplate = echo "*** You have to install docbook-utils or xmlto ***"; \
|
notfoundtemplate = echo "*** You have to install docbook-utils or xmlto ***"; \
|
||||||
exit 1
|
exit 1
|
||||||
db2xtemplate = db2TYPE -o $(dir $@) $<
|
db2xtemplate = db2TYPE -o $(dir $@) $<
|
||||||
|
|
3
Documentation/Makefile
Normal file
3
Documentation/Makefile
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
obj-m := DocBook/ accounting/ auxdisplay/ connector/ \
|
||||||
|
filesystems/configfs/ ia64/ networking/ \
|
||||||
|
pcmcia/ spi/ video4linux/ vm/ watchdog/src/
|
10
Documentation/accounting/Makefile
Normal file
10
Documentation/accounting/Makefile
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
# kbuild trick to avoid linker error. Can be omitted if a module is built.
|
||||||
|
obj- := dummy.o
|
||||||
|
|
||||||
|
# List of programs to build
|
||||||
|
hostprogs-y := getdelays
|
||||||
|
|
||||||
|
# Tell kbuild to always build the programs
|
||||||
|
always := $(hostprogs-y)
|
||||||
|
|
||||||
|
HOSTCFLAGS_getdelays.o += -I$(objtree)/usr/include
|
10
Documentation/auxdisplay/Makefile
Normal file
10
Documentation/auxdisplay/Makefile
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
# kbuild trick to avoid linker error. Can be omitted if a module is built.
|
||||||
|
obj- := dummy.o
|
||||||
|
|
||||||
|
# List of programs to build
|
||||||
|
hostprogs-y := cfag12864b-example
|
||||||
|
|
||||||
|
# Tell kbuild to always build the programs
|
||||||
|
always := $(hostprogs-y)
|
||||||
|
|
||||||
|
HOSTCFLAGS_cfag12864b-example.o += -I$(objtree)/usr/include
|
11
Documentation/connector/Makefile
Normal file
11
Documentation/connector/Makefile
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
ifneq ($(CONFIG_CONNECTOR),)
|
||||||
|
obj-m += cn_test.o
|
||||||
|
endif
|
||||||
|
|
||||||
|
# List of programs to build
|
||||||
|
hostprogs-y := ucon
|
||||||
|
|
||||||
|
# Tell kbuild to always build the programs
|
||||||
|
always := $(hostprogs-y)
|
||||||
|
|
||||||
|
HOSTCFLAGS_ucon.o += -I$(objtree)/usr/include
|
3
Documentation/filesystems/configfs/Makefile
Normal file
3
Documentation/filesystems/configfs/Makefile
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
ifneq ($(CONFIG_CONFIGFS_FS),)
|
||||||
|
obj-m += configfs_example_explicit.o configfs_example_macros.o
|
||||||
|
endif
|
8
Documentation/ia64/Makefile
Normal file
8
Documentation/ia64/Makefile
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
# kbuild trick to avoid linker error. Can be omitted if a module is built.
|
||||||
|
obj- := dummy.o
|
||||||
|
|
||||||
|
# List of programs to build
|
||||||
|
hostprogs-y := aliasing-test
|
||||||
|
|
||||||
|
# Tell kbuild to always build the programs
|
||||||
|
always := $(hostprogs-y)
|
8
Documentation/networking/Makefile
Normal file
8
Documentation/networking/Makefile
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
# kbuild trick to avoid linker error. Can be omitted if a module is built.
|
||||||
|
obj- := dummy.o
|
||||||
|
|
||||||
|
# List of programs to build
|
||||||
|
hostprogs-y := ifenslave
|
||||||
|
|
||||||
|
# Tell kbuild to always build the programs
|
||||||
|
always := $(hostprogs-y)
|
10
Documentation/pcmcia/Makefile
Normal file
10
Documentation/pcmcia/Makefile
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
# kbuild trick to avoid linker error. Can be omitted if a module is built.
|
||||||
|
obj- := dummy.o
|
||||||
|
|
||||||
|
# List of programs to build
|
||||||
|
hostprogs-y := crc32hash
|
||||||
|
|
||||||
|
# Tell kbuild to always build the programs
|
||||||
|
always := $(hostprogs-y)
|
||||||
|
|
||||||
|
HOSTCFLAGS_crc32hash.o += -I$(objtree)/usr/include
|
11
Documentation/spi/Makefile
Normal file
11
Documentation/spi/Makefile
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
# kbuild trick to avoid linker error. Can be omitted if a module is built.
|
||||||
|
obj- := dummy.o
|
||||||
|
|
||||||
|
# List of programs to build
|
||||||
|
hostprogs-y := spidev_test spidev_fdx
|
||||||
|
|
||||||
|
# Tell kbuild to always build the programs
|
||||||
|
always := $(hostprogs-y)
|
||||||
|
|
||||||
|
HOSTCFLAGS_spidev_test.o += -I$(objtree)/usr/include
|
||||||
|
HOSTCFLAGS_spidev_fdx.o += -I$(objtree)/usr/include
|
8
Documentation/video4linux/Makefile
Normal file
8
Documentation/video4linux/Makefile
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
# kbuild trick to avoid linker error. Can be omitted if a module is built.
|
||||||
|
obj- := dummy.o
|
||||||
|
|
||||||
|
# List of programs to build
|
||||||
|
hostprogs-y := v4lgrab
|
||||||
|
|
||||||
|
# Tell kbuild to always build the programs
|
||||||
|
always := $(hostprogs-y)
|
8
Documentation/vm/Makefile
Normal file
8
Documentation/vm/Makefile
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
# kbuild trick to avoid linker error. Can be omitted if a module is built.
|
||||||
|
obj- := dummy.o
|
||||||
|
|
||||||
|
# List of programs to build
|
||||||
|
hostprogs-y := slabinfo
|
||||||
|
|
||||||
|
# Tell kbuild to always build the programs
|
||||||
|
always := $(hostprogs-y)
|
8
Documentation/watchdog/src/Makefile
Normal file
8
Documentation/watchdog/src/Makefile
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
# kbuild trick to avoid linker error. Can be omitted if a module is built.
|
||||||
|
obj- := dummy.o
|
||||||
|
|
||||||
|
# List of programs to build
|
||||||
|
hostprogs-y := watchdog-simple watchdog-test
|
||||||
|
|
||||||
|
# Tell kbuild to always build the programs
|
||||||
|
always := $(hostprogs-y)
|
5
Makefile
5
Makefile
|
@ -821,6 +821,9 @@ ifdef CONFIG_HEADERS_CHECK
|
||||||
endif
|
endif
|
||||||
ifdef CONFIG_SAMPLES
|
ifdef CONFIG_SAMPLES
|
||||||
$(Q)$(MAKE) $(build)=samples
|
$(Q)$(MAKE) $(build)=samples
|
||||||
|
endif
|
||||||
|
ifdef CONFIG_BUILD_DOCSRC
|
||||||
|
$(Q)$(MAKE) $(build)=Documentation
|
||||||
endif
|
endif
|
||||||
$(call vmlinux-modpost)
|
$(call vmlinux-modpost)
|
||||||
$(call if_changed_rule,vmlinux__)
|
$(call if_changed_rule,vmlinux__)
|
||||||
|
@ -1166,7 +1169,7 @@ MRPROPER_FILES += .config .config.old include/asm .version .old_version \
|
||||||
#
|
#
|
||||||
clean: rm-dirs := $(CLEAN_DIRS)
|
clean: rm-dirs := $(CLEAN_DIRS)
|
||||||
clean: rm-files := $(CLEAN_FILES)
|
clean: rm-files := $(CLEAN_FILES)
|
||||||
clean-dirs := $(addprefix _clean_,$(srctree) $(vmlinux-alldirs))
|
clean-dirs := $(addprefix _clean_,$(srctree) $(vmlinux-alldirs) Documentation)
|
||||||
|
|
||||||
PHONY += $(clean-dirs) clean archclean
|
PHONY += $(clean-dirs) clean archclean
|
||||||
$(clean-dirs):
|
$(clean-dirs):
|
||||||
|
|
|
@ -735,6 +735,15 @@ config FIREWIRE_OHCI_REMOTE_DMA
|
||||||
|
|
||||||
If unsure, say N.
|
If unsure, say N.
|
||||||
|
|
||||||
|
menuconfig BUILD_DOCSRC
|
||||||
|
bool "Build targets in Documentation/ tree"
|
||||||
|
depends on HEADERS_CHECK
|
||||||
|
help
|
||||||
|
This option attempts to build objects from the source files in the
|
||||||
|
kernel Documentation/ tree.
|
||||||
|
|
||||||
|
Say N if you are unsure.
|
||||||
|
|
||||||
source "samples/Kconfig"
|
source "samples/Kconfig"
|
||||||
|
|
||||||
source "lib/Kconfig.kgdb"
|
source "lib/Kconfig.kgdb"
|
||||||
|
|
Loading…
Reference in a new issue