summaryrefslogtreecommitdiff
path: root/Makefile
blob: cfe05e714b2a8f44bb308a30ec5863e5f98197d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
CC=gcc
CFLAGS=-I. -lSDL2
SRC:=$(shell find ./ -maxdepth 1 -type f -regex ".*\.c" -not -name "main.c")
OBJ:=$(patsubst ./%.c,build/%.o,$(SRC))
_TESTS:=$(shell find ./tests/ -maxdepth 1 -type f -regex ".*\.c")
TESTS:=$(patsubst ./%.c,build/%,$(_TESTS))

LIMOX=build/limox

all: build $(OBJ) $(TESTS) $(LIMOX)
	@echo "Running testsuite ..."
	find build/tests -type f -exec {} \;

build:
	mkdir -p build/tests

$(LIMOX): $(OBJ) build/main.o
	$(CC) -o $@ $^ $(CFLAGS)

build/%.o: %.c
	$(CC) -c -o $@ $< $(CFLAGS)

build/tests/%: tests/%.c
	$(CC) -o $@ $< $(OBJ) $(CFLAGS)

.PHONY: clean

clean:
	rm -rf build