-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
44 lines (32 loc) · 993 Bytes
/
Makefile
File metadata and controls
44 lines (32 loc) · 993 Bytes
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
#I have not added header tracking, \
so just clean and remake when a header file changes
EXE = chip8
SRC_DIR = src
TST_DIR = tst
OBJ_DIR = bin/obj
OUTPUT_DIR = bin
SRC = $(wildcard $(SRC_DIR)/*.c)
OBJ = $(SRC:$(SRC_DIR)/%.c=$(OBJ_DIR)/%.o)
HEADERS = $(wildcard $(SRC_DIR)/*.h)
CPPFLAGS += -Iinclude
CFLAGS += -Wall -std=c11
LDFLAGS += -Llib
LDLIBS += -lm
.PHONY: all clean format fresh
all: $(EXE)
$(EXE): $(OBJ)
$(CC) $(LDFLAGS) $^ $(LDLIBS) -o $(OUTPUT_DIR)/$@ -Iinclude -lpthread -Llib -lSDL2 -lSDL2main
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.c
$(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
clean:
$(RM) $(OBJ)
$(RM) $(OUTPUT_DIR)/$(EXE)
format:
clang-format -i $(SRC_DIR)/*.c $(SRC_DIR)/*.h
clang-format -i $(TST_DIR)/*.c
black python/*.py --line-length 120
fresh: clean format all test
# TODO: clean up this target eventually
test:
gcc -std=c11 tst/test_chip8.c src/chip8.c -o bin/tst/chip8 && ./bin/tst/chip8
python3 python/test.py