Skip to content

Commit ca7c2a3

Browse files
committed
chore(make): add check for BUILD
1 parent da586d2 commit ca7c2a3

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

Makefile

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,21 @@ CXX ?= clang++
22
CABIN_TIDY ?= clang-tidy
33
PREFIX ?= /usr/local
44
INSTALL ?= install
5+
BUILD ?= dev
56
COMMIT_HASH ?= $(shell git rev-parse HEAD)
67
COMMIT_SHORT_HASH ?= $(shell git rev-parse --short=8 HEAD)
78
COMMIT_DATE ?= $(shell git show -s --date=format-local:'%Y-%m-%d' --format=%cd)
89

910
CXXFLAGS := -std=c++$(shell grep -m1 edition cabin.toml | cut -f 2 -d'"')
1011
CXXFLAGS += -fdiagnostics-color
1112
CXXFLAGS += $(shell grep cxxflags cabin.toml | head -n 1 | sed 's/cxxflags = \[//; s/\]//; s/"//g' | tr ',' ' ')
12-
ifeq ($(BUILD),release)
13-
CXXFLAGS += -O3 -DNDEBUG -flto
14-
LDFLAGS += -flto
13+
ifeq ($(BUILD),dev)
14+
CXXFLAGS += -g -O0 -DDEBUG
15+
else ifeq ($(BUILD),release)
16+
CXXFLAGS += -O3 -DNDEBUG -flto
17+
LDFLAGS += -flto
1518
else
16-
CXXFLAGS += -g -O0 -DDEBUG
19+
$(error "Unknown BUILD: `$(BUILD)'. Use `dev' or `release'.")
1720
endif
1821
TEST_CXXFLAGS := $(CXXFLAGS) -fsanitize=undefined
1922
TEST_LDFLAGS := $(LDFLAGS) -fsanitize=undefined

0 commit comments

Comments
 (0)