#!/bin/sh
# helper script for compiling a fwd program.
# assumes it is being run from the root dir of the fwd sources.

if [ "$#" -ne 2 ]; then
	echo "usage: fwdc <input file> <output binary>"
	echo "currently also produces <output binary>.c for inspection"
	exit 1
fi

SRC="$1"
DST="$2"

./fwd "$SRC" > "$DST".c

cc -O3 -mno-sse                    \
	-L mod -I include -I lib   \
	-Wl,-rpath=$PWD/mod        \
	"$DST".c -o "$DST"         \
	-lfwdio -lfwdmem -lfwdutil
