-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
56 lines (36 loc) · 1.26 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
53
54
55
56
### yes, I took it from my last project. Deal. With. It.
# SECTION: VARIABLES
## The compiler
CC = g++
## Additional flags
FLAGS = -g
## Language modifier
LANGUAGE = c++11
## The executable
TARGET = ConcordiaGame
## Headers' inclusion
INCLUDES = -I ./include
## SFML
SFML = -lsfml-graphics -lsfml-window -lsfml-system -lsfml-audio
## Objects directory
OBJS-DIR = ./bin
## Source files directory
SRC = ./src
## The source code files
CPPS = $(wildcard $(SRC)/*.cpp)
## Objects required by main
OBJS = $(addprefix $(OBJS-DIR)/,$(notdir $(CPPS:.cpp=.o)))
# SECTION: COMPILING
## Structure: ENTITY : DEPENDENCY
## About variables: $@ refers to the ENTITY. $< refers to the first DEPENDENCY. $^ refers to the entire DEPENDENCY.
## For all entries, the dependency is the target file.
all : $(TARGET)
## To satisfy the target file dependency above, we need the objects.
$(TARGET) : $(OBJS)
$(CC) $(FLAGS) -std=$(LANGUAGE) ./$^ $(SFML) -o ./bin/$@
## To satisfy the objects dependency above, we need the source code files.
$(OBJS-DIR)/%.o: $(SRC)/%.cpp
$(CC) $(FLAGS) -c $(INCLUDES) ./$< -o ./$@
## For entry "clean" (make clean), delete the objects and the executable.
clean :
$(RM) $(OBJS-DIR)/*.o $(OBJS-DIR)/$(TARGET)