-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
37 lines (27 loc) · 901 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
PROJECT_NAME := chip8
CC := gcc
WARNINGS := -Wall -Wextra -pedantic -Wshadow -Wpointer-arith -Wcast-align \
-Wwrite-strings -Wmissing-prototypes -Wmissing-declarations \
-Wredundant-decls -Wnested-externs -Winline \
-Wuninitialized -Wconversion -Wstrict-prototypes
CFLAGS := -g -std=c99 $(WARNINGS) `pkg-config --cflags --libs sdl2` -I /usr/include/SDL2
LDFLAGS :=
.PHONY: all clean
SRC_FILES := $(wildcard src/*.c)
OBJ_FILES := $(SRC_FILES:.c=.o)
DEPFILES := $(SRC_FILES:.c=.d)
LIBS := -lSDL2
all: $(PROJECT_NAME)
run: all
echo
echo ----------------------------------------------------------------------
echo
./$(PROJECT_NAME).out
test: run clean
$(PROJECT_NAME): $(OBJ_FILES)
$(CC) $(LDFLAGS) $^ -o $@.out $(LIBS)
%.o: %.c
$(CC) $(CFLAGS) -MMD -MP -c $< -o $@ $(LIBS)
clean:
rm $(OBJ_FILES) $(DEPFILES) $(PROJECT_NAME).out
-include $(DEPFILES)