-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
40 lines (30 loc) · 989 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
39
40
CURRENT_DIR := $(shell pwd)
CXX := g++
EXE := digitrec
HEADERS_DIR := include/
SOURCE_DIR := src/
BUILD_DIR := build/
CXX_OPTIONS := -Wall
LIBRARIES := -loglopp
LINK_OPTIONS := -L../usr/lib -lglfw -lglad -loglopp
COMPILE_OPTIONS := -I../usr/include -I$(HEADERS_DIR) -g3 -O0
SOURCE_FILES := $(wildcard $(SOURCE_DIR)*.cpp) $(wildcard $(SOURCE_DIR)*/*.cpp)
OBJECT_FILES := $(patsubst $(SOURCE_DIR)%.cpp,$(BUILD_DIR)%.o,$(SOURCE_FILES))
.PHONY: all
all: $(EXE)
$(EXE): $(OBJECT_FILES)
$(CXX) $(CXX_OPTIONS) $^ -o $@ $(LINK_OPTIONS)
$(BUILD_DIR)%.o: $(SOURCE_DIR)%.cpp
-mkdir -p $(dir $@)
$(CXX) $(CXX_OPTIONS) -c $(COMPILE_OPTIONS) $^ -o $@
.PHONY: clean
clean:
rm -r $(BUILD_DIR) $(EXE)
.PHONY: rebuild
rebuild: clean all
.PHONY: help
help:
@echo make ---------- Compile and link
@echo make clean ---- Remove all object files
@echo make rebuild -- Same as \`"make clean ; make"\` - Cleaning is required to \"rebuild\" header files
@echo make help ----- Show this help menu