summaryrefslogtreecommitdiff
path: root/pkgtools/libnbcompat/files/nbcompat.awk
blob: 64b6a1e21018a3739da83062c742c3e159dc91a5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
BEGIN { process = 1 }

/NBCOMPAT template section follows\./ { process = 0 }

/^#[ 	]*define[ 	]+PACKAGE_.*/ {
	if (process == 1) {
		print "/* " $0 " */";
		next;
	}
}

/^#[ 	]*define[ 	]+/ {
	if (process == 1) {
		guard = $0;
		sub("^#[ 	]*define[ 	]+", "", guard);
		sub("[ 	]+.*", "", guard);
		print "#ifndef " guard;
		print $0;
		print "#endif";
		next;
	}
}

{ print }