File: genlink.awk

package info (click to toggle)
hackrf 2024.02.1-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 36,692 kB
  • sloc: ansic: 56,310; xml: 3,424; perl: 2,730; python: 1,427; makefile: 598; asm: 514; vhdl: 319; sh: 179; awk: 20
file content (28 lines) | stat: -rw-r--r-- 504 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# This program converts chip name to the series of definitions for make of
# automatic linker script.
#
# Copyright (C) 2013 Frantisek Burian <Bufran@seznam.cz>
# Copyright (C) 2013 Werner Almesberger <wpwrak>
#

BEGIN {
	PAT = tolower(PAT);
}
!/^#/{
	tmp = "^"$1"$";
	gsub(/?/, ".", tmp);
	gsub(/*/, ".*", tmp);
	gsub(/+/, ".+", tmp);
	tolower(tmp);

	if (PAT ~ tmp) {
		if ($2 != "+")
			PAT=$2;
		$1="";
		$2="";
		for (i = 3; i <= NF; i = i + 1)
			$i = "-D"$i;
		print;
		if (PAT=="END") exit;
	}
}