-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
46 lines (32 loc) · 1.46 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
CXX = g++
LDLIBS = -lsfml-window -lsfml-graphics -lsfml-system -pthread
CXXFLAGS = -std=c++17 -O3 -Wall -Wextra -Wconversion
.SUFFIXES = .cpp .o
# define object files necessary for compiling
OBJS = ./bin/behavior.o ./bin/engine.o ./bin/map.o ./bin/map_behavior.o ./bin/metric.o ./bin/node.o # ./bin/simple_map_behavior.o ./bin/simple_map.o
# define dependencies that call for a recompile (can be made more specific to reduce redundant recompiles)
DEPS = ./util/*
# create output file
all: main
./main
main: main.cpp $(OBJS) $(DEPS)
$(CXX) $(CXXFLAGS) $(LDLIBS) main.cpp ./bin/*.o -o main
# clean output
.PHONY: clean
clean:
rm -rf ./bin
mkdir ./bin
# define how and when to compile an object file
# (TODO: replace with a general rule)
./bin/behavior.o : ./graphics/behavior.cpp ./graphics/behavior.hpp $(DEPS)
$(CXX) $(CXXFLAGS) -c $< -o ./bin/$(shell basename $@)
./bin/engine.o : ./graphics/engine.cpp ./graphics/engine.hpp $(DEPS)
$(CXX) $(CXXFLAGS) -c $< -o ./bin/$(shell basename $@)
./bin/map.o : ./algos/map.cpp ./algos/map.hpp $(DEPS)
$(CXX) $(CXXFLAGS) -c $< -o ./bin/$(shell basename $@)
./bin/map_behavior.o : ./algos/map_behavior.cpp ./algos/map_behavior.hpp $(DEPS)
$(CXX) $(CXXFLAGS) -c $< -o ./bin/$(shell basename $@)
./bin/metric.o : ./algos/metric.cpp ./algos/metric.hpp $(DEPS)
$(CXX) $(CXXFLAGS) -c $< -o ./bin/$(shell basename $@)
./bin/node.o : ./algos/node.cpp ./algos/node.hpp $(DEPS)
$(CXX) $(CXXFLAGS) -c $< -o ./bin/$(shell basename $@)