CC=tcc
CFLAGS=-O0 -ggdb -Wall

.PHONY: all clean install

all: tbuild

tbuild: main.o tomlc99/toml.o
	$(CC) $(CFLAGS) tomlc99/toml.o main.o -o tbuild

main.o: main.c
	$(CC) $(CFLAGS) -c main.c -o main.o

tomlc99/toml.o:
	cd tomlc99 && $(MAKE) && cd ..

clean:
	rm -f tbuild main.o tomlc99/toml.o

install:
ifeq ($(OS),Windows_NT)
	mkdir "C:\tbuild" ; \
	copy tbuild "C:\tbuild" ; \
	copy RedSeaGen.exe "C:\tbuild" ;
else
	install tbuild /usr/local/bin
	install RedSeaGen /usr/local/bin
endif

