mirror of
https://github.com/arkorty/ExprEvalplusplus.git
synced 2026-03-18 00:57:18 +00:00
Commit details: - Set optimization level to O3 and include pedantic warnings in CXXFLAGS. - Introduce separate build and source directories for better project organization. - Add a target to run tests with the ENABLE_TESTS macro. - Improve the 'all' target to create the build directory before building the executable. - Introduce a 'rebuild' target for cleaning and rebuilding the project. Changes made in Makefile: - Update CXXFLAGS with -O3 and -pedantic. - Introduce BUILD_DIR and SRC_DIR variables for better organization. - Modifie SOURCE to point to the source file within the source directory. - Update EXECUTABLE to exclude the file extension. - Update 'all' target to create the build directory. - Add 'test' target to run tests with the ENABLE_TESTS macro. - Add 'rebuild' target for cleaning and rebuilding the project.
31 lines
523 B
Makefile
31 lines
523 B
Makefile
CXX = clang++
|
|
CXXFLAGS = -O3 -std=c++17 -Wall -Wextra -pedantic
|
|
BUILD_DIR = build
|
|
SRC_DIR = src
|
|
SOURCE = ast.cxx
|
|
EXECUTABLE = ast
|
|
|
|
all: $(BUILD_DIR) $(BUILD_DIR)/$(EXECUTABLE)
|
|
|
|
$(BUILD_DIR):
|
|
mkdir -p $@
|
|
|
|
$(BUILD_DIR)/$(EXECUTABLE): $(SRC_DIR)/$(SOURCE) $(BUILD_DIR)
|
|
$(CXX) $(CXXFLAGS) -o $@ $<
|
|
|
|
.PHONY: run
|
|
run: $(BUILD_DIR)/$(EXECUTABLE)
|
|
./$<
|
|
|
|
.PHONY: test
|
|
test: CXXFLAGS += -DENABLE_TESTS
|
|
test: $(BUILD_DIR)/$(EXECUTABLE)
|
|
./$< --run-test
|
|
|
|
.PHONY: clean
|
|
clean:
|
|
rm -rf $(BUILD_DIR)
|
|
|
|
.PHONY: rebuild
|
|
rebuild: clean all
|