public inbox for linux-arch@vger.kernel.org
 help / color / mirror / Atom feed
* introduce arch/$ARCH/Kbuild ?
@ 2009-04-16 18:37 Sam Ravnborg
  2009-04-21 13:14 ` Ralf Baechle
  0 siblings, 1 reply; 3+ messages in thread
From: Sam Ravnborg @ 2009-04-16 18:37 UTC (permalink / raw)
  To: linux-arch


We have discussed privately the possiblity to cover
all of arch/x86/* with -Werror and I came up with some
suggestions so we could cover all subdirectories
with a simple:

    subdir-ccflags-y := -Werror

I will sent a separate post on this when I have a patch ready..

But doing so required us to modify a lot of Makefiles
in arch/x86 - too much for my taste.

Looking futher I realised that we could move all the core-y
stuff to a separate Kbuild file as done by the appended patch.
We would then cover all the directories with a single:

    subdir-ccflags-y := -Werror


This has the added benefit that you can now do:

    make arch/x86/

And you will build most (but not all) of the x86 files.
That alone was enough rationale for Ingo to apply it (and I agree).

What remains are the libs-y and driver-y parts.
There is no way to specify these today.

If you think this looks wortwhile for your architecture I
will be glad to help cook up a patch - albeit it is trivial
to do so yourself.

	Sam


----- Forwarded message from tip-bot for Sam Ravnborg <sam@ravnborg.org> -----

Subject: [tip:x86/kbuild] x86: standardize Kbuild rules
From: tip-bot for Sam Ravnborg <sam@ravnborg.org>
Reply-To: linux-kernel@vger.kernel.org, mingo@redhat.com, hpa@zytor.com,
        sam@ravnborg.org, jaswinder@kernel.org, tglx@linutronix.de,
        mingo@elte.hu
Date: Thu, 16 Apr 2009 16:33:39 GMT
X-Mailer: tip-git-log-daemon
To: linux-tip-commits@vger.kernel.org
Cc: hpa@zytor.com, mingo@redhat.com, sam@ravnborg.org, jaswinder@kernel.org,
        tglx@linutronix.de, mingo@elte.hu

Commit-ID:  d1f0ae5e2e45e74cff4c3bdefb0fc77608cdfeec
Gitweb:     http://git.kernel.org/tip/d1f0ae5e2e45e74cff4c3bdefb0fc77608cdfeec
Author:     Sam Ravnborg <sam@ravnborg.org>
AuthorDate: Wed, 15 Apr 2009 21:34:55 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 16 Apr 2009 18:09:02 +0200

x86: standardize Kbuild rules

Introducing this Kbuild file allow us to:

    make arch/x86/

And thus building all the core part of x86.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Jaswinder Singh Rajput <jaswinder@kernel.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 arch/x86/Kbuild   |   16 ++++++++++++++++
 arch/x86/Makefile |   19 ++-----------------
 2 files changed, 18 insertions(+), 17 deletions(-)

diff --git a/arch/x86/Kbuild b/arch/x86/Kbuild
new file mode 100644
index 0000000..ad8ec35
--- /dev/null
+++ b/arch/x86/Kbuild
@@ -0,0 +1,16 @@
+
+obj-$(CONFIG_KVM) += kvm/
+
+# Xen paravirtualization support
+obj-$(CONFIG_XEN) += xen/
+
+# lguest paravirtualization support
+obj-$(CONFIG_LGUEST_GUEST) += lguest/
+
+obj-y += kernel/
+obj-y += mm/
+
+obj-y += crypto/
+obj-y += vdso/
+obj-$(CONFIG_IA32_EMULATION) += ia32/
+
diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index f05d8c9..e81f0b2 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -7,8 +7,6 @@ else
         KBUILD_DEFCONFIG := $(ARCH)_defconfig
 endif
 
-core-$(CONFIG_KVM) += arch/x86/kvm/
-
 # BITS is used as extension for files which are available in a 32 bit
 # and a 64 bit version to simplify shared Makefiles.
 # e.g.: obj-y += foo_$(BITS).o
@@ -118,21 +116,8 @@ head-y += arch/x86/kernel/init_task.o
 
 libs-y  += arch/x86/lib/
 
-# Sub architecture files that needs linking first
-core-y += $(fcore-y)
-
-# Xen paravirtualization support
-core-$(CONFIG_XEN) += arch/x86/xen/
-
-# lguest paravirtualization support
-core-$(CONFIG_LGUEST_GUEST) += arch/x86/lguest/
-
-core-y += arch/x86/kernel/
-core-y += arch/x86/mm/
-
-core-y += arch/x86/crypto/
-core-y += arch/x86/vdso/
-core-$(CONFIG_IA32_EMULATION) += arch/x86/ia32/
+# See arch/x86/Kbuild for content of core part of the kernel
+core-y += arch/x86/
 
 # drivers-y are linked after core-y
 drivers-$(CONFIG_MATH_EMULATION) += arch/x86/math-emu/

----- End forwarded message -----

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

* Re: introduce arch/$ARCH/Kbuild ?
  2009-04-16 18:37 introduce arch/$ARCH/Kbuild ? Sam Ravnborg
@ 2009-04-21 13:14 ` Ralf Baechle
  2009-04-21 19:43   ` Sam Ravnborg
  0 siblings, 1 reply; 3+ messages in thread
From: Ralf Baechle @ 2009-04-21 13:14 UTC (permalink / raw)
  To: Sam Ravnborg; +Cc: linux-arch

On Thu, Apr 16, 2009 at 08:37:01PM +0200, Sam Ravnborg wrote:

> We have discussed privately the possiblity to cover
> all of arch/x86/* with -Werror and I came up with some
> suggestions so we could cover all subdirectories
> with a simple:
> 
>     subdir-ccflags-y := -Werror
> 
> I will sent a separate post on this when I have a patch ready..
> 
> But doing so required us to modify a lot of Makefiles
> in arch/x86 - too much for my taste.
> 
> Looking futher I realised that we could move all the core-y
> stuff to a separate Kbuild file as done by the appended patch.
> We would then cover all the directories with a single:
> 
>     subdir-ccflags-y := -Werror
> 
> 
> This has the added benefit that you can now do:
> 
>     make arch/x86/
> 
> And you will build most (but not all) of the x86 files.
> That alone was enough rationale for Ingo to apply it (and I agree).
> 
> What remains are the libs-y and driver-y parts.
> There is no way to specify these today.
> 
> If you think this looks wortwhile for your architecture I
> will be glad to help cook up a patch - albeit it is trivial
> to do so yourself.

Most of arch/mips uses -Werror these days and while painful at times it
keeps everybody on their toes hopefully cleaner, less buggy code.  So if
your solution allows adding -Werror to all subdirs automatically with
a mechanism to remove -Werror from a few selected dirs then I'm interested.

  Ralf

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

* Re: introduce arch/$ARCH/Kbuild ?
  2009-04-21 13:14 ` Ralf Baechle
@ 2009-04-21 19:43   ` Sam Ravnborg
  0 siblings, 0 replies; 3+ messages in thread
From: Sam Ravnborg @ 2009-04-21 19:43 UTC (permalink / raw)
  To: Ralf Baechle; +Cc: linux-arch

> 
> Most of arch/mips uses -Werror these days and while painful at times it
> keeps everybody on their toes hopefully cleaner, less buggy code.  So if
> your solution allows adding -Werror to all subdirs automatically with
> a mechanism to remove -Werror from a few selected dirs then I'm interested.

It is already present in mainline - so go wild.

I took a look at mips.
mips supports an impressive amount of platform/boards.
The has resulted in lines like the following in the arch Makefile:

core-$(CONFIG_SGI_IP32)         += arch/mips/sgi-ip32/
cflags-$(CONFIG_SGI_IP32)       += -I$(srctree)/arch/mips/include/asm/mach-ip32
load-$(CONFIG_SGI_IP32)         += 0xffffffff80004000

But this is less then optimal. If two people add a paltform you will
have a merge issue.
And centralize information like that is also questionable.

mips would be better suited if you had all sgi_ip32 information located
in a single directory.

How about a setup like this:

arch/mips/sgi_ip32/Platform:
platfrom-y                      += arch/mips/sgi-ip32/
cflags-$(CONFIG_SGI_IP32)       += -I$(srctree)/arch/mips/include/asm/mach-ip32
load-$(CONFIG_SGI_IP32)         += 0xffffffff80004000


arch/mips/Kbuild.platforms:
#All platforms listed in alphabetic order
platforms-y += lasat/
platforms-y += sgi_ip32/

#include the platform specific files
include $(patsubst %, arch/misp/%Platform)


arch/mips/Kbuild:
subdir-ccflags-y := -Werror

include arch/mips/Kbuild.platforms
obj-y += $(platform-y)

obj-y +=  arch/mips/kernel/ arch/mips/mm/ arch/mips/math-emu/


arch/mips/Makefile:
core-y += arch/mips/
include arch/mips/Kbuild.platforms



The above does a few things:
1) It decentralize the plaform stuff (to the Platform files)
2) In troduces a arch/mips/Kbuild file that specify everything
   that is linked in as core-y
3) It adds a single subdir-ccflags-y := -Werror that covers
   all platforms and the core part of the kernel
   (Everything specified in arch/mips/Kbuild)
4) It reuses Kbuild.platforms in Kbuild and
   in Makefile.
   In Makefile it is used to find ccflags-y
   and load-y definitions.
   In Kbuild it is used to find the objects to add to obj-y.


The above is entirely untested - but I hope to have adressed the principles.

	Sam

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

end of thread, other threads:[~2009-04-21 19:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-16 18:37 introduce arch/$ARCH/Kbuild ? Sam Ravnborg
2009-04-21 13:14 ` Ralf Baechle
2009-04-21 19:43   ` Sam Ravnborg

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