> > > The obj- := dummy.o is needed to fool kbuild to create
> > > a built-in.o otherwise the link will fail in Documentation/
> > > 
> > > If you need to build a module simple add a rule:
> > > obj-m := <module>.o as usual and drop the dummy.o
> > > 
> > > Will this work for you?
> > 
> > Yes, in theory it seems to be OK, with 2 nits :)
> > 
> > a.  "make samplescheck" could be confused with CONFIG_SAMPLES:
> > 
> > ifdef CONFIG_SAMPLES
> >     $(Q)$(MAKE) $(build)=samples
> > endif
> > 
> > or maybe not.  I don't know, I just don't want it to be confusing.
> > But it's easy to rename that part if needed.
> > 
> > b.  It doesn't build Documentation/accounting/getdelays(.c) for me.
> 
> Wrong diff - see below.

Much better, thanks.  I added the rest of the userspace .c files.
Some of them actually build.  ;)
Others make need to use a current version of headers_install,
but I haven't tried that yet.

---
From: Sam Ravnborg <[EMAIL PROTECTED]>

Simple skeleton that implemented what I described in previous
mail. I just added a "samplescheck" targets, but we should maybe 
do this as part of the normal build too?

The obj- := dummy.o is needed to fool kbuild to create
a built-in.o otherwise the link will fail in Documentation/

If you need to build a module simple add a rule:
obj-m := <module>.o as usual and drop the dummy.o

Will this work for you?

---
 Documentation/DocBook/Makefile      |    9 +++++++++
 Documentation/Makefile              |    2 ++
 Documentation/accounting/Makefile   |    8 ++++++++
 Documentation/auxdisplay/Makefile   |    8 ++++++++
 Documentation/connector/Makefile    |    8 ++++++++
 Documentation/ia64/Makefile         |    8 ++++++++
 Documentation/networking/Makefile   |    8 ++++++++
 Documentation/pcmcia/Makefile       |    8 ++++++++
 Documentation/spi/Makefile          |    8 ++++++++
 Documentation/video4linux/Makefile  |    8 ++++++++
 Documentation/vm/Makefile           |    8 ++++++++
 Documentation/watchdog/src/Makefile |    8 ++++++++
 Makefile                            |    6 +++++-
 13 files changed, 96 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/Makefile
 create mode 100644 Documentation/accounting/Makefile

--- /dev/null
+++ linux-2.6.24-rc1-git13/Documentation/Makefile
@@ -0,0 +1,2 @@
+obj-y := DocBook/ accounting/ auxdisplay/ connector/ ia64/ networking/ \
+       pcmcia/ spi/ video4linux/ vm/ watchdog/src/
--- /dev/null
+++ linux-2.6.24-rc1-git13/Documentation/accounting/Makefile
@@ -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 := getdelays
+
+# Tell kbuild to always build the programs
+always := $(hostprogs-y)
--- linux-2.6.24-rc1-git13.orig/Makefile
+++ linux-2.6.24-rc1-git13/Makefile
@@ -1079,7 +1079,7 @@ MRPROPER_FILES += .config .config.old in
 #
 clean: rm-dirs  := $(CLEAN_DIRS)
 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
 $(clean-dirs):
@@ -1424,6 +1424,10 @@ versioncheck:
 namespacecheck:
        $(PERL) $(srctree)/scripts/namespace.pl
 
+# build check sample code
+samplescheck:
+       $(Q)$(MAKE) $(build)=Documentation
+
 export_report:
        $(PERL) $(srctree)/scripts/export_report.pl
 
--- linux-2.6.24-rc1-git13.orig/Documentation/DocBook/Makefile
+++ linux-2.6.24-rc1-git13/Documentation/DocBook/Makefile
@@ -101,6 +101,15 @@ C-procfs-example = procfs_example.xml
 C-procfs-example2 = $(addprefix $(obj)/,$(C-procfs-example))
 $(obj)/procfs-guide.xml: $(C-procfs-example2)
 
+# kbuild trick to avoid linker error. Can be omitted if a module is built.
+obj- := dummy.o
+
+# List of programs to build
+hostprogs-y := procfs_example
+
+# Tell kbuild to always build the programs
+always := $(hostprogs-y)
+
 notfoundtemplate = echo "*** You have to install docbook-utils or xmlto ***"; \
                   exit 1
 db2xtemplate = db2TYPE -o $(dir $@) $<
--- /dev/null
+++ linux-2.6.24-rc1-git13/Documentation/auxdisplay/Makefile
@@ -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 := cfag12864b-example
+
+# Tell kbuild to always build the programs
+always := $(hostprogs-y)
--- /dev/null
+++ linux-2.6.24-rc1-git13/Documentation/connector/Makefile
@@ -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 := cn_test ucon
+
+# Tell kbuild to always build the programs
+always := $(hostprogs-y)
--- /dev/null
+++ linux-2.6.24-rc1-git13/Documentation/ia64/Makefile
@@ -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)
--- /dev/null
+++ linux-2.6.24-rc1-git13/Documentation/networking/Makefile
@@ -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)
--- /dev/null
+++ linux-2.6.24-rc1-git13/Documentation/pcmcia/Makefile
@@ -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 := crc32hash
+
+# Tell kbuild to always build the programs
+always := $(hostprogs-y)
--- /dev/null
+++ linux-2.6.24-rc1-git13/Documentation/spi/Makefile
@@ -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 := spidev_test
+
+# Tell kbuild to always build the programs
+always := $(hostprogs-y)
--- /dev/null
+++ linux-2.6.24-rc1-git13/Documentation/video4linux/Makefile
@@ -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)
--- /dev/null
+++ linux-2.6.24-rc1-git13/Documentation/vm/Makefile
@@ -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)
--- /dev/null
+++ linux-2.6.24-rc1-git13/Documentation/watchdog/src/Makefile
@@ -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)

-
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

Reply via email to