-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
executable file
·68 lines (51 loc) · 1.54 KB
/
Makefile
File metadata and controls
executable file
·68 lines (51 loc) · 1.54 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
57
58
59
60
61
62
63
64
65
66
67
68
#################################
# Sources #
#################################
SRCS = src/main.cpp \
src/glad.c \
src/engine/Shader.cpp \
src/engine/Camera.cpp \
src/engine/OrbitCamera.cpp \
src/engine/Texture.cpp \
src/engine/Mesh.cpp \
src/utils/FileSystem.cpp \
src/maths/Mat4.cpp \
src/maths/Vec3.cpp \
src/maths/Vec2.cpp \
src/maths/Utils.cpp \
OBJS = $(filter %.o, $(SRCS:.cpp=.o) $(SRCS:.c=.o))
#################################
# Constants #
#################################
NAME = scop
CC = gcc
CXX = c++
CXXFLAGS = -Wall -Wextra -Werror
INCLUDES = -Iinclude
LIBS = -lglfw -lGL
#################################
# Targets #
#################################
%.o: %.cpp
$(CXX) $(CXXFLAGS) $(INCLUDES) -c $< -o $@
%.o: %.c
$(CC) $(CXXFLAGS) $(INCLUDES) -c $< -o $@
all: $(NAME)
## Explanation to why Objects before Libraries
#####
# Linker Order Explanation:
# In the linking process, order matters. The linker processes files from left to right.
# Listing object files before libraries ensures that any unresolved references in the
# object files can be resolved by definitions in the libraries that follow.
$(NAME): $(OBJS)
$(CXX) $(CXXFLAGS) $(INCLUDES) $^ $(LIBS) -o $(NAME)
run: $(NAME)
./$(NAME)
debug:
make -sC ./ CXXFLAGS="$(CXXFLAGS) -g -fsanitize=address -DDEBUG" re
clean:
rm -f $(OBJS)
fclean: clean
rm -f $(NAME)
re: fclean all
.PHONY: all clean fclean re debug run