On Mon, Nov 05, 2007 at 03:58:46PM -0800, Randy Dunlap wrote:
> On Mon, 5 Nov 2007 20:02:45 +0100 Sam Ravnborg wrote:
>
> > 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?
>
> IMO it's not important to do this as part of a normal kernel build.
> Just on demand is OK/fine with me.
>
> > 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.
Sam
>
> $ make V=1 samplescheck
> make -f scripts/Makefile.build obj=Documentation
> make -f scripts/Makefile.build obj=Documentation/accounting
> $
>
>
> > 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
The correct accounting/Makefile looks like this:
# kbuild trick to avoid linker error. Can be omitted if a module is build
obj- := dummy.o
# List of programs to build
hostprogs-y := getdelays
# 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