-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
52 lines (37 loc) · 1.07 KB
/
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
# Compiler
# CC := gcc
# Directories
SRC_DIR := src
BUILD_DIR := build
# Source files
SRCS := $(wildcard $(SRC_DIR)/*.c)
# Object files
DEBUG_OBJS := $(patsubst $(SRC_DIR)/%.c,$(BUILD_DIR)/debug/%.o,$(SRCS))
RELEASE_OBJS := $(patsubst $(SRC_DIR)/%.c,$(BUILD_DIR)/release/%.o,$(SRCS))
# Executable file
TARGET := Azzian
# Compiler flags
DEBUG_CFLAGS := -ggdb -DDEBUG -Wall -Wextra -std=c17 -Iinclude -isystemlib
RELEASE_CFLAGS := -Ofast -DNDEBUG -Wall -Wextra -std=c17 -Iinclude -isystemlib
# Linker flags
LDFLAGS := -lraylib -lm
.PHONY: all debug release embed fmt clean
# Build target
all: debug
debug: $(DEBUG_OBJS)
$(CC) $^ -o $(TARGET) $(LDFLAGS)
release: $(RELEASE_OBJS)
$(CC) $^ -o $(TARGET) $(LDFLAGS)
# Compile source files
$(BUILD_DIR)/debug/%.o: $(SRC_DIR)/%.c
@mkdir -p $(BUILD_DIR)/debug
$(CC) $(DEBUG_CFLAGS) -c $< -o $@
$(BUILD_DIR)/release/%.o: $(SRC_DIR)/%.c
@mkdir -p $(BUILD_DIR)/release
$(CC) $(RELEASE_CFLAGS) -c $< -o $@
embed: embed_assets.py
python $< $(SRC_DIR)/*.c
fmt:
clang-format -i src/*.c include/*.h
clean:
$(RM) -r -- $(BUILD_DIR) $(TARGET)