summaryrefslogtreecommitdiff
path: root/tools/gen-sysdepsh.sh
blob: 8373f8f971977d1a3ef7b93d111722b64382b444 (plain)
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
#!/bin/sh

cat <<EOF
/* ISC license. */

#ifndef SYSDEPS_H
#define SYSDEPS_H

#undef SKALIBS_TARGET
#define SKALIBS_TARGET "$1"

EOF

while read k v ; do
  k=$(echo "${k%%:}" | tr a-z A-Z)
  if test ${k} != ${k##SIGNED} ; then
    echo "#undef SKALIBS_HASUN$k"
    echo "#undef SKALIBS_HAS$k"
    if test $v = yes ; then
      echo "#define SKALIBS_HAS$k"
    else
      echo "#define SKALIBS_HASUN$k"
    fi
  elif test ${k} != ${k##SIZEOF} ; then
    echo "#undef SKALIBS_$k"
    echo "#define SKALIBS_$k $v"
  elif test ${k} = ENDIANNESS ; then
    echo '#undef SKALIBS_ENDIANNESS'
    echo "#define SKALIBS_ENDIANNESS \"$v\""
  else
    echo "#undef SKALIBS_HAS$k"
    if test $v = yes ; then
      echo "#define SKALIBS_HAS$k"
    fi
  fi
  echo
done

echo '#endif'