-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
63 lines (49 loc) · 1.31 KB
/
Makefile
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
.PHONY: default all test debug clean
CC ?= gcc
STD := c99
SHELL := /usr/bin/env bash
SOURCES := src/tinycols/*.c src/queue.c
INCDIR := include/
INCLUDES = $(shell find $(INCDIR) -type f -name *.h)
INC := -I ${INCLUDES}
COMPILE := -DLINUX_TARGET -Wall -pedantic -std=${STD}
CFLAGS := ${COMPILE}
DBG_CFLAGS := -g -p -Werror -fsanitize=address -fsanitize=undefined
default: build/tinycols
debug: build/tinycols-debug
all: default test
build:
@mkdir build
build/test_tinycols: build
@${CC} ${CFLAGS} ${DBG_CFLAGS} \
-D_POSIX_C_SOURCE=199309L \
-o build/test_tinycols \
lib/*.c tests/test_tinycols.c ${SOURCES}
build/test_queue: build
@${CC} ${CFLAGS} ${DBG_CFLAGS} \
-D_POSIX_C_SOURCE=199309L \
-o build/test_queue \
lib/*.c src/queue.c src/tinycols/*.c tests/test_queue.c
build/tinycols: build
@${CC} ${CFLAGS} \
-std=gnu99 \
-lncurses \
-o $@ \
src/main.c src/gfx.c ${SOURCES}
build/tinycols-dbg: build
@${CC} ${CFLAGS} ${DBG_CFLAGS} \
-std=gnu99 \
-lncurses \
-o $@ \
src/main.c src/gfx.c ${SOURCES}
build/tinycols-debug: build
@${CC} ${CFLAGS} ${DBG_CFLAGS} -std=gnu99 -lncurses \
-o build/tinycols-debug \
src/main.c src/gfx.c ${SOURCES}
tests: build/test_tinycols build/test_queue
test:
@build/test_tinycols
@build/test_queue
debug: build/tinycols-dbg
clean:
@rm -rf build