-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
40 lines (30 loc) · 819 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
# Make the interpreter.
CC = gcc
CCFLAGS = -Wall -Werror -Wpedantic -Wextra -Wwrite-strings -Warray-bounds \
-Weffc++ --std=c++20 -O0 \
$(shell pkgconf sdl2 --cflags)
LDFLAGS = -lstdc++ -lpthread \
$(shell pkgconf sdl2 --libs) -lSDL2_ttf -lSDL2_image -lSDL2_mixer
DEBUG_INFO = no
ifeq ($(DEBUG_INFO), yes)
CCFLAGS += -g
endif
BIN = chip8
BIN_FLAGS = test_opcode.ch8
SRCS = main.cc
OBJS = $(SRCS:.cc=.o)
DEPS = $(SRCS:.cc=.d)
.PHONY: all clean test leaks
all: $(BIN)
$(BIN): $(OBJS)
ctags -R
$(CC) $(CCFLAGS) $(LDFLAGS) -o $@ $^
-include $(DEPS)
%.o: %.cc Makefile
$(CC) $(CCFLAGS) -MMD -MP -c -o $@ $<
test: $(BIN)
./$< $(BIN_FLAGS)
leaks: $(BIN)
valgrind -s --leak-check=full --show-leak-kinds=all ./$<
clean:
rm -f *.o *.d $(BIN) tags