UNITYPATH = test/unity
INC := -I include
UNITY := -I $(UNITYPATH)

all: compile link

compile:
	gcc $(INC) -c -o build/main.o src/main.c
	gcc $(INC) -c -o build/stuffy.o src/stuffy.c

link:
	gcc -o bin/stuffy.out build/stuffy.o build/main.o

test: testCompile testLink testExec

testCompile:
	gcc $(INC) $(UNITY) -g -c -o build/unity.o $(UNITYPATH)/unity.c
	gcc $(INC) -c -o build/main.o src/main.c
	gcc $(INC) -g -c -o build/stuffy.o src/stuffy.c
	gcc $(INC) -g -c -o build/test.o test/test.c

testLink:
	gcc -g -o bin/test.out build/stuffy.o build/test.o build/unity.o
	gcc -o bin/stuffy.out build/stuffy.o build/main.o

testExec:
	./bin/test.out

clean:
	rm build/*.o
	rm bin/*.out