-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
38 lines (30 loc) · 816 Bytes
/
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
TITLE = find-your-way
CXX = g++
STANDARD = -std=c++17
DEBUG = -g
INCLUDE = -I./include
CXXFLAGS = -Wall -Wextra -O2 $(STANDARD) $(INCLUDE) $(DEBUG)
LDFLAGS = -lGL -lGLU -lglut -lm
BIN = build
MAIN = main.cpp
MAINOBJ = $(BIN)/$(MAIN:.cpp=.o)
SRC = $(wildcard src/*.cpp)
HEAD = $(patsubst src/%.cpp, include/%.hpp, $(SRC))
HEADONLY = $(wildcard include/*.hpp include/opt/*.hpp)
OBJ = $(patsubst src/%.cpp, $(BIN)/%.o, $(SRC))
TARGET = $(BIN)/$(TITLE)
.PHONY: clean zip
all: $(BIN) $(TARGET)
$(TARGET): $(OBJ) $(MAINOBJ)
$(CXX) $(CXXFLAGS) -o $@ $^ $(LDFLAGS)
$(MAINOBJ): $(MAIN) $(HEADONLY)
$(CXX) $(CXXFLAGS) -c -o $@ $<
$(BIN)/%.o: src/%.cpp include/%.hpp
$(CXX) $(CXXFLAGS) -c -o $@ $<
$(BIN):
@test ! -d $@ && mkdir $@
clean:
rm -rf $(BIN)
rm -f ~*
zip:
zip -r $(TITLE).zip ./