rfh == request for help.
I tried to do $subject and failed miserably.
For how to cause the Documentation/ examples to be built,
I considered using a new CONFIG_ symbol, an environment variable
(or a command-line variable), a completely separate Makefile,
or a "check" string (these are special-cased in the top-level
Makefile). I ended up trying to use a command-line variable "X",
as in:
$ make X=1 all
which sets KBUILD_EX to 1, and then I (tried to) use KBUILD_EX
in top-level and subordinate Makefiles to control building the
example source files.
[For phase 1, I'm only trying to build userspace examples.
Phase 2 can add kernel modules. Then I want to move more examples
out of .txt files into their own example source files as phase 3.]
My patch is below. If anyone can suggest how to make this work,
please let me know. TIA.
~Randy
---
Documentation/DocBook/Makefile | 5 +++++
Documentation/Makefile | 13 +++++++++++++
Documentation/accounting/Makefile | 4 ++++
Documentation/auxdisplay/Makefile | 4 ++++
Documentation/connector/Makefile | 7 +++++++
Documentation/ia64/Makefile | 4 ++++
Documentation/networking/Makefile | 4 ++++
Documentation/pcmcia/Makefile | 4 ++++
Documentation/spi/Makefile | 4 ++++
Documentation/video4linux/Makefile | 4 ++++
Documentation/vm/Makefile | 4 ++++
Documentation/watchdog/src/Makefile | 7 +++++++
Makefile | 17 ++++++++++++++++-
13 files changed, 80 insertions(+), 1 deletion(-)
--- linux-2.6.24-rc1-git11.orig/Documentation/DocBook/Makefile
+++ linux-2.6.24-rc1-git11/Documentation/DocBook/Makefile
@@ -101,6 +101,11 @@ C-procfs-example = procfs_example.xml
C-procfs-example2 = $(addprefix $(obj)/,$(C-procfs-example))
$(obj)/procfs-guide.xml: $(C-procfs-example2)
+ifeq ($(KBUILD_EX),1)
+$(obj)/procfs_example: procfs_example.c
+ $(HOSTCC) $(HOSTCFLAGS) procfs_example.c $@
+endif
+
notfoundtemplate = echo "*** You have to install docbook-utils or xmlto ***"; \
exit 1
db2xtemplate = db2TYPE -o $(dir $@) $<
--- linux-2.6.24-rc1-git11.orig/Makefile
+++ linux-2.6.24-rc1-git11/Makefile
@@ -63,6 +63,17 @@ ifndef KBUILD_CHECKSRC
KBUILD_CHECKSRC = 0
endif
+# Use make X=1 to build eXample source code (kernel or userspace)
+# in Documentation/ (that is not covered by CONFIG_SAMPLES).
+ifdef X
+ ifeq ("$(origin X)", "command line")
+ KBUILD_EX = 1
+ endif
+endif
+ifndef KBUILD_EX
+ KBUILD_EX = 0
+endif
+
# Use make M=dir to specify directory of external module to build
# Old syntax make ... SUBDIRS=$PWD is still supported
# Setting the environment variable KBUILD_EXTMOD take precedence
@@ -239,7 +250,7 @@ ifeq ($(MAKECMDGOALS),)
endif
export KBUILD_MODULES KBUILD_BUILTIN
-export KBUILD_CHECKSRC KBUILD_SRC KBUILD_EXTMOD
+export KBUILD_CHECKSRC KBUILD_SRC KBUILD_EXTMOD KBUILD_EX
# Beautify output
# ---------------------------------------------------------------------------
@@ -780,6 +791,10 @@ endif
ifdef CONFIG_SAMPLES
$(Q)$(MAKE) $(build)=samples
endif
+ifeq ($(KBUILD_EX),1)
+ $(Q)$(MAKE) -f Documentation/Makefile
+ ##$(Q)$(MAKE) $(build)=Documentation
+endif
$(call vmlinux-modpost)
$(call if_changed_rule,vmlinux__)
$(Q)rm -f .old_version
--- /dev/null
+++ linux-2.6.24-rc1-git11/Documentation/Makefile
@@ -0,0 +1,13 @@
+DD=Documentation
+MF=Makefile
+
+examples:
+ $(Q)$(MAKE) -f $(DD)/DocBook/$(MF) $(DD)/accounting/$(MF) \
+ $(DD)/auxdisplay/$(MF) $(DD)/connector/$(MF) \
+ $(DD)/ia64/$(MF) $(DD)/networking/$(MF) \
+ $(DD)/pcmcia/$(MF) $(DD)/spi/$(MF) \
+ $(DD)/video4linux/$(MF) $(DD)/vm/$(MF) \
+ $(DD)/watchdog/src/$(MF)
+ ##$(Q)$(MAKE) $(build)=DocBook/ accounting/ auxdisplay/ connector/ \
+ ia64/ networking/ pcmcia/ spi/ video4linux/ vm/ \
+ watchdog/src/
--- /dev/null
+++ linux-2.6.24-rc1-git11/Documentation/accounting/Makefile
@@ -0,0 +1,4 @@
+
+$(obj)/getdelays: getdelays.c
+ $(HOSTCC) $(HOSTCFLAGS) -I$(srctree)/include getdelays.c $@
+
--- /dev/null
+++ linux-2.6.24-rc1-git11/Documentation/auxdisplay/Makefile
@@ -0,0 +1,4 @@
+
+$(obj)/cfag12864b-example: cfag12864b-example.c
+ $(HOSTCC) $(HOSTCFLAGS) $@
+
--- /dev/null
+++ linux-2.6.24-rc1-git11/Documentation/connector/Makefile
@@ -0,0 +1,7 @@
+
+$(obj)/cn_test: cn_test.c
+ $(HOSTCC) $(HOSTCFLAGS) $@
+
+$(obj)/ucon: ucon.c
+ $(HOSTCC) $(HOSTCFLAGS) $@
+
--- /dev/null
+++ linux-2.6.24-rc1-git11/Documentation/ia64/Makefile
@@ -0,0 +1,4 @@
+
+$(obj)/aliasing-test: aliasing-test.c
+ $(HOSTCC) $(HOSTCFLAGS) aliasing-test.c $@
+
--- /dev/null
+++ linux-2.6.24-rc1-git11/Documentation/networking/Makefile
@@ -0,0 +1,4 @@
+
+$(obj)/ifenslave: ifenslave.c
+ $(HOSTCC) $(HOSTCFLAGS) -Wall -Wstrict-prototypes -O
-I$(srctree)/include ifenslave.c $@
+
--- /dev/null
+++ linux-2.6.24-rc1-git11/Documentation/pcmcia/Makefile
@@ -0,0 +1,4 @@
+
+$(obj)/crc32hash: crc32hash.c
+ $(HOSTCC) $(HOSTCFLAGS) crc32hash.c $@
+
--- /dev/null
+++ linux-2.6.24-rc1-git11/Documentation/spi/Makefile
@@ -0,0 +1,4 @@
+
+$(obj)/spidev_test: spidev_test.c
+ $(HOSTCC) $(HOSTCFLAGS) -I$(srctree)/include spidev_test.c $@
+
--- /dev/null
+++ linux-2.6.24-rc1-git11/Documentation/video4linux/Makefile
@@ -0,0 +1,4 @@
+
+$(obj)/v4lgrab: v4lgrab.c
+ $(HOSTCC) $(HOSTCFLAGS) -s -Wall -Wstrict-prototypes v4lgrab.c $@
+
--- /dev/null
+++ linux-2.6.24-rc1-git11/Documentation/vm/Makefile
@@ -0,0 +1,4 @@
+
+$(obj)/slabinfo: slabinfo.c
+ $(HOSTCC) $(HOSTCFLAGS) slabinfo.c $@
+
--- /dev/null
+++ linux-2.6.24-rc1-git11/Documentation/watchdog/src/Makefile
@@ -0,0 +1,7 @@
+
+$(obj)/watchdog-simple: watchdog-simple.c
+ $(HOSTCC) $(HOSTCFLAGS) watchdog-simple.c $@
+
+$(obj)/watchdog-test: watchdog-test.c
+ $(HOSTCC) $(HOSTCFLAGS) watchdog-test.c $@
+
-
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at http://vger.kernel.org/majordomo-info.html