On Wednesday 13 June 2007 09:44, Bernhard Fischer wrote:
> On Tue, Jun 12, 2007 at 10:56:20PM +0200, Denis Vlasenko wrote:
> >Fixed:
> >
> >+++ busybox.2/applets/Kbuild    2007-06-12 22:51:54.000000000 +0200
> >@@ -9,6 +9,7 @@ obj-y   += applets.o
> >
> > # Generated file needs additional love
> >
> >+applets/usage:     .config
> > applets/applets.o: .config include/usage_compressed.h
> 
> Well, shouldn't this work automagically as usage.c should depend on
> usage_compressed.h (which it doesn't) and usage_compressed.h should
> depend on .config ?
> 
> While the hunk above may work, i'm not confident that it is correct..
> Thoughts?

I'm not very good at makefiles.

Let's see.

applets/applets.o: .config include/usage_compressed.h

hostprogs-y += usage
always := $(hostprogs-y)
HOSTCFLAGS_usage.o = -I$(srctree)/include

include/usage_compressed.h: .config $(srctree)/include/usage.h applets/usage
        $(call cmd,gen_usage_compressed)

Well, usage_compressed.h will be re-generated if .config changes, but
it is regenerated by running applets/usage, which can be stale.
That's why adding

applets/usage:     .config

helps - make realizes that usage must be rebuilt first.

Ok, strictly speaking, we can remove .config from usage_compressed.h
dependencies.

I don't know why we have $(srctree)/include/usage.h listed explicitly
as a dependency. Quick experiment shows that we don't need it...

How about this patch?
--
vda
diff -d -urpN busybox.5/applets/Kbuild busybox.6/applets/Kbuild
--- busybox.5/applets/Kbuild	2007-06-12 22:51:54.000000000 +0200
+++ busybox.6/applets/Kbuild	2007-06-14 20:15:46.000000000 +0200
@@ -5,18 +5,20 @@
 # Licensed under the GPL v2, see the file LICENSE in this tarball.
 
 obj-y:=
-obj-y	+= applets.o
+obj-y	    += applets.o
 
-# Generated file needs additional love
+hostprogs-y:=
+hostprogs-y += usage
 
-applets/usage:     .config
-applets/applets.o: .config include/usage_compressed.h
+always:=    $(hostprogs-y)
 
-hostprogs-y += usage
-always := $(hostprogs-y)
-HOSTCFLAGS_usage.o = -I$(srctree)/include
+# Generated files need additional love
 
 quiet_cmd_gen_usage_compressed = GEN     include/usage_compressed.h
       cmd_gen_usage_compressed = $(srctree)/applets/usage_compressed include/usage_compressed.h applets
-include/usage_compressed.h: .config $(srctree)/include/usage.h applets/usage
+
+HOSTCFLAGS_usage.o = -I$(srctree)/include
+
+applets/usage:              .config
+include/usage_compressed.h: applets/usage
 	$(call cmd,gen_usage_compressed)
diff -d -urpN busybox.5/applets/usage.c busybox.6/applets/usage.c
--- busybox.5/applets/usage.c	2007-06-10 19:09:49.000000000 +0200
+++ busybox.6/applets/usage.c	2007-06-14 20:19:37.000000000 +0200
@@ -1,7 +1,7 @@
 /* vi: set sw=4 ts=4: */
 #include <unistd.h>
 
-#include "../include/autoconf.h"
+#include "autoconf.h"
 
 static const char usage_messages[] = ""
 #define MAKE_USAGE
_______________________________________________
busybox mailing list
[email protected]
http://busybox.net/cgi-bin/mailman/listinfo/busybox

Reply via email to