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
44GTEST_DIR := /usr/include/gtest
55GTEST_LIB_DIR := /usr/lib/x86_64-linux-gnu
66
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+
718# Directories
819SRC_DIR := src
920INCLUDE_DIR := include
@@ -16,7 +27,7 @@ SRCS := $(wildcard $(SRC_DIR)/*.cpp)
1627OBJS := $(patsubst $(SRC_DIR ) /% .cpp, $(BUILD_DIR ) /% .o, $(SRCS ) )
1728
1829# 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 ) )
2031
2132# Target executable
2233TARGET := scanner
@@ -62,5 +73,4 @@ test: $(TEST_OBJS) | $(BUILD_DIR)
6273 -o $(BUILD_DIR ) /$(TEST_FILE ) _test && ./$(BUILD_DIR ) /$(TEST_FILE ) _test; \
6374 fi
6475
65-
6676.PHONY : all clean run test
You can’t perform that action at this time.
0 commit comments