-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
52 lines (39 loc) · 1.35 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
# @file Makefile
# @brief This file is responsible for controlling the GNU Make command for easier building.
#
# @author Willow Ciesialka
# @date 2023-06-01
# Executable name
EXEC = golf_engine
# Compiler command
CC = g++
# Compiler flags
CFLAGS = -std=c++11 -Wall -Wextra -Wpedantic -Werror
# Linker flags
LFLAGS = -lsfml-graphics -lsfml-window -lsfml-system
# Source/Build Directories
SDIR = ./src
BDIR = ./build
# Source Files
SOURCE_PATHS = $(shell find $(SDIR) -iname "*.cpp")
# Sources/Build Object paths
CLASSES = GolfEngine/Rendering/Window GolfEngine/Geometry/Vector2 GolfEngine/Geometry/Line GolfEngine/Geometry/Shapes/Circle GolfEngine/Geometry/Shapes/Polygon GolfEngine/GameManagement/TileGeometry GolfEngine/GameManagement/Tilemap GolfEngine/GameManagement/Tile GolfEngine/GameManagement/Scene GolfEngine/GameManagement/Levels/Level GolfEngine/GameManagement/Levels/LevelA main
OBJECTS = $(addprefix $(BDIR)/,$(addsuffix .o, $(CLASSES)))
.PHONY: all run clean
# Build everything - default
all: $(EXEC).out
# Build and run
run: $(EXEC).out
./$<
# Clean - Delete build files and executables
clean:
rm -rf $(BDIR)
rm -f $(EXEC).out
# Executable
$(EXEC).out: $(OBJECTS)
$(CC) $^ -o $@ $(LFLAGS)
# Build files
$(BDIR)/%.o: $(SDIR)/%.cpp
@# Make the build directory if it doesn't exist
@if ! [ -d $(@D) ]; then mkdir -p $(@D); fi
$(CC) -c $^ -o $@ $(CFLAGS)