Welcome to the CHICKEN Scheme pasting service

build.zsh added by mdhughes on Sun Sep 1 05:54:38 2019

#!/bin/zsh

# EXE is binary filename
# MAIN is main script
# LIBS is space-delimited, must not include main script

function usage {
	echo "Usage: build.zsh PROJECT || MAIN.scm [LIBS] || ls || -?"
	exit 1
}

if [[ $# -eq 0 || "$1" == "-?" || "$1" == "--help" ]]; then
	usage
fi

case $1 in
	ls)
		echo "Known projects:"
		# Add known projects here
		echo "eldritch test"
		exit 0
	;;
	eldritch)
		EXE=eldritch
		MAIN=eldritch.scm
		LIBS="marklib.scm marklib-geometry.scm marklib-ansi.scm"
	;;
	test)
		EXE=marklib-test
		MAIN=marklib-test.scm
		LIBS="marklib.scm marklib-geometry.scm"
	;;
	*)
		# command-line project: MAIN=$1, LIBS=$2...
		EXE=`basename $1 .scm`
		MAIN=$1
		shift
		LIBS="$*"
	;;
esac

mkdir -p bin

cd src
for SF in ${=LIBS}; do
	SNAME=`basename $SF .scm`
	echo "Compiling $SF"
	csc -c -j $SNAME $SF -o $SNAME.o || exit 1
done
echo "Compiling $MAIN"
csc -c $MAIN -o `basename $MAIN .scm`.o || exit 1
echo "Linking..."
csc *.o -o ../bin/$EXE || exit 1
rm -f *.o
rm -f *.import.scm
cd ..

echo "Built bin/$EXE"

Your annotation:

Enter a new annotation:

Your nick:
The title of your paste:
Your paste (mandatory) :
Which module provides `string-intersperse'?
Visually impaired? Let me spell it for you (wav file) download WAV