diff options
Diffstat (limited to 'subx/gen')
-rwxr-xr-x | subx/gen | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/subx/gen b/subx/gen index 91370ea4..a2f1de4a 100755 --- a/subx/gen +++ b/subx/gen @@ -1,11 +1,26 @@ -#!/usr/bin/env zsh -# Build commonly-used SubX programs. +#!/bin/sh +# Little helper to quickly build SubX programs from the commandline. +# Only works for programs in some standard places the repo knows about. + +if [ $# -eq 0 ] +then + echo "Usage: $0 <file root without subdirectory or .subx extension>" + echo + echo "Naming convention: Files starting with 'ex' will be assumed to live in examples/ and be self-contained." + echo "Other files will be assumed to live in apps/ and need the standard library." + exit 1 +fi + +# Build in debug mode since the common case at the moment is building small +# files. To override, calling scripts should do their own builds to ensure +# subx_bin is up to date. +export CFLAGS=-g if [[ $1 == 'ex'* ]] then - CFLAGS=-g ./subx translate examples/$1.subx -o examples/`echo $1 |sed 's/\..*//'` + ./subx translate examples/$1.subx -o examples/`echo $1 |sed 's/\..*//'` exit $? fi -CFLAGS=-g ./subx translate *.subx apps/$1.subx -o apps/`echo $1 |sed 's/\..*//'` +./subx translate *.subx apps/$1.subx -o apps/`echo $1 |sed 's/\..*//'` exit $? |