Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions .github/workflows/c-cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ jobs:
- uses: actions/checkout@main
- name: c++ --version
run: c++ --version
- name: make all -j 8
run: make all -j 8
- name: make exprtk_test
run: make exprtk_test
- name: exprtk_test
run: ./bin/exprtk_test
- name: make example
run: make example
- name: make build
run: make build
27 changes: 19 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,32 +1,43 @@

COMPILER := -c++
#COMPILER := -clang++
OPTIMIZATION_OPT := -O2 -DNDEBUG -Dexprtk_disable_caseinsensitivity
OPTIMIZATION_OPT := -O2 -DNDEBUG
BASE_OPTIONS := -pedantic-errors -Wall -Wextra -Werror -Wno-long-long
OPTIONS := $(BASE_OPTIONS) $(OPTIMIZATION_OPT)
LINKER_OPT := -L/usr/lib -lstdc++ -lm
ASAN_OPT := -g -fsanitize=address -fno-omit-frame-pointer
# Suppress GCC var-tracking notes on very large template functions (e.g. run_test02).
ASAN_OPT := -g -fsanitize=address -fno-omit-frame-pointer -fno-var-tracking-assignments
ASAN_BUILD_OPTIONS := $(BASE_OPTIONS) $(ASAN_OPT) -O1
MSAN_OPT := -g -fsanitize=memory -fno-omit-frame-pointer
LSAN_OPT := -g -fsanitize=leak -fno-omit-frame-pointer
USAN_OPT := -g -fsanitize=undefined -fno-omit-frame-pointer
BIN_DIR := bin
vpath %.cpp example test
BUILD_SRC := $(sort $(wildcard example/exprtk_*.cpp) $(wildcard test/exprtk_*.cpp))
BUILD_LIST := $(sort $(foreach f,$(BUILD_SRC),$(notdir $(f:.cpp=))))
BIN_TARGETS := $(addprefix $(BIN_DIR)/,$(BUILD_LIST))


all: $(BIN_TARGETS)
TEST_SRC := $(sort $(wildcard test/exprtk_*.cpp))
EXAMPLE_SRC := $(sort $(wildcard example/exprtk_*.cpp))
BUILD_LIST := $(sort $(foreach f,$(TEST_SRC) $(EXAMPLE_SRC),$(notdir $(f:.cpp=))))
BIN_TARGETS := $(addprefix $(BIN_DIR)/,$(BUILD_LIST))

# Regenerate single-header exprtk_single.hpp from src/*.hpp (run after src changes)
build:
@python3 scripts/merge_hpp.py

all: $(BUILD_LIST)

test: $(TEST_SRC)

example: $(EXAMPLE_SRC)

exprtk_%: exprtk_%.cpp src/exprtk.hpp
@mkdir -p $(BIN_DIR)
@echo "Building $(BIN_DIR)/exprtk_$* from $<"
$(COMPILER) $(OPTIONS) -Isrc -o $(BIN_DIR)/exprtk_$* $< $(LINKER_OPT)

exprtk_%_asan: exprtk_%.cpp src/exprtk.hpp
@mkdir -p $(BIN_DIR)
@echo "Building $(BIN_DIR)/exprtk_$*_asan from $<"
$(COMPILER) $(ASAN_BUILD_OPTIONS) -Isrc -o $(BIN_DIR)/exprtk_$*_asan $< $(LINKER_OPT)

strip_bin :
@for f in $(BIN_TARGETS); do if [ -f $$f ]; then strip -s $$f; echo $$f; fi done;

Expand Down
Loading