File: make-hugs.sh

package info (click to toggle)
haskell-splitmix 0.1.0.5-2
  • links: PTS
  • area: main
  • in suites: forky, sid, trixie
  • size: 196 kB
  • sloc: haskell: 1,366; ansic: 151; sh: 53; makefile: 9
file content (31 lines) | stat: -rw-r--r-- 678 bytes parent folder | download | duplicates (3)
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
#!/bin/sh

set -e

TOPDIR=$(dirname "$0")
TARGETDIR=$TOPDIR/splitmix-hugs

while getopts 't:' opt
do
  case "$opt" in
    t) TARGETDIR=$OPTARG ;;
	*) echo "Unknown flag $opt"; exit 1 ;;
  esac
done

# Check tool availability
cpphs --version

# For each of the source files
find "$TOPDIR/src" "$TOPDIR/src-compat" -name '*.hs' | while read -r src; do
   tgt="$TARGETDIR/$(echo "$src" | sed "s/^$TOPDIR\/src"'\(-compat\|\)//')"

   echo "Processing $src -> $tgt"

   mkdir -p "$(dirname "$tgt")"
   cpphs --noline -D__HUGS__=1 "$src" > "$tgt"
done

echo "A Hugs-compatible version of splitmix is now"
echo "available in the splitmix-hugs directory."
echo "Load it with hugs -98."