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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
# $OpenBSD: makeconf.awk,v 1.17 2010/10/17 21:33:53 deraadt Exp $
# $NetBSD: makeconf.awk,v 1.3 1996/05/04 15:45:32 pk Exp $
#
# generate crunchgen(1) configuration file from `list' spec.
#
BEGIN {
printf("#\n# This file is automatically generated by `makeconf'\n#\n\n");
libs = "libs -lstubs -lutil -lotermcap -lm";
}
$1 == "LIBS" {
$1 = tolower($1);
libs = $0;
}
$1 == "SRCDIRS" {
$1 = tolower($1);
print;
}
($1 == "LINK" || $1 == "SYMLINK") && index($2,CBIN) {
# find basenames for inclusion in crunchgen's `prog' and `ln' directives
n = split($3, x, "/");
p = x[n];
progs[p] = NF - 3;
for (i = 4; i <= NF; i++) {
n = split($i, x, "/");
l = x[n];
links[i - 3, p] = l;
}
}
$1 == "ARGVLINK" {
# add extra `ln' entries (these don't appear in the filesystem)
n = progs[$2];
progs[$2] = ++n;
links[n, $2] = $3;
}
$1 == "CRUNCHSPECIAL" {
# collect crunchgen `special' directives
$1 = "";
specials[$0] = 1;
}
END {
# write crunchgen configuration
# `prog' directives; print 8 to a line
column = 0;
for (p in progs) {
if ((column++ % 8) == 0)
printf("\nprogs");
printf(" %s", p);
}
printf("\n\n");
# `ln' directives
for (p in progs) {
n = progs[p];
for (i = 1; i <= n; i++)
printf("ln %s %s\n", p, links[i,p]);
}
printf("\n%s\n\n", libs);
printf("libdirs distrib/special/libstubs\n");
# `special' directives
for (s in specials) {
printf("special %s\n", s);
}
}
|