File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,17 @@ CXXFLAGS := -std=c++17 -Iinclude -I/usr/include/gtest -Wall -Wextra -Werror
4
4
GTEST_DIR := /usr/include/gtest
5
5
GTEST_LIB_DIR := /usr/lib/x86_64-linux-gnu
6
6
7
+ # Build type (debug or release)
8
+ BUILD_TYPE ?= release
9
+
10
+ ifeq ($(BUILD_TYPE ) , debug)
11
+ CXXFLAGS += -O0 -g
12
+ else ifeq ($(BUILD_TYPE), release)
13
+ CXXFLAGS += -O3
14
+ else
15
+ $(error Unknown BUILD_TYPE "$(BUILD_TYPE)")
16
+ endif
17
+
7
18
# Directories
8
19
SRC_DIR := src
9
20
INCLUDE_DIR := include
@@ -16,7 +27,7 @@ SRCS := $(wildcard $(SRC_DIR)/*.cpp)
16
27
OBJS := $(patsubst $(SRC_DIR ) /% .cpp, $(BUILD_DIR ) /% .o, $(SRCS ) )
17
28
18
29
# Object files excluding the main program
19
- TEST_OBJS := $(filter-out $(BUILD_DIR ) /mian .o, $(OBJS ) )
30
+ TEST_OBJS := $(filter-out $(BUILD_DIR ) /main .o, $(OBJS ) )
20
31
21
32
# Target executable
22
33
TARGET := scanner
@@ -62,5 +73,4 @@ test: $(TEST_OBJS) | $(BUILD_DIR)
62
73
-o $(BUILD_DIR ) /$(TEST_FILE ) _test && ./$(BUILD_DIR ) /$(TEST_FILE ) _test; \
63
74
fi
64
75
65
-
66
76
.PHONY : all clean run test
You can’t perform that action at this time.
0 commit comments