diff options
author | Randy Dunlap <randy.dunlap@oracle.com> | 2008-08-12 18:09:06 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-08-12 19:07:30 -0400 |
commit | 3794f3e812ef707a4f7931742274d1d0ca6597b4 (patch) | |
tree | 9a5373fa2bbcfc1626bb666d2c895e2620f7a3b3 | |
parent | bc2aa80e18a1b43ea2b8066500006b729c4ba4a7 (diff) |
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>
-rw-r--r-- | Documentation/DocBook/Makefile | 7 | ||||
-rw-r--r-- | Documentation/Makefile | 3 | ||||
-rw-r--r-- | Documentation/accounting/Makefile | 10 | ||||
-rw-r--r-- | Documentation/auxdisplay/Makefile | 10 | ||||
-rw-r--r-- | Documentation/connector/Makefile | 11 | ||||
-rw-r--r-- | Documentation/filesystems/configfs/Makefile | 3 | ||||
-rw-r--r-- | Documentation/ia64/Makefile | 8 | ||||
-rw-r--r-- | Documentation/networking/Makefile | 8 | ||||
-rw-r--r-- | Documentation/pcmcia/Makefile | 10 | ||||
-rw-r--r-- | Documentation/spi/Makefile | 11 | ||||
-rw-r--r-- | Documentation/video4linux/Makefile | 8 | ||||
-rw-r--r-- | Documentation/vm/Makefile | 8 | ||||
-rw-r--r-- | Documentation/watchdog/src/Makefile | 8 | ||||
-rw-r--r-- | Makefile | 5 | ||||
-rw-r--r-- | lib/Kconfig.debug | 9 |
15 files changed, 118 insertions, 1 deletions
diff --git a/Documentation/DocBook/Makefile b/Documentation/DocBook/Makefile index 1d1b34500b69..1615350b7b53 100644 --- a/Documentation/DocBook/Makefile +++ b/Documentation/DocBook/Makefile | |||
@@ -102,6 +102,13 @@ C-procfs-example = procfs_example.xml | |||
102 | C-procfs-example2 = $(addprefix $(obj)/,$(C-procfs-example)) | 102 | C-procfs-example2 = $(addprefix $(obj)/,$(C-procfs-example)) |
103 | $(obj)/procfs-guide.xml: $(C-procfs-example2) | 103 | $(obj)/procfs-guide.xml: $(C-procfs-example2) |
104 | 104 | ||
105 | # List of programs to build | ||
106 | ##oops, this is a kernel module::hostprogs-y := procfs_example | ||
107 | obj-m += procfs_example.o | ||
108 | |||
109 | # Tell kbuild to always build the programs | ||
110 | always := $(hostprogs-y) | ||
111 | |||
105 | notfoundtemplate = echo "*** You have to install docbook-utils or xmlto ***"; \ | 112 | notfoundtemplate = echo "*** You have to install docbook-utils or xmlto ***"; \ |
106 | exit 1 | 113 | exit 1 |
107 | db2xtemplate = db2TYPE -o $(dir $@) $< | 114 | db2xtemplate = db2TYPE -o $(dir $@) $< |
diff --git a/Documentation/Makefile b/Documentation/Makefile new file mode 100644 index 000000000000..94b945733534 --- /dev/null +++ b/Documentation/Makefile | |||
@@ -0,0 +1,3 @@ | |||
1 | obj-m := DocBook/ accounting/ auxdisplay/ connector/ \ | ||
2 | filesystems/configfs/ ia64/ networking/ \ | ||
3 | pcmcia/ spi/ video4linux/ vm/ watchdog/src/ | ||
diff --git a/Documentation/accounting/Makefile b/Documentation/accounting/Makefile new file mode 100644 index 000000000000..31929eb875b1 --- /dev/null +++ b/Documentation/accounting/Makefile | |||
@@ -0,0 +1,10 @@ | |||
1 | # kbuild trick to avoid linker error. Can be omitted if a module is built. | ||
2 | obj- := dummy.o | ||
3 | |||
4 | # List of programs to build | ||
5 | hostprogs-y := getdelays | ||
6 | |||
7 | # Tell kbuild to always build the programs | ||
8 | always := $(hostprogs-y) | ||
9 | |||
10 | HOSTCFLAGS_getdelays.o += -I$(objtree)/usr/include | ||
diff --git a/Documentation/auxdisplay/Makefile b/Documentation/auxdisplay/Makefile new file mode 100644 index 000000000000..51fe23332c81 --- /dev/null +++ b/Documentation/auxdisplay/Makefile | |||
@@ -0,0 +1,10 @@ | |||
1 | # kbuild trick to avoid linker error. Can be omitted if a module is built. | ||
2 | obj- := dummy.o | ||
3 | |||
4 | # List of programs to build | ||
5 | hostprogs-y := cfag12864b-example | ||
6 | |||
7 | # Tell kbuild to always build the programs | ||
8 | always := $(hostprogs-y) | ||
9 | |||
10 | HOSTCFLAGS_cfag12864b-example.o += -I$(objtree)/usr/include | ||
diff --git a/Documentation/connector/Makefile b/Documentation/connector/Makefile new file mode 100644 index 000000000000..8df1a7285a06 --- /dev/null +++ b/Documentation/connector/Makefile | |||
@@ -0,0 +1,11 @@ | |||
1 | ifneq ($(CONFIG_CONNECTOR),) | ||
2 | obj-m += cn_test.o | ||
3 | endif | ||
4 | |||
5 | # List of programs to build | ||
6 | hostprogs-y := ucon | ||
7 | |||
8 | # Tell kbuild to always build the programs | ||
9 | always := $(hostprogs-y) | ||
10 | |||
11 | HOSTCFLAGS_ucon.o += -I$(objtree)/usr/include | ||
diff --git a/Documentation/filesystems/configfs/Makefile b/Documentation/filesystems/configfs/Makefile new file mode 100644 index 000000000000..be7ec5e67dbc --- /dev/null +++ b/Documentation/filesystems/configfs/Makefile | |||
@@ -0,0 +1,3 @@ | |||
1 | ifneq ($(CONFIG_CONFIGFS_FS),) | ||
2 | obj-m += configfs_example_explicit.o configfs_example_macros.o | ||
3 | endif | ||
diff --git a/Documentation/ia64/Makefile b/Documentation/ia64/Makefile new file mode 100644 index 000000000000..b75db69ec483 --- /dev/null +++ b/Documentation/ia64/Makefile | |||
@@ -0,0 +1,8 @@ | |||
1 | # kbuild trick to avoid linker error. Can be omitted if a module is built. | ||
2 | obj- := dummy.o | ||
3 | |||
4 | # List of programs to build | ||
5 | hostprogs-y := aliasing-test | ||
6 | |||
7 | # Tell kbuild to always build the programs | ||
8 | always := $(hostprogs-y) | ||
diff --git a/Documentation/networking/Makefile b/Documentation/networking/Makefile new file mode 100644 index 000000000000..6d8af1ac56c4 --- /dev/null +++ b/Documentation/networking/Makefile | |||
@@ -0,0 +1,8 @@ | |||
1 | # kbuild trick to avoid linker error. Can be omitted if a module is built. | ||
2 | obj- := dummy.o | ||
3 | |||
4 | # List of programs to build | ||
5 | hostprogs-y := ifenslave | ||
6 | |||
7 | # Tell kbuild to always build the programs | ||
8 | always := $(hostprogs-y) | ||
diff --git a/Documentation/pcmcia/Makefile b/Documentation/pcmcia/Makefile new file mode 100644 index 000000000000..accde871ae77 --- /dev/null +++ b/Documentation/pcmcia/Makefile | |||
@@ -0,0 +1,10 @@ | |||
1 | # kbuild trick to avoid linker error. Can be omitted if a module is built. | ||
2 | obj- := dummy.o | ||
3 | |||
4 | # List of programs to build | ||
5 | hostprogs-y := crc32hash | ||
6 | |||
7 | # Tell kbuild to always build the programs | ||
8 | always := $(hostprogs-y) | ||
9 | |||
10 | HOSTCFLAGS_crc32hash.o += -I$(objtree)/usr/include | ||
diff --git a/Documentation/spi/Makefile b/Documentation/spi/Makefile new file mode 100644 index 000000000000..a5b03c88beae --- /dev/null +++ b/Documentation/spi/Makefile | |||
@@ -0,0 +1,11 @@ | |||
1 | # kbuild trick to avoid linker error. Can be omitted if a module is built. | ||
2 | obj- := dummy.o | ||
3 | |||
4 | # List of programs to build | ||
5 | hostprogs-y := spidev_test spidev_fdx | ||
6 | |||
7 | # Tell kbuild to always build the programs | ||
8 | always := $(hostprogs-y) | ||
9 | |||
10 | HOSTCFLAGS_spidev_test.o += -I$(objtree)/usr/include | ||
11 | HOSTCFLAGS_spidev_fdx.o += -I$(objtree)/usr/include | ||
diff --git a/Documentation/video4linux/Makefile b/Documentation/video4linux/Makefile new file mode 100644 index 000000000000..1ed0e98d057d --- /dev/null +++ b/Documentation/video4linux/Makefile | |||
@@ -0,0 +1,8 @@ | |||
1 | # kbuild trick to avoid linker error. Can be omitted if a module is built. | ||
2 | obj- := dummy.o | ||
3 | |||
4 | # List of programs to build | ||
5 | hostprogs-y := v4lgrab | ||
6 | |||
7 | # Tell kbuild to always build the programs | ||
8 | always := $(hostprogs-y) | ||
diff --git a/Documentation/vm/Makefile b/Documentation/vm/Makefile new file mode 100644 index 000000000000..6f562f778b28 --- /dev/null +++ b/Documentation/vm/Makefile | |||
@@ -0,0 +1,8 @@ | |||
1 | # kbuild trick to avoid linker error. Can be omitted if a module is built. | ||
2 | obj- := dummy.o | ||
3 | |||
4 | # List of programs to build | ||
5 | hostprogs-y := slabinfo | ||
6 | |||
7 | # Tell kbuild to always build the programs | ||
8 | always := $(hostprogs-y) | ||
diff --git a/Documentation/watchdog/src/Makefile b/Documentation/watchdog/src/Makefile new file mode 100644 index 000000000000..40e5f46e4740 --- /dev/null +++ b/Documentation/watchdog/src/Makefile | |||
@@ -0,0 +1,8 @@ | |||
1 | # kbuild trick to avoid linker error. Can be omitted if a module is built. | ||
2 | obj- := dummy.o | ||
3 | |||
4 | # List of programs to build | ||
5 | hostprogs-y := watchdog-simple watchdog-test | ||
6 | |||
7 | # Tell kbuild to always build the programs | ||
8 | always := $(hostprogs-y) | ||
@@ -822,6 +822,9 @@ endif | |||
822 | ifdef CONFIG_SAMPLES | 822 | ifdef CONFIG_SAMPLES |
823 | $(Q)$(MAKE) $(build)=samples | 823 | $(Q)$(MAKE) $(build)=samples |
824 | endif | 824 | endif |
825 | ifdef CONFIG_BUILD_DOCSRC | ||
826 | $(Q)$(MAKE) $(build)=Documentation | ||
827 | endif | ||
825 | $(call vmlinux-modpost) | 828 | $(call vmlinux-modpost) |
826 | $(call if_changed_rule,vmlinux__) | 829 | $(call if_changed_rule,vmlinux__) |
827 | $(Q)rm -f .old_version | 830 | $(Q)rm -f .old_version |
@@ -1166,7 +1169,7 @@ MRPROPER_FILES += .config .config.old include/asm .version .old_version \ | |||
1166 | # | 1169 | # |
1167 | clean: rm-dirs := $(CLEAN_DIRS) | 1170 | clean: rm-dirs := $(CLEAN_DIRS) |
1168 | clean: rm-files := $(CLEAN_FILES) | 1171 | clean: rm-files := $(CLEAN_FILES) |
1169 | clean-dirs := $(addprefix _clean_,$(srctree) $(vmlinux-alldirs)) | 1172 | clean-dirs := $(addprefix _clean_,$(srctree) $(vmlinux-alldirs) Documentation) |
1170 | 1173 | ||
1171 | PHONY += $(clean-dirs) clean archclean | 1174 | PHONY += $(clean-dirs) clean archclean |
1172 | $(clean-dirs): | 1175 | $(clean-dirs): |
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index e1d4764435ed..800ac8485544 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug | |||
@@ -735,6 +735,15 @@ config FIREWIRE_OHCI_REMOTE_DMA | |||
735 | 735 | ||
736 | If unsure, say N. | 736 | If unsure, say N. |
737 | 737 | ||
738 | menuconfig BUILD_DOCSRC | ||
739 | bool "Build targets in Documentation/ tree" | ||
740 | depends on HEADERS_CHECK | ||
741 | help | ||
742 | This option attempts to build objects from the source files in the | ||
743 | kernel Documentation/ tree. | ||
744 | |||
745 | Say N if you are unsure. | ||
746 | |||
738 | source "samples/Kconfig" | 747 | source "samples/Kconfig" |
739 | 748 | ||
740 | source "lib/Kconfig.kgdb" | 749 | source "lib/Kconfig.kgdb" |