-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
58 lines (46 loc) · 956 Bytes
/
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
CC = cc
INCLUDE = -Iinclude
CFLAGS = -W -Wall -Wextra -O2 -pipe $(INCLUDE)
LDFLAGS = $(shell sdl2-config --libs)
SRC = main.c \
emulator.c \
logger.c \
system.c \
audio.c \
display.c \
cpu.c \
opcodes/opcode_0.c \
opcodes/opcode_1.c \
opcodes/opcode_2.c \
opcodes/opcode_3.c \
opcodes/opcode_4.c \
opcodes/opcode_5.c \
opcodes/opcode_6.c \
opcodes/opcode_7.c \
opcodes/opcode_8.c \
opcodes/opcode_9.c \
opcodes/opcode_A.c \
opcodes/opcode_B.c \
opcodes/opcode_C.c \
opcodes/opcode_D.c \
opcodes/opcode_E.c \
opcodes/opcode_F.c
OBJ = $(SRC:%.c=obj/%.o)
DEP = $(OBJ:.o=.d)
BINARY = chip8
ifdef DEBUG
CFLAGS += -g
endif
.PHONY: all clean fclean re
all: $(BINARY)
$(BINARY): $(OBJ)
$(CC) -o $@ $(CFLAGS) $^ $(LDFLAGS)
obj/%.o: src/%.c
@mkdir -p "$(shell dirname -- $@)"
$(CC) $(CFLAGS) -MMD -o $@ -c $<
clean:
rm -rf obj
fclean: clean
rm -f $(BINARY)
re: fclean all
-include $(DEP)