summaryrefslogtreecommitdiff
path: root/Makefile
blob: 2ffa1b80ab72b4c080959bd1b5d904a26af3d76f (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
30
31
32
33
34
35
36
37
38
39
40
CC=gcc
CFLAGS=-g -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
GRAPHICS=build/icon.png build/icon.pdf
DOCS=build/docs/README.pdf build/docs/ROADMAP.pdf

all: build $(OBJ) $(TESTS) $(LIMOX) $(DOCS) $(GRAPHICS)

build:
	mkdir -p build/tests
	mkdir -p build/docs

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

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

build/%.png: %.svg
	inkscape $< -o $@ -w 256 -h 256

build/%.pdf: %.svg
	inkscape $< -o $@ -w 256 -h 256

build/docs/%.pdf: %.md $(GRAPHICS)
	pandoc -o $@ $<

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

.PHONY: clean

clean:
	rm -rf build