Re: bug in kernel depends calculation

Adam Heath (adam.heath@usa.net)
Sat, 28 Mar 1998 05:49:11 -0500 (EST)


On Sat, 28 Mar 1998, Adam Heath wrote:

> I recently went and got the 2.1.92pre1 off of ftp.kernel.org, did a mv 2.1.91
> 2.1.92, and applied the patch. Did a make clean, and then tried make zImage.
> I then noticed the bug.
>
> A previous make dep(2.1.91) had stored the absolute directory into the depends
> files. I think that this is wrong. It should be relative. Make dep should
> not have to be run, if I just move a directory.
>
> You could say that make dep should be run after every kernel patch, and I
> would agree. But, if a directory was moved, and no patch applied, then this
> bug would still appear.
>
> Adam

Please see attached patch. It fixes the above bug. It also introduces a new
Makefile variable, HIGHESTDIR, which can get you to the basedir that the
top-level Makefile is in.

diff -ruN linux/Makefile 2.1.92/Makefile
--- linux/Makefile Sat Mar 28 05:31:46 1998
+++ 2.1.92/Makefile Sat Mar 28 05:31:04 1998
@@ -20,7 +20,9 @@
else echo sh; fi ; fi)
TOPDIR := $(shell if [ "$$PWD" != "" ]; then echo $$PWD; else pwd; fi)

-HPATH = $(TOPDIR)/include
+HIGHESTDIR := .
+HPATH = $(HIGHESTDIR)/include
+TOPHPATH = $(TOPDIR)/include
FINDHPATH = $(HPATH)/asm $(HPATH)/linux $(HPATH)/scsi $(HPATH)/net

HOSTCC =gcc
@@ -30,7 +32,7 @@

AS =$(CROSS_COMPILE)as
LD =$(CROSS_COMPILE)ld
-CC =$(CROSS_COMPILE)gcc -D__KERNEL__ -I$(HPATH)
+CC =$(CROSS_COMPILE)gcc -D__KERNEL__ -I$(TOPHPATH)
CPP =$(CC) -E
AR =$(CROSS_COMPILE)ar
NM =$(CROSS_COMPILE)nm
@@ -424,7 +426,7 @@

endif

-include Rules.make
+include $(TOPDIR)/Rules.make

#
# This generates dependencies for the .h files.
diff -ruN linux/Rules.make 2.1.92/Rules.make
--- linux/Rules.make Wed Jan 21 17:32:14 1998
+++ 2.1.92/Rules.make Sat Mar 28 05:36:42 1998
@@ -2,6 +2,18 @@
# This file contains rules which are shared between multiple Makefiles.
#

+HIGHESTDIR := $(shell \
+ DIR=`pwd -P `;\
+ NEWCURDIR=.;\
+ while [ "$$DIR" != "$(TOPDIR)" ];do\
+ DIR=`dirname $$DIR`;\
+ NEWCURDIR=$$NEWCURDIR/..;\
+ done;\
+ echo $$NEWCURDIR;\
+ )
+HPATH = $(HIGHESTDIR)/include
+FINDHPATH = $(HPATH)/asm $(HPATH)/linux $(HPATH)/scsi $(HPATH)/net
+
#
# False targets.
#
@@ -103,7 +115,7 @@
# This make dependencies quickly
#
fastdep: dummy
- $(TOPDIR)/scripts/mkdep $(wildcard *.[chS] local.h.master) > .depend
+ $(HIGHESTDIR)/scripts/mkdep $(wildcard *.[chS] local.h.master) > .depend
ifdef ALL_SUB_DIRS
set -e; for i in $(ALL_SUB_DIRS); do $(MAKE) -C $$i fastdep; done
endif

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu