On Fri, Nov 02, 2007 at 07:04:42PM -0700, Randy Dunlap wrote:
> 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.

Hi Randy.

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?


        Sam

---
 Documentation/Makefile            |    1 +
 Documentation/accounting/Makefile |    2 ++
 Makefile                          |    6 +++++-
 3 files changed, 8 insertions(+), 1 deletions(-)
 create mode 100644 Documentation/Makefile
 create mode 100644 Documentation/accounting/Makefile

diff --git a/Documentation/Makefile b/Documentation/Makefile
new file mode 100644
index 0000000..b04feae
--- /dev/null
+++ b/Documentation/Makefile
@@ -0,0 +1 @@
+obj-y := accounting/
diff --git a/Documentation/accounting/Makefile 
b/Documentation/accounting/Makefile
new file mode 100644
index 0000000..4abba7a
--- /dev/null
+++ b/Documentation/accounting/Makefile
@@ -0,0 +1,2 @@
+hostprogs-y := getdelays.c
+obj- := dummy.o
diff --git a/Makefile b/Makefile
index 188c3b6..87c6acd 100644
--- a/Makefile
+++ b/Makefile
@@ -1079,7 +1079,7 @@ MRPROPER_FILES += .config .config.old include/asm 
.version .old_version \
 #
 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
 
-- 
1.5.3.4.1157.g0e74-dirty

-
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