#!/bin/sh

# compile the shmall C compiler from source to native binary for target machine

# first build shmall C compiler source

SRC=src

cat \
  $SRC/shmall/consts.h \
  $SRC/shmall/vars.h \
  $SRC/shmall/forwards.c \
  $SRC/shmall/wrappers.c \
  $SRC/shmall/pool.c \
  $SRC/shmall/error.c \
  $SRC/shmall/vector.c \
  $SRC/shmall/gen.c \
  $SRC/shmall/hash.c \
  $SRC/shmall/atoi.c \
  $SRC/shmall/clex.c \
  $SRC/shmall/init.c \
  $SRC/shmall/keywords.c \
  $SRC/shmall/symbol-tables.c \
  $SRC/shmall/cons.c \
  $SRC/shmall/stack.c \
  $SRC/shmall/shunt.c \
  $SRC/shmall/binary-tree.c \
  $SRC/shmall/recursive-descent.c \
  $SRC/shmall/clean.c \
  $SRC/shmall/main.c \
  | sed -e 's/\r$//' > shmall.c

# compile shmall C compiler

./compile-with-shmall-to-native.sh shmall vm 5000000

# rm shmall.c
