-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
56 lines (41 loc) · 1.07 KB
/
Makefile
File metadata and controls
56 lines (41 loc) · 1.07 KB
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
SHELL = /bin/sh
CC = gcc
LIBS = -lm -lglfw -ldl
FLAGS = -Wall -Wextra -Wunused -Iinclude/
ifeq "$(shell sdl2-config --version > /dev/null && echo 1 || echo 0 )" "1"
LIBS += -lSDL2
FLAGS += -DSOUND
endif
SRC_DIR = src
SOURCE_FILES = $(wildcard $(SRC_DIR)/*.c)
BUILD_DIR = build
OBJ_FILES = $(patsubst $(SRC_DIR)/%.c, $(BUILD_DIR)/%.o, $(SOURCE_FILES))
TARGET = tetris.out
target: $(BUILD_DIR) | $(TARGET)
all: FLAGS += -O3
all: target
debug: FLAGS += -g -ggdb
debug: target
debugOutput: FLAGS += -DDEBUG
debugOutput: debug
log: debug
log:
./$(TARGET) > log
valgrind:
valgrind ./$(TARGET)
$(TARGET) : $(OBJ_FILES)
$(CC) -o $(TARGET) $(OBJ_FILES) $(LIBS)
$(BUILD_DIR) :
mkdir -p $@
$(BUILD_DIR)/main.o : include/log.h include/obj.h
$(BUILD_DIR)/obj.o : include/obj.h
$(BUILD_DIR)/bitmap.o : include/bitmap.h
$(BUILD_DIR)/render.o: include/render.h
$(BUILD_DIR)/engine.o : include/engine.h
$(BUILD_DIR)/helper.o : include/helper.h
$(BUILD_DIR)/audio.o : include/audio.h
$(BUILD_DIR)/%.o : $(SRC_DIR)/%.c
$(CC) -o $@ -c $(FLAGS) $<
.PHONY : clean
clean :
rm -rf build $(TARGET)