#!/bin/bash

CC=clang
WAPP_INCLUDE="$(find intern/wapp/src -type d | xargs -I{} echo -n "-I{} ")"
WAPP_SRC="$(find intern/wapp/src -type f -name "*.c" | xargs -I{} echo -n "{} ")"
TINYRENDER_INCLUDE="$(find src -type d | xargs -I{} echo -n "-I{} ")"
TINYRENDER_SRC="$(find src -type f -name "*.c" | xargs -I{} echo -n "{} ")"
CFLAGS="-g $TINYRENDER_INCLUDE $WAPP_INCLUDE"
LIBS="-lm"
SRC="$TINYRENDER_SRC $WAPP_SRC"
OUT=tiny

(set -x ; $CC $CFLAGS $LIBS $SRC -o $OUT)
