1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
${TMP}:
mkdir -p ${TMP}
${TMP}/calls.x86.lin.32.tbl: ${lin-headers}/unistd_32.h ${TMP}
grep "#define __NR_" $< | sed 's;^#define __NR_;;' > $@
${TMP}/calls.x86.lin.64.tbl: ${lin-headers}/unistd_64.h ${TMP}
grep "#define __NR_" $< | sed 's;^#define __NR_;;' > $@
${TMP}/calls.x86.fbsd.%.tbl: ${fbsd-headers}/syscall.h ${TMP}
grep "#define SYS_" $< | sed 's;^#define SYS_;;' | sed 's;[\t ]\+; ;' > $@
${TMP}/calls.s: ${TMP}/calls.${TARGET}.tbl
awk -f syscall.awk -v out=asm <$< >$@
${TMP}/calls.h: ${TMP}/calls.${TARGET}.tbl
awk -f syscall.awk -v out=header <$< >$@
${TMP}/typesize: typesize.c
$(CC) -std=c11 $< -o $@
${TMP}/typesize.def: ${TMP}/typesize
$< > $@
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
<
>
>
|
<
<
<
>
>
|
<
>
|
<
<
>
>
>
>
>
>
>
>
>
|
|
|
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
|
ifeq (${OS},lin)
p-headers-syscall ?= /usr/include/asm/unistd_${BITS}.h
p-headers-errno ?= /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h
else ifeq (${OS},fbsd)
p-headers-syscall ?= /usr/include/sys/syscall.h
p-headers-errno ?= /usr/include/errno.h
else
$(info we don’t know where to find your magic number headers.)
$(info to compile libk, please provide the following variables \
to the make command line:)
$(info --- [1mp-headers-syscall[m=(location of syscall header))
$(info --- [1mp-headers-errno[m=(location of your errno values header))
$(info note that /usr/include/errno.h or your system’s equivalent \
may not be sufficient. make sure the file you pass actually contains \
individual #define statements for each possible value of errno!)
$(error table generation failed due to missing primaries)
endif
${TMP}:
mkdir -p ${TMP}
${TMP}/calls.lin@x86.%.tbl: $(p-headers-syscall)
mkdir -p ${TMP}
grep -h "#define __NR_" $^ | sed 's;^#define __NR_;;' > $@
${TMP}/calls.fbsd@%.tbl: $(p-headers-syscall)
mkdir -p ${TMP}
grep -h "#define SYS_" $^ | sed 's;^#define SYS_;;' | sed 's;[\t ]\+; ;' > $@
${TMP}/system_calls.%: ${TMP}/calls.${OS}@${ARCH}.${BITS}.tbl ${TMP}
awk -f syscall.awk -v out=$* <$< >$@
${TMP}/error_names.tbl: $(p-headers-errno)
mkdir -p ${TMP}
grep -h "#[ ]*define[ ]\+E" $^ | sed 's;^#[\t ]*define[\t ]\+\(E[A-Z0-9]\+\).*$$;k_platform_error_\1 \1;' > $@
${TMP}/error_numbers.tbl: $(p-headers-errno) ${TMP}/error_names.tbl
cat $^ | cpp -P >$@
${TMP}/error_table.h: ${TMP}/error_numbers.tbl ${TMP}
awk -f errtbl.awk <$< >$@
${TMP}/typesize: typesize.c ${TMP}
$(CC) -std=c11 $< -o $@
${TMP}/typesize.def: ${TMP}/typesize ${TMP}
$< > $@
|