author | Olivier Brunel
<jjk@jjacky.com> 2023-12-23 14:24:42 UTC |
committer | Olivier Brunel
<jjk@jjacky.com> 2024-01-01 19:10:12 UTC |
parent | 89df32628d9613597c1bb6beb1705923138a85e5 |
.gitignore | +2 | -0 |
meta/deps/skalibs/is_found | +32 | -3 |
project.mk | +6 | -0 |
tools/mkendian | +36 | -0 |
diff --git a/.gitignore b/.gitignore index 1670f44..1127901 100644 --- a/.gitignore +++ b/.gitignore @@ -2,7 +2,9 @@ /configure /common.mk /config.mk +/config.tmp /src/include/config.h +/src/liblimb/include/limb/endian.h /src/liblimb/include/limb/rabin-tables.h /deps /build diff --git a/meta/deps/skalibs/is_found b/meta/deps/skalibs/is_found index c2181e0..1769b3a 100755 --- a/meta/deps/skalibs/is_found +++ b/meta/deps/skalibs/is_found @@ -1,4 +1,33 @@ #!/bin/sh -libdir=$1 -test -e "$libdir/libskarnet.a" || test -e "$libdir/skalibs/libskarnet.a" \ - || test -e "$libdir/libskarnet.so" +isint=$1 +type=$2 +dir=$3 +in= + +case "$type" in + shared) + file=libskarnet.so + ;; + static) + file=libskarnet.a + ;; + include) + test $isint -eq 1 && in=src/include + file=skalibs/skalibs.h + ;; + *) + exit 1 + ;; +esac + +if test -e "$dir/$in/$file"; then + echo $in + exit 0 +fi + +if test "$type" = "static" && test -e "$dir/skalibs/$file"; then + echo skalibs + exit 0 +fi + +exit 1 diff --git a/project.mk b/project.mk index c9b92c7..bc5b882 100644 --- a/project.mk +++ b/project.mk @@ -1,5 +1,11 @@ LIBS = limb +all: src/liblimb/include/limb/endian.h +CLEAN += src/liblimb/include/limb/endian.h src/liblimb/include/limb/rabin-tables.h + +src/liblimb/include/limb/endian.h: src/include/config.h + $(_GEN) tools/mkendian > $@ + build/liblimb/nextsplit.h/nextsplit_rabin.o \ build/liblimb/nextsplit.h/nextsplit_rabin.lo: src/liblimb/include/limb/rabin-tables.h diff --git a/tools/mkendian b/tools/mkendian new file mode 100755 index 0000000..7bed7fa --- /dev/null +++ b/tools/mkendian @@ -0,0 +1,36 @@ +#!/bin/sh + +dief() +{ + echo "$0: fatal: $@" >&2 + exit 1 +} + +isle=0 +isbe=0 +ispdp=0 + +if ! test -e config.tmp/endian; then dief "missing config.tmp/endian"; fi +endian="$(cat config.tmp/endian 2>/dev/null)" +case "$endian" in + LITTLE) isle=1 ;; + BIG) isbe=1 ;; + PDP) ispdp=1 ;; + *) dief "invalid endian: $endian" ;; +esac + +cat <<EOF +#ifndef LIMB_ENDIAN_H +#define LIMB_ENDIAN_H + +#define LIMB_LITTLE 1234 +#define LIMB_BIG 4321 +#define LIMB_PDP 3412 +#define LIMB_ENDIAN LIMB_$endian + +#define LIMB_IS_LE $isle +#define LIMB_IS_BE $isbe +#define LIMB_IS_PDP $ispdp + +#endif /* LIMB_ENDIAN_H */ +EOF