patch-1.3.38 linux/scripts/depend.awk

Next file: linux/scripts/tkgen.c
Previous file: linux/scripts/Configure
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v1.3.37/linux/scripts/depend.awk linux/scripts/depend.awk
@@ -24,8 +24,19 @@
 	}
 }
 
+function endfile(f) {
+	if (hasconfig && !needsconfig) {
+		printf "%s doesn't need config\n",f > "/dev/stderr"
+	}
+	if (hasdep) {
+		print cmd
+	}
+}
+
 BEGIN{
 	hasdep=0
+	hasconfig=0
+	needsconfig=0
 	if(!(TOPDIR=ENVIRON["TOPDIR"])) {
 		print "Environment variable TOPDIR is not set"
 		exit 1
@@ -37,13 +48,22 @@
 	}
 }
 
-/^#[ 	]*include[ 	]*[<"][^ 	]*[>"]/{
+/^[ 	]*#[ 	]*if.*[^A-Za-z_]CONFIG_/ {
+	needsconfig=1
+	if (!hasconfig) {
+		printf "%s needs config but has not included config file\n",FILENAME > "/dev/stderr"
+		# only say it once per file..
+		hasconfig = 1
+	}
+}
+
+/^[ 	]*#[ 	]*include[ 	]*[<"][^ 	]*[>"]/{
 	found=0
 	if(LASTFILE!=FILENAME) {
-		if (hasdep) {
-			print cmd
-		}
+		endfile(LASTFILE)
 		hasdep=0
+		hasconfig=0
+		needsconfig=0
 		cmd=""
 		LASTFILE=FILENAME
 		depname=FILENAME
@@ -65,6 +85,9 @@
 	fname=$0
 	sub("^#[ 	]*include[ 	]*[<\"]","",fname)
 	sub("[>\"].*","",fname)
+	if (fname=="linux/config.h") {
+		hasconfig=1
+	}
 	if(fileExists(relpath""fname)) {
 		found=1
 		if (!hasdep) {
@@ -94,7 +117,5 @@
 }
 
 END{
-	if (hasdep) {
-		print cmd
-	}
+	endfile(FILENAME)
 }

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov with Sam's (original) version
of this