libk  Diff

Differences From Artifact [21471ec514]:

To Artifact [ce87fe2fb7]:


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