patch-1.3.59 linux/scripts/depend.awk

Next file: linux/Documentation/networking/vortex.txt
Previous file: linux/scripts/Configure
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v1.3.58/linux/scripts/depend.awk linux/scripts/depend.awk
@@ -37,6 +37,7 @@
 	hasdep=0
 	hasconfig=0
 	needsconfig=0
+	incomment=0
 	if(!(TOPDIR=ENVIRON["TOPDIR"])) {
 		print "Environment variable TOPDIR is not set"
 		exit 1
@@ -48,6 +49,30 @@
 	}
 }
 
+# eliminate comments
+{
+    # remove all comments fully contained on a single line
+	gsub("\\/\\*.*\\*\\/", "")
+	if (incomment) {
+		if ($0 ~ /\*\//) {
+			incomment = 0;
+			gsub(".*\\*\\/", "")
+		} else {
+			next
+		}
+	} else {
+		# start of multi-line comment
+		if ($0 ~ /\/\*/)
+		{
+			incomment = 1;
+			sub("\\/\\*.*", "")
+		} else if ($0 ~ /\*\//) {
+			incomment = 0;
+			sub(".*\\*\\/", "")
+		}
+	}
+}
+
 /^[ 	]*#[ 	]*if.*[^A-Za-z_]CONFIG_/ {
 	needsconfig=1
 	if (!hasconfig) {
@@ -64,6 +89,7 @@
 		hasdep=0
 		hasconfig=0
 		needsconfig=0
+		incomment=0
 		cmd=""
 		LASTFILE=FILENAME
 		depname=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