#!/bin/bash

CC=clang
CFLAGS="-g -c -Wall -Isrc/glad/include"
CXX=clang++
CXXFLAGS="-g -Wall -std=c++20 $(pkg-config --cflags sdl2) -Isrc/glad/include -Isrc/glm"
LIBS="$(pkg-config --libs sdl2) -ldl"
GLAD_SRC="src/glad/src/glad.c"
GLAD_OBJ="glad.o"
SRC="src/*.cc $GLAD_OBJ src/glm/glm/glm.cppm"
OUT=main

(set -x ; $CC $CFLAGS $GLAD_SRC -o $GLAD_OBJ)
(set -x ; $CXX $CXXFLAGS $LIBS $SRC -o $OUT)

if [[ -f $GLAD_OBJ ]]; then
	rm $GLAD_OBJ
fi
