-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakefile
More file actions
42 lines (31 loc) · 957 Bytes
/
makefile
File metadata and controls
42 lines (31 loc) · 957 Bytes
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
CC = clang++
CFLAGS = -std=c++23 -Wall -Wextra -O2
LFLAGS = -lsfml-graphics -lsfml-window -lsfml-system -lsfml-audio
BINARY = bin/smarttalesii
SRC_DIR = smart_tales_ii
CPPS = $(shell find $(SRC_DIR) -name *.cpp)
OBJS = $(patsubst %.cpp, %.o, $(CPPS))
# Gcc/Clang will create these .d files containing dependencies.
DEPS = $(patsubst %.cpp, %.d, $(CPPS))
.PHONY: all check syntax clean format
all: $(BINARY)
check: $(BINARY)
cd bin && ./smarttalesii debug
syntax: $(CPPS)
$(CC) -fsyntax-only $(CPPS)
clean:
-rm $(OBJS)
-rm $(DEPS)
-rm $(BINARY)
format:
clang-format -i ${CPPS}
clang-format -i $(shell find ${SRC_DIR} -name '*.hpp')
-include $(DEPS)
%.o: %.cpp
$(CC) $(CFLAGS) -MMD -c $< -o $@
# Actual target of the binary - depends on all .o files.
# The @D you're seeing here and elsewhere simply means the directory of the file
# we're making.
$(BINARY): $(OBJS)
mkdir -p $(@D)
$(CC) $(CFLAGS) $(OBJS) $(LFLAGS) -o $(BINARY)