-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakerules.sh
More file actions
executable file
·46 lines (40 loc) · 889 Bytes
/
makerules.sh
File metadata and controls
executable file
·46 lines (40 loc) · 889 Bytes
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
#!/bin/sh
#
# makerules - write makefile rules for System/161 build
#
# arguments: none
# stdin: list of directories (no suffix) and sources in those
# directories (.c, .cc, .C, .s, .S suffixes recognized)
#
awk '{ for (i=1; i<=NF; i++) print $i; }' |\
awk '
BEGIN {
curdir = "NOGOOD";
printf "# Automatically generated file - do not edit\n\n";
}
function rule(file, base) {
printf "%s.o: %s/%s\n", base, curdir, file;
printf "\t$(CC) $(CFLAGS) -I%s -c %s/%s\n", curdir, curdir, file;
printf "SRCS+=%s/%s\n", curdir, file;
printf "OBJS+=%s.o\n", base;
printf "\n";
}
/\.[cCsS]$/ {
file = $1;
base = $1;
sub("\\.[cCsS]$", "", base);
rule(file, base);
next;
}
/\.cc$/ {
file = $1;
base = $1;
sub("\\.cc$", "", base);
rule(file, base);
next;
}
{
curdir = "$S/" $1;
printf "DEPINCLUDES+=-I%s\n\n", curdir;
}
'