Re: 1.3.7[4,5]: make qdep kills compile! Doh.

Yuri Per (yuri@pts.mipt.ru)
Sun, 17 Mar 1996 19:46:26 +0300 (GMT+0300)


I'm sorry for publishing buggy version of quick-dep.
Now I fixed the problem, new variant follows.

Laszlo Vecsey at Mar 16, 96 wrote:
> Here we go, make `zlilo' aborts right here:
>
> gcc -D__KERNEL__ -I/usr/src/linux/include -Wall -Wstrict-prototypes -O2
> -fomit-frame-pointer -fno-strength-reduce -pipe -m486 -malign-loops=2
> -malign-jumps=2 -malign-functions=2 -DCPU=586 -c -o consolemap.o
> consolemap.c
> consolemap.c:303: uni_hash.tbl: No such file or directory
> consolemap.c: In function `con_set_default_unimap':
> consolemap.c:404: `dfont_unitable' undeclared (first use this function)
> consolemap.c:404: (Each undeclared identifier is reported only once
> consolemap.c:404: for each function it appears in.)
> consolemap.c:406: `dfont_unicount' undeclared (first use this function)
> consolemap.c:397: warning: `j' might be used uninitialized in this function
> consolemap.c:398: warning: `p' might be used uninitialized in this function
> make[3]: *** [consolemap.o] Error 1
>
> I hope quick-dep can be fixed, it really is much faster than make dep.

diff -ur linux.1.3.75/Makefile linux/Makefile
--- linux.1.3.75/Makefile Sun Mar 17 19:49:02 1996
+++ linux/Makefile Sun Mar 17 17:31:48 1996
@@ -130,6 +130,7 @@
drivers/net/net.a
LIBS =$(TOPDIR)/lib/lib.a
SUBDIRS =kernel drivers mm fs net ipc lib
+DEPDIRS =$(SUBDIRS) ./init $(HPATH)/linux $(HPATH)/net $(HPATH)/asm/

ifeq ($(CONFIG_ISDN),y)
DRIVERS := $(DRIVERS) drivers/isdn/isdn.a
@@ -392,3 +393,6 @@
rm -f $@
$(AWK) -f scripts/depend.awk `find $(HPATH) -name \*.h ! -name modversions.h -print` > .$@
mv .$@ $@
+
+qdep: symlinks
+ $(AWK) -f scripts/qdepend.awk `find $(DEPDIRS) -name '*.[chS]' ! -name modversions.h -depth -print`
diff -ur linux.1.3.75/scripts/qdepend.awk linux/scripts/qdepend.awk
--- linux.1.3.75/scripts/qdepend.awk Sun Mar 17 19:46:06 1996
+++ linux/scripts/qdepend.awk Sun Mar 17 18:01:34 1996
@@ -0,0 +1,118 @@
+# This is an awk script which does dependencies. We do NOT want it to
+# recursivly follow #include directives.
+#
+# The HPATH environment variable should be set to indicate where to look
+# for include files. The -I infront of the path is optional.
+
+#
+# Surely there is a more elegant way to see if a file exists. Anyone know
+# what it is?
+#
+function fileExists(f) {
+ if(dummy=FILEHASH[f]) {
+ if(dummy=="1") {
+ return 1
+ }
+ return 0
+ }
+ dummy = getline dummy < f
+ if(dummy >= 0) {
+ close(f)
+ FILEHASH[f]="1"
+ return 1
+ }
+ FILEHASH[f]="0"
+ return 0
+}
+
+function endfile() {
+ if (hasdep) {
+ printf "\n" > depfile
+ if(cmd) {
+ printf "\t%s\n", cmd > depfile
+ }
+ }
+}
+
+BEGIN{
+ if(!(TOPDIR=ENVIRON["TOPDIR"])) {
+ print "Environment variable TOPDIR is not set"
+ exit 1
+ }
+ sub("[/ ]*$","",TOPDIR)
+ split(ENVIRON["HPATH"],parray," ")
+ for(path in parray) {
+ sub("^-I","",parray[path])
+ sub("[/ ]*$","",parray[path])
+ }
+}
+
+/^#[ \t]*include[ \t]*[<\"].+[>\"]/ {
+ found=0
+ if(LASTFILE!=FILENAME) {
+ endfile()
+ hasdep=0
+ cmd=""
+ LASTFILE=FILENAME
+ depname=FILENAME
+ relpath=FILENAME
+ sub("\\.[cS]$",".o",depname)
+ if (depname==FILENAME) {
+ cmd="@touch $@"
+ }
+ gsub("[^/]+$","",relpath)
+ if(relpath ~ "^\\.") {
+ relpath=""
+ sub("^\\./","",depname)
+ }
+ depfile=relpath".depend"
+ if(relpath ~ "^/") {
+ depfile=".hdepend"
+ } else {
+ gsub(".*/","",depname)
+ }
+ if(LASTDEPFILE && LASTDEPFILE!=depfile) {
+ close(LASTDEPFILE)
+ LASTDEPFILE=""
+ }
+ }
+ fname=$0
+ sub("^#[ \t]*include[ \t]*[<\"]","",fname)
+ sub("[>\"].*","",fname)
+ if($0 ~ "^#[ \t]*include[ \t]*\"") {
+ name=fname
+ if(name !~ "^/" ) {
+ name=relpath""name
+ }
+ if(fileExists(name)) {
+ found=1
+ if(name ~ "^/" ) {
+ fname=name
+ }
+ }
+ }
+ if(!found) {
+ for(path in parray) {
+ if(fileExists(parray[path]"/"fname)) {
+ fname=parray[path]"/"fname
+ found=1
+ break
+ }
+ }
+ }
+ if(found) {
+ if(!hasdep) {
+ if(!LASTDEPFILE) {
+ printf "Writing %s\n",depfile > "/dev/stderr"
+ LASTDEPFILE=depfile
+ }
+ printf "%s:",depname > depfile
+ hasdep=1
+ }
+ printf "\t\\\n\t%s",fname > depfile
+ }
+}
+
+END{
+ endfile()
+}