-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
32 lines (25 loc) · 833 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
CC := g++
CXX_FLAGS := -std=c++11 -Wall -Wextra -Wno-format
LINK_FLAGS := -lmingw32 -lSDL2main -lSDL2 -lSDL2_ttf -lSDL2_image -lcpr -lfmt
RESOURCE_FLAGS := "./res/Resource.res"
TARGET := Overlay
BUILD_DIR := #./
BINARY := ${BUILD_DIR}$(TARGET)
BUILD_TYPE := default
.PHONY: all debug release
all: release
debug: BUILD_TYPE := debug
release: BUILD_TYPE := release
debug: CXX_FLAGS += -g -Og -DDEBUG
release: CXX_FLAGS += -O2 -DNDEBUG -mwindows
debug: build
release: build
# Do not call this rule directly
build:
$(if $(strip $(subst $(BUILD_TYPE),,default)),,$(error Invalid build type [debug/release]))
@echo Compiling $(BUILD_TYPE) build...
$(CC) $(TARGET).cpp $(RESOURCE_FLAGS) $(CXX_FLAGS) $(LINK_FLAGS) -o $(BINARY).exe
@echo Successfully compiled the $(BUILD_TYPE) build!
# Other rules
clean:
del /s "$(BINARY)".exe