mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] out-of-tree builds
@ 2004-03-14 12:58 Geert Uytterhoeven
  2004-03-15  9:26 ` Geert Uytterhoeven
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Geert Uytterhoeven @ 2004-03-14 12:58 UTC (permalink / raw)
  To: Kai Germaschewski, Sam Ravnborg; +Cc: Linux Kernel Development


Although I like the feature to build a kernel in a different directory a lot, I
don't like its syntax. I prefer to just have a build directory where I can run
`make whatever'.

The following patch adds a configure script to the kernel. If you run

    /path/to/kernel/source/tree/configure

it will create a Makefile in the current directory, after which you can just do
`make whatever', just like in the source directory.

The configure script contains a simple protection for when run in the source
directory, but this may be approved (I'm not a configure script guru).

Comments?

--- /dev/null	2004-02-08 10:50:36.000000000 +0100
+++ linux-2.6.4/Makefile.in	2004-03-14 13:00:40.000000000 +0100
@@ -0,0 +1,11 @@
+
+srcdir = @srcdir@
+
+dstdir = $(shell pwd)
+
+all:
+	make -C $(srcdir) O=$(dstdir)
+
+%:
+	make -C $(srcdir) O=$(dstdir) $@
+
--- /dev/null	2004-02-08 10:50:36.000000000 +0100
+++ linux-2.6.4/configure	2004-03-14 13:03:35.000000000 +0100
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+srcdir=$(dirname $0)
+dstdir=$(pwd)
+
+if [ $srcdir = . -o $srcdir = $dstdir ]; then
+    echo Building in Linux kernel source tree, nothing changed
+else
+    if [ -e Makefile ]; then
+	/bin/mv Makefile Makefile.bak
+    fi
+    echo '# Generated automatically from Makefile.in by configure.' > Makefile
+    /bin/sed -e s+@srcdir@+$srcdir+ < $srcdir/Makefile.in >> Makefile
+    echo Linux kernel source tree in directory $srcdir
+    echo Building in directory $dstdir
+fi
+

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] out-of-tree builds
  2004-03-14 12:58 [PATCH] out-of-tree builds Geert Uytterhoeven
@ 2004-03-15  9:26 ` Geert Uytterhoeven
  2004-03-15 12:41 ` Geert Uytterhoeven
  2004-03-15 18:02 ` Sam Ravnborg
  2 siblings, 0 replies; 9+ messages in thread
From: Geert Uytterhoeven @ 2004-03-15  9:26 UTC (permalink / raw)
  To: Kai Germaschewski, Sam Ravnborg; +Cc: Linux Kernel Development

On Sun, 14 Mar 2004, Geert Uytterhoeven wrote:
> The configure script contains a simple protection for when run in the source
> directory, but this may be approved (I'm not a configure script guru).

s/approved/improved/

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] out-of-tree builds
  2004-03-14 12:58 [PATCH] out-of-tree builds Geert Uytterhoeven
  2004-03-15  9:26 ` Geert Uytterhoeven
@ 2004-03-15 12:41 ` Geert Uytterhoeven
  2004-03-15 17:58   ` Sam Ravnborg
  2004-03-22 22:09   ` Geert Uytterhoeven
  2004-03-15 18:02 ` Sam Ravnborg
  2 siblings, 2 replies; 9+ messages in thread
From: Geert Uytterhoeven @ 2004-03-15 12:41 UTC (permalink / raw)
  To: Kai Germaschewski, Sam Ravnborg; +Cc: Linux Kernel Development

On Sun, 14 Mar 2004, Geert Uytterhoeven wrote:
> Although I like the feature to build a kernel in a different directory a lot, I
> don't like its syntax. I prefer to just have a build directory where I can run
> `make whatever'.
>
> The following patch adds a configure script to the kernel. If you run
>
>     /path/to/kernel/source/tree/configure
>
> it will create a Makefile in the current directory, after which you can just do
> `make whatever', just like in the source directory.

Unfortunately not everything works.

E.g. I need to build usr/ with a different (newer) binutils, so when the build
fails on assembling usr/initramfs_data.o, I used to do the following, which no
longer works:

| tux$ PATH=/usr/bin/:$PATH make usr/
| make: `usr/' is up to date.
| tux$

I guess I need a catch-all .PHONY rule, but don't know how to implement it...

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] out-of-tree builds
  2004-03-15 12:41 ` Geert Uytterhoeven
@ 2004-03-15 17:58   ` Sam Ravnborg
  2004-03-15 18:04     ` Geert Uytterhoeven
  2004-03-22 22:09   ` Geert Uytterhoeven
  1 sibling, 1 reply; 9+ messages in thread
From: Sam Ravnborg @ 2004-03-15 17:58 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Kai Germaschewski, Sam Ravnborg, Linux Kernel Development

On Mon, Mar 15, 2004 at 01:41:02PM +0100, Geert Uytterhoeven wrote:
> 
> Unfortunately not everything works.
> 
> E.g. I need to build usr/ with a different (newer) binutils, so when the build
> fails on assembling usr/initramfs_data.o, I used to do the following, which no
> longer works:
> 
> | tux$ PATH=/usr/bin/:$PATH make usr/
> | make: `usr/' is up to date.
> | tux$
> 
> I guess I need a catch-all .PHONY rule, but don't know how to implement it...

Try:
.PHONY: $(MAKECMDGOALS)

or eventually
ifneq ($(MAKECMDGOALS),)
.PHONY: $(MAKECMDGOALS)
endif

The latter if an empty .PHONY is not allowed.

	Sam


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] out-of-tree builds
  2004-03-14 12:58 [PATCH] out-of-tree builds Geert Uytterhoeven
  2004-03-15  9:26 ` Geert Uytterhoeven
  2004-03-15 12:41 ` Geert Uytterhoeven
@ 2004-03-15 18:02 ` Sam Ravnborg
  2004-03-22 22:11   ` Geert Uytterhoeven
  2 siblings, 1 reply; 9+ messages in thread
From: Sam Ravnborg @ 2004-03-15 18:02 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Kai Germaschewski, Sam Ravnborg, Linux Kernel Development

On Sun, Mar 14, 2004 at 01:58:36PM +0100, Geert Uytterhoeven wrote:
> 
> Although I like the feature to build a kernel in a different directory a lot, I
> don't like its syntax. I prefer to just have a build directory where I can run
> `make whatever'.
> 
> The following patch adds a configure script to the kernel. If you run
> 
>     /path/to/kernel/source/tree/configure
> 
> it will create a Makefile in the current directory, after which you can just do
> `make whatever', just like in the source directory.
> 
> The configure script contains a simple protection for when run in the source
> directory, but this may be approved (I'm not a configure script guru).
> 
> Comments?

I like the general idea.
I'm in doubt that configure is the best name, because no actual
configuration takes place.

But I want to finish the external modules stuff before introducing
more features. So it will wait until then.

	Sam

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] out-of-tree builds
  2004-03-15 17:58   ` Sam Ravnborg
@ 2004-03-15 18:04     ` Geert Uytterhoeven
  0 siblings, 0 replies; 9+ messages in thread
From: Geert Uytterhoeven @ 2004-03-15 18:04 UTC (permalink / raw)
  To: Sam Ravnborg; +Cc: Kai Germaschewski, Linux Kernel Development

On Mon, 15 Mar 2004, Sam Ravnborg wrote:
> On Mon, Mar 15, 2004 at 01:41:02PM +0100, Geert Uytterhoeven wrote:
> > Unfortunately not everything works.
> >
> > E.g. I need to build usr/ with a different (newer) binutils, so when the build
> > fails on assembling usr/initramfs_data.o, I used to do the following, which no
> > longer works:
> >
> > | tux$ PATH=/usr/bin/:$PATH make usr/
> > | make: `usr/' is up to date.
> > | tux$
> >
> > I guess I need a catch-all .PHONY rule, but don't know how to implement it...
>
> Try:
> .PHONY: $(MAKECMDGOALS)

Thanks! But it doesn't work:

| tux$ rm usr/*
| tux$ make usr/
| make: Nothing to be done for `usr/'.
| tux$

> or eventually
> ifneq ($(MAKECMDGOALS),)
> .PHONY: $(MAKECMDGOALS)
> endif
>
> The latter if an empty .PHONY is not allowed.

It's allowed.

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] out-of-tree builds
  2004-03-15 12:41 ` Geert Uytterhoeven
  2004-03-15 17:58   ` Sam Ravnborg
@ 2004-03-22 22:09   ` Geert Uytterhoeven
  2004-04-01  9:35     ` Geert Uytterhoeven
  1 sibling, 1 reply; 9+ messages in thread
From: Geert Uytterhoeven @ 2004-03-22 22:09 UTC (permalink / raw)
  To: Kai Germaschewski, Sam Ravnborg; +Cc: Linux Kernel Development

On Mon, 15 Mar 2004, Geert Uytterhoeven wrote:
> On Sun, 14 Mar 2004, Geert Uytterhoeven wrote:
> > Although I like the feature to build a kernel in a different directory a lot, I
> > don't like its syntax. I prefer to just have a build directory where I can run
> > `make whatever'.
> >
> > The following patch adds a configure script to the kernel. If you run
> >
> >     /path/to/kernel/source/tree/configure
> >
> > it will create a Makefile in the current directory, after which you can just do
> > `make whatever', just like in the source directory.
>
> Unfortunately not everything works.
>
> E.g. I need to build usr/ with a different (newer) binutils, so when the build
> fails on assembling usr/initramfs_data.o, I used to do the following, which no
> longer works:
>
> | tux$ PATH=/usr/bin/:$PATH make usr/
> | make: `usr/' is up to date.
> | tux$
>
> I guess I need a catch-all .PHONY rule, but don't know how to implement it...

`info make' never hurts...

--- linux-2.6.x/Makefile.in.orig	2004-02-08 10:50:36.000000000 +0100
+++ linux-2.6.x/Makefile.in	2004-03-22 23:02:29.000000000 +0100
@@ -0,0 +1,12 @@
+
+srcdir = @srcdir@
+
+dstdir = $(shell pwd)
+
+all:
+	@$(MAKE) -C $(srcdir) O=$(dstdir)
+
+%:	force
+	@$(MAKE) -C $(srcdir) O=$(dstdir) $@
+
+force:	;
--- linux-2.6.x/configure.orig	2004-02-08 10:50:36.000000000 +0100
+++ linux-2.6.x/configure	2004-03-15 10:27:00.000000000 +0100
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+srcdir=$(dirname $0)
+dstdir=$(pwd)
+
+if [ $srcdir = . -o $srcdir = $dstdir ]; then
+    echo Building in Linux kernel source tree, nothing changed
+else
+    if [ -e Makefile ]; then
+	/bin/mv Makefile Makefile.bak
+    fi
+    echo '# Generated automatically from Makefile.in by configure.' > Makefile
+    /bin/sed -e s+@srcdir@+$srcdir+ < $srcdir/Makefile.in >> Makefile
+    echo Linux kernel source tree in directory $srcdir
+    echo Building in directory $dstdir
+fi
+

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] out-of-tree builds
  2004-03-15 18:02 ` Sam Ravnborg
@ 2004-03-22 22:11   ` Geert Uytterhoeven
  0 siblings, 0 replies; 9+ messages in thread
From: Geert Uytterhoeven @ 2004-03-22 22:11 UTC (permalink / raw)
  To: Sam Ravnborg; +Cc: Kai Germaschewski, Linux Kernel Development

On Mon, 15 Mar 2004, Sam Ravnborg wrote:
> On Sun, Mar 14, 2004 at 01:58:36PM +0100, Geert Uytterhoeven wrote:
> > Although I like the feature to build a kernel in a different directory a lot, I
> > don't like its syntax. I prefer to just have a build directory where I can run
> > `make whatever'.
> >
> > The following patch adds a configure script to the kernel. If you run
> >
> >     /path/to/kernel/source/tree/configure
> >
> > it will create a Makefile in the current directory, after which you can just do
> > `make whatever', just like in the source directory.
> >
> > The configure script contains a simple protection for when run in the source
> > directory, but this may be approved (I'm not a configure script guru).
> >
> > Comments?
>
> I like the general idea.
> I'm in doubt that configure is the best name, because no actual
> configuration takes place.

I know. But I make it that way because that's how people are used to configure
for out-of-tree builds with autoconf.

> But I want to finish the external modules stuff before introducing
> more features. So it will wait until then.

Let's see what other people think ;-)

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] out-of-tree builds
  2004-03-22 22:09   ` Geert Uytterhoeven
@ 2004-04-01  9:35     ` Geert Uytterhoeven
  0 siblings, 0 replies; 9+ messages in thread
From: Geert Uytterhoeven @ 2004-04-01  9:35 UTC (permalink / raw)
  To: Kai Germaschewski, Sam Ravnborg; +Cc: Linux Kernel Development

On Mon, 22 Mar 2004, Geert Uytterhoeven wrote:
> On Mon, 15 Mar 2004, Geert Uytterhoeven wrote:
> > On Sun, 14 Mar 2004, Geert Uytterhoeven wrote:
> > > Although I like the feature to build a kernel in a different directory a lot, I
> > > don't like its syntax. I prefer to just have a build directory where I can run
> > > `make whatever'.
> > >
> > > The following patch adds a configure script to the kernel. If you run
> > >
> > >     /path/to/kernel/source/tree/configure
> > >
> > > it will create a Makefile in the current directory, after which you can just do
> > > `make whatever', just like in the source directory.
> >
> > Unfortunately not everything works.
> >
> > E.g. I need to build usr/ with a different (newer) binutils, so when the build
> > fails on assembling usr/initramfs_data.o, I used to do the following, which no
> > longer works:
> >
> > | tux$ PATH=/usr/bin/:$PATH make usr/
> > | make: `usr/' is up to date.
> > | tux$
> >
> > I guess I need a catch-all .PHONY rule, but don't know how to implement it...
>
> `info make' never hurts...
>
> --- linux-2.6.x/Makefile.in.orig	2004-02-08 10:50:36.000000000 +0100
> +++ linux-2.6.x/Makefile.in	2004-03-22 23:02:29.000000000 +0100
> @@ -0,0 +1,12 @@
> +
> +srcdir = @srcdir@
> +
> +dstdir = $(shell pwd)
> +
> +all:
> +	@$(MAKE) -C $(srcdir) O=$(dstdir)
> +
> +%:	force
> +	@$(MAKE) -C $(srcdir) O=$(dstdir) $@
> +
> +force:	;
> --- linux-2.6.x/configure.orig	2004-02-08 10:50:36.000000000 +0100
> +++ linux-2.6.x/configure	2004-03-15 10:27:00.000000000 +0100
> @@ -0,0 +1,17 @@
> +#!/bin/sh
> +
> +srcdir=$(dirname $0)
> +dstdir=$(pwd)
> +
> +if [ $srcdir = . -o $srcdir = $dstdir ]; then
> +    echo Building in Linux kernel source tree, nothing changed
> +else
> +    if [ -e Makefile ]; then
> +	/bin/mv Makefile Makefile.bak
> +    fi
> +    echo '# Generated automatically from Makefile.in by configure.' > Makefile
> +    /bin/sed -e s+@srcdir@+$srcdir+ < $srcdir/Makefile.in >> Makefile
> +    echo Linux kernel source tree in directory $srcdir
> +    echo Building in directory $dstdir
> +fi
> +

Still not perfect, though. `make target' doesn't work for *.o files, but it
does work for directories, e.g.:

| tux$ rm usr/initramfs_data.o
| tux$ PATH=/usr/bin:$PATH make usr/initramfs_data.o
| make[1]: Entering directory `/home/geert/linux/testing/linux-m68k-2.6.5-rc3'
| make[2]: Nothing to be done for `Makefile'.
| make[1]: Nothing to be done for `Makefile'.
| make[1]: Leaving directory `/home/geert/linux/testing/linux-m68k-2.6.5-rc3'
| make: *** No rule to make target `usr/initramfs_data.o'.  Stop.
| tux$ PATH=/usr/bin:$PATH make usr/
| make[1]: Entering directory `/home/geert/linux/testing/linux-m68k-2.6.5-rc3'
| make[2]: Nothing to be done for `Makefile'.
| make[1]: Nothing to be done for `Makefile'.
| make[1]: Leaving directory `/home/geert/linux/testing/linux-m68k-2.6.5-rc3'
| make[1]: Entering directory `/home/geert/linux/testing/linux-m68k-2.6.5-rc3'
| make[3]: `arch/m68k/kernel/asm-offsets.s' is up to date.
|   AS      usr/initramfs_data.o
|   LD      usr/built-in.o
| make[1]: Leaving directory `/home/geert/linux/testing/linux-m68k-2.6.5-rc3'
| tux$

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2004-04-01  9:36 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-03-14 12:58 [PATCH] out-of-tree builds Geert Uytterhoeven
2004-03-15  9:26 ` Geert Uytterhoeven
2004-03-15 12:41 ` Geert Uytterhoeven
2004-03-15 17:58   ` Sam Ravnborg
2004-03-15 18:04     ` Geert Uytterhoeven
2004-03-22 22:09   ` Geert Uytterhoeven
2004-04-01  9:35     ` Geert Uytterhoeven
2004-03-15 18:02 ` Sam Ravnborg
2004-03-22 22:11   ` Geert Uytterhoeven

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®