Messages in this thread Patch in this message | | | From | Andreas Schwab <> | Date | Fri, 15 Mar 96 11:24:22 +0100 | Subject | Problem with dependencies and readonly files |
| |
The way the dependencies are currently maintained fails if some include files are readonly, f.ex. because of RCS locking. The problem is that when a header includes another header a touch command is generated for the first header, which fails on readonly files.
Here is a patch that fixes this bug. The idea is to maintain a variable for each header file that records all files that are included by this header. For every file that is included both the normal dependency and the variable reference is written, to get the transitive dependencies right.
The patch is relative to 1.3.72.
--- linux-1.3/Rules.make.~1~ Tue Mar 5 18:16:53 1996 +++ linux-1.3/Rules.make Thu Mar 14 12:55:19 1996 @@ -82,8 +82,11 @@ # This make dependencies quickly # fastdep: dummy - if [ -n "$(wildcard *.[chS])" ]; then \ - $(AWK) -f $(TOPDIR)/scripts/depend.awk *.[chS] > .depend; fi + rm -f .depend + if [ $(words $(wildcard *.h)) -gt 0 ]; then \ + $(AWK) -f $(TOPDIR)/scripts/depend.awk *.h >> .depend; fi + if [ $(words $(wildcard *.[cS])) -gt 0 ]; then \ + $(AWK) -f $(TOPDIR)/scripts/depend.awk *.[cS] >> .depend; fi ifdef ALL_SUB_DIRS set -e; for i in $(ALL_SUB_DIRS); do $(MAKE) -C $$i fastdep; done endif @@ -188,10 +191,10 @@ # # include dependency files they exist # -ifeq (.depend,$(wildcard .depend)) -include .depend -endif - ifeq ($(TOPDIR)/.hdepend,$(wildcard $(TOPDIR)/.hdepend)) include $(TOPDIR)/.hdepend +endif + +ifeq (.depend,$(wildcard .depend)) +include .depend endif --- linux-1.3/scripts/depend.awk.~1~ Wed Jan 31 18:43:05 1996 +++ linux-1.3/scripts/depend.awk Thu Mar 14 12:59:32 1996 @@ -29,7 +29,7 @@ printf "%s doesn't need config\n",f > "/dev/stderr" } if (hasdep) { - print cmd + print "" } } @@ -42,11 +42,13 @@ 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]) } + ARCH = ENVIRON["ARCH"] } # eliminate comments @@ -90,17 +92,21 @@ hasconfig=0 needsconfig=0 incomment=0 - cmd="" LASTFILE=FILENAME depname=FILENAME relpath=FILENAME sub("\\.c",".o: ",depname) sub("\\.S",".o: ",depname) if (depname==FILENAME) { - cmd="\n\t@touch "depname + varname = depname + sub("^\\./", "", varname) + if (index(varname, TOPDIR) == 1) + varname = substr(varname, length(TOPDIR) + 2) + sub("/asm-" ARCH "/", "/asm/", varname) + depname = varname " =" } - sub("\\.h",".h: ",depname) if(relpath ~ "^\\." ) { + sub("^\\./", "", relpath) sub("[^/]*$","", relpath) relpath=relpath"/" sub("//","/", relpath) @@ -121,6 +127,7 @@ } hasdep=1 printf " \\\n %s", relpath""fname + printf " \\\n $(%s)", relpath""fname if(fname ~ "^\\." ) { if(!relpath in ARGV) { ARGV[ARGC]=relpath""fname @@ -136,7 +143,12 @@ printf "%s", depname } hasdep=1 - printf " \\\n %s", parray[path]"/"fname + fullname = parray[path] "/" fname + sub("/asm-" ARCH "/", "/asm/", fullname) + printf " \\\n %s", fullname + if (index(fullname, TOPDIR) == 1) + fullname = substr(fullname, length(TOPDIR) + 2) + printf " \\\n $(%s)", fullname } } }
| |