linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* mkdep patch in 2.4.21-pre4-ac7 breaks pci/drivers
@ 2003-02-28 22:00 Pavel Roskin
  2003-03-02  2:13 ` Horst von Brand
  0 siblings, 1 reply; 6+ messages in thread
From: Pavel Roskin @ 2003-02-28 22:00 UTC (permalink / raw)
  To: linux-kernel; +Cc: Alan Cox

Hello, Alan and all!

If I compile linux 2.4.21-pre4-ac7, then run "make depend" and "make
clean", then "make bzImage" fails in pci/drivers:

gcc -D__KERNEL__ -I/usr/local/src/linux/include -Wall -Wstrict-prototypes
-Wno-trigraphs -O2 -fno-strict-aliasing -fno-common -fomit-frame-pointer
-pipe -mpreferred-stack-boundary=2 -march=athlon   -nostdinc -iwithprefix
include -DKBUILD_BASENAME=compat  -c -o compat.o compat.c
make[3]: *** No rule to make target
`/usr/local/src/linux/drivers/pci/devlist.h', needed by `names.o'.  Stop.
make[3]: Leaving directory `/usr/local/src/linux/drivers/pci'
make[2]: *** [first_rule] Error 2
make[2]: Leaving directory `/usr/local/src/linux/drivers/pci'
make[1]: *** [_subdir_pci] Error 2
make[1]: Leaving directory `/usr/local/src/linux/drivers'
make: *** [_dir_drivers] Error 2

This is caused by the patch for scripts/mkdep.c (part of the
2.4.21-pre4-ac7 patch) which makes full names from the includes.  GNU
make 3.79.1 tries to compile names.o, notices that it depends on
/usr/local/src/linux/drivers/pci/devlist.h, but doesn't "realize" (I guess
it's an intentional limitation) that the devlist.h target would create
that file.

The old code would put "devlist.h" without path into the .depend file.
make can actually deal with it.  If there are any reasons to use the full
path (most likely the reason is to eliminate ".."), either "wildcard"
should be used on the local files, or the "cleanable" files should be
somehow marked as such.  Finally, the build system could require "make
depend" after "make clean", but that would be an annoyance.

Here's the patch that uses wildcards for the local includes.  By the way,
there is no need to suppress "/../" for local files - neither the filename
not the working directory can have it.  Sorry, I'm including both changes
together, but it's trivial to separate them.

=========================
--- linux.orig/drivers/pci/mkdep.c
+++ linux/drivers/pci/mkdep.c
@@ -205,11 +205,13 @@ void handle_include(int start, const cha
 		path->buffer[path->len+len] = '\0';
 		if (access(path->buffer, F_OK) == 0) {
 			int l = lcwd + strlen(path->buffer);
+			int need_wildcard = 0;
 			char name2[l+2], *p;
 			if (path->buffer[0] == '/') {
 				memcpy(name2, path->buffer, l+1);
 			}
 			else {
+				need_wildcard = 1;
 				memcpy(name2, cwd, lcwd);
 				name2[lcwd] = '/';
 				memcpy(name2+lcwd+1, path->buffer, path->len+len+1);
@@ -219,7 +221,11 @@ void handle_include(int start, const cha
 				strcpy(strrchr(name2, '/'), p+3);
 			}
 			do_depname();
-			printf(" \\\n   %s", name2);
+			if (need_wildcard) {
+				printf(" \\\n   $(wildcard %s)", name2);
+			} else {
+				printf(" \\\n   %s", name2);
+			}
 			return;
 		}
 	}
=========================

Just in case, I'm using Red Hat 8.0 (make 3.79.1, bash 2.05b, gcc 3.2) on
AMD Athlon.

-- 
Regards,
Pavel Roskin

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

* Re: mkdep patch in 2.4.21-pre4-ac7 breaks pci/drivers
  2003-02-28 22:00 mkdep patch in 2.4.21-pre4-ac7 breaks pci/drivers Pavel Roskin
@ 2003-03-02  2:13 ` Horst von Brand
  2003-03-03  8:32   ` Pavel Roskin
  2003-03-03  9:00   ` [PATCH] " Pavel Roskin
  0 siblings, 2 replies; 6+ messages in thread
From: Horst von Brand @ 2003-03-02  2:13 UTC (permalink / raw)
  To: Pavel Roskin; +Cc: Linux Kernel Mailing List

Pavel Roskin <proski@gnu.org> said:
> If I compile linux 2.4.21-pre4-ac7, then run "make depend" and "make
> clean", then "make bzImage" fails in pci/drivers:

make drivers/pci/gen-devlist; pushd drivers/pci; ./gen-devlist < pci.ids; popd

Needed for all 2.4.x I've seen (lately at least).


[...]

> This is caused by the patch for scripts/mkdep.c (part of the
> 2.4.21-pre4-ac7 patch)

Nope. It's the same with 2.4 from Marcelo.
-- 
Dr. Horst H. von Brand                   User #22616 counter.li.org
Departamento de Informatica                     Fono: +56 32 654431
Universidad Tecnica Federico Santa Maria              +56 32 654239
Casilla 110-V, Valparaiso, Chile                Fax:  +56 32 797513

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

* Re: mkdep patch in 2.4.21-pre4-ac7 breaks pci/drivers
  2003-03-02  2:13 ` Horst von Brand
@ 2003-03-03  8:32   ` Pavel Roskin
  2003-03-04  1:27     ` Horst von Brand
  2003-03-03  9:00   ` [PATCH] " Pavel Roskin
  1 sibling, 1 reply; 6+ messages in thread
From: Pavel Roskin @ 2003-03-03  8:32 UTC (permalink / raw)
  To: Horst von Brand; +Cc: Linux Kernel Mailing List

Hello!

On Sat, 1 Mar 2003, Horst von Brand wrote:

> Pavel Roskin <proski@gnu.org> said:
> > If I compile linux 2.4.21-pre4-ac7, then run "make depend" and "make
> > clean", then "make bzImage" fails in pci/drivers:
>
> make drivers/pci/gen-devlist; pushd drivers/pci; ./gen-devlist < pci.ids; popd
>
> Needed for all 2.4.x I've seen (lately at least).

That shouldn't be needed unless you skip "make depend" completely or do
something else wrong, or your "make" is buggy.  It shouldn't be necessary.

names.o depends on devlist.h explicitly in drivers/pci/Makefile.
As explained in the section "Multiple Rules for One Target" of GNU make
documentation, other rules (i.e. in .depend) don't cancel this dependency.

Further, devlist.h depends on gen-devlist, so whenever drivers/pci/names.o
is to be compiled, devlist.h will be created before that.

> > This is caused by the patch for scripts/mkdep.c (part of the
> > 2.4.21-pre4-ac7 patch)
>
> Nope. It's the same with 2.4 from Marcelo.

Not true.  2.4.20 is fine:

make distclean
cp ~/local/linux/.config .
make oldconfig
make dep
make bzImage

No problems whatsoever.

-- 
Regards,
Pavel Roskin

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

* [PATCH] mkdep patch in 2.4.21-pre4-ac7 breaks pci/drivers
  2003-03-02  2:13 ` Horst von Brand
  2003-03-03  8:32   ` Pavel Roskin
@ 2003-03-03  9:00   ` Pavel Roskin
  2003-03-03  9:58     ` Pavel Roskin
  1 sibling, 1 reply; 6+ messages in thread
From: Pavel Roskin @ 2003-03-03  9:00 UTC (permalink / raw)
  To: Linux Kernel Mailing List; +Cc: Horst von Brand

Hello!

This patch works for me and doesn't require any changes in mkdep.  I
believe it's the right thing to do.  The rule for names.o already exists
in the Makefile.  The only problem with it is that it's misplaced - it
should precede the generated dependencies.

GNU make just concatenates the lists of dependencies and tries to create
the dependencies in the order is which they appear in the makefile.  If
devlist.h without path is first, then make will create it because there is
a rule for that.  Thn make will see that devlist.h with path is already
up-to-date.

On the other hand, if devlist.h with path is first, then make won't know
how to create it and will abort rather than go to the next target.

This patch has been tested and works for me.  How to test:

make oldconfig
make clean
make depend
make bzImage
make depend
make clean
make bzImage

It works fine now.  Patch:

==============================
--- linux.orig/drivers/pci/Makefile
+++ linux/drivers/pci/Makefile
@@ -35,10 +35,10 @@
 obj-y += syscall.o
 endif

-include $(TOPDIR)/Rules.make
-
 names.o: names.c devlist.h classlist.h

+include $(TOPDIR)/Rules.make
+
 devlist.h classlist.h: pci.ids gen-devlist
 	./gen-devlist <pci.ids

==============================

The patch fixes the problem in Alan's 2.4 series, but it can be safely
applied to the Marcelo's 2.4 branch as well.

-- 
Regards,
Pavel Roskin

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

* Re: [PATCH] mkdep patch in 2.4.21-pre4-ac7 breaks pci/drivers
  2003-03-03  9:00   ` [PATCH] " Pavel Roskin
@ 2003-03-03  9:58     ` Pavel Roskin
  0 siblings, 0 replies; 6+ messages in thread
From: Pavel Roskin @ 2003-03-03  9:58 UTC (permalink / raw)
  To: Linux Kernel Mailing List; +Cc: Horst von Brand

Hello!

> This patch has been tested and works for me.  How to test:

I'm terribly sorry, my testing was incorrect (I was looking at a wrong
window).  One more change needs to be done.  Since name.o becomes the
first rule, it becomes the default rule instead of driver.o, which is not
created.

The trick (already used in drivers/net/hamradio/soundmodem/Makefile) is to
define the first rule as

all: all_targets

Fixed patch:

===================================
--- linux.orig/drivers/pci/Makefile
+++ linux/drivers/pci/Makefile
@@ -35,10 +35,11 @@
 obj-y += syscall.o
 endif

-include $(TOPDIR)/Rules.make
-
+all: all_targets
 names.o: names.c devlist.h classlist.h

+include $(TOPDIR)/Rules.make
+
 devlist.h classlist.h: pci.ids gen-devlist
 	./gen-devlist <pci.ids

===================================

This patch was tested all the way to "make install" and reboot.

-- 
Regards,
Pavel Roskin

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

* Re: mkdep patch in 2.4.21-pre4-ac7 breaks pci/drivers
  2003-03-03  8:32   ` Pavel Roskin
@ 2003-03-04  1:27     ` Horst von Brand
  0 siblings, 0 replies; 6+ messages in thread
From: Horst von Brand @ 2003-03-04  1:27 UTC (permalink / raw)
  To: Pavel Roskin; +Cc: Linux Kernel Mailing List

Pavel Roskin <proski@gnu.org> said:
> On Sat, 1 Mar 2003, Horst von Brand wrote:
> > Pavel Roskin <proski@gnu.org> said:
> > > If I compile linux 2.4.21-pre4-ac7, then run "make depend" and "make
> > > clean", then "make bzImage" fails in pci/drivers:

> > make drivers/pci/gen-devlist; pushd drivers/pci; ./gen-devlist < pci.ids; popd

> > Needed for all 2.4.x I've seen (lately at least).

> That shouldn't be needed unless you skip "make depend" completely or do
> something else wrong, or your "make" is buggy.  It shouldn't be necessary.

I have been doing this for ages:

   make oldconfig dep clean

and it breaks here (Red Hat 8.0)
-- 
Dr. Horst H. von Brand                   User #22616 counter.li.org
Departamento de Informatica                     Fono: +56 32 654431
Universidad Tecnica Federico Santa Maria              +56 32 654239
Casilla 110-V, Valparaiso, Chile                Fax:  +56 32 797513

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

end of thread, other threads:[~2003-03-04  1:17 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-02-28 22:00 mkdep patch in 2.4.21-pre4-ac7 breaks pci/drivers Pavel Roskin
2003-03-02  2:13 ` Horst von Brand
2003-03-03  8:32   ` Pavel Roskin
2003-03-04  1:27     ` Horst von Brand
2003-03-03  9:00   ` [PATCH] " Pavel Roskin
2003-03-03  9:58     ` Pavel Roskin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).