-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
49 lines (33 loc) · 950 Bytes
/
Copy pathMakefile
File metadata and controls
49 lines (33 loc) · 950 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
43
44
45
46
47
48
49
# Compiler
CC = g++
# Compiler flags
CFLAGS = -Wall -Wextra -std=c++20 -I./SDL2.framework/Headers
# Debug compiler flags
DEBUG_CFLAGS = -g # Add debugging information
# Linker flags to include the SDL2 framework
LDFLAGS = -F. -framework SDL2
# Source files
SRC := $(shell find . -type f -name '*.cpp')
# Executable names
RELEASE_EXE = release
DEBUG_EXE = debug
# Phony targets
.PHONY: all clean run restart all_debug rebuild
all: release
release: $(RELEASE_EXE)
debug: $(DEBUG_EXE)
$(RELEASE_EXE): $(SRC)
$(CC) $(CFLAGS) $^ -o $(RELEASE_EXE) $(LDFLAGS)
install_name_tool -add_rpath @loader_path/ $(RELEASE_EXE)
$(DEBUG_EXE): $(SRC)
$(CC) $(DEBUG_CFLAGS) $(CFLAGS) $^ -o $(DEBUG_EXE) $(LDFLAGS)
install_name_tool -add_rpath @loader_path/ $(DEBUG_EXE)
clean:
rm -f $(RELEASE_EXE) $(DEBUG_EXE)
run: release
./$(RELEASE_EXE)
run_debug: debug
./$(DEBUG_EXE)
restart: clean all run
# New target for debug build
rebuild: clean debug