From eb4a8ea335f1445f556a6a006bce545945723b8d Mon Sep 17 00:00:00 2001 From: Anjan Roy Date: Mon, 18 Nov 2024 22:19:51 +0400 Subject: [PATCH] Run examples using Make command Signed-off-by: Anjan Roy --- Makefile | 1 + examples/example.mk | 15 +++++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 examples/example.mk diff --git a/Makefile b/Makefile index 6675866..c8c8d6d 100644 --- a/Makefile +++ b/Makefile @@ -26,6 +26,7 @@ BUILD_DIR := build include tests/test.mk include benchmarks/bench.mk +include examples/example.mk $(SUBTLE_INC_DIR): git submodule update --init subtle diff --git a/examples/example.mk b/examples/example.mk new file mode 100644 index 0000000..2229d1d --- /dev/null +++ b/examples/example.mk @@ -0,0 +1,15 @@ +EXAMPLE_BUILD_DIR := $(BUILD_DIR)/example + +EXAMPLE_DIR := examples +EXAMPLE_SOURCES := $(wildcard $(EXAMPLE_DIR)/*.cpp) +EXAMPLE_HEADERS := $(wildcard $(EXAMPLE_DIR)/*.hpp) +EXAMPLE_EXECS := $(addprefix $(EXAMPLE_BUILD_DIR)/, $(notdir $(EXAMPLE_SOURCES:.cpp=.exe))) + +$(EXAMPLE_BUILD_DIR): + mkdir -p $@ + +$(EXAMPLE_BUILD_DIR)/%.exe: $(EXAMPLE_DIR)/%.cpp $(EXAMPLE_BUILD_DIR) + $(CXX) $(CXX_DEFS) $(CXX_FLAGS) $(WARN_FLAGS) $(RELEASE_FLAGS) $(I_FLAGS) $(DEP_IFLAGS) $< -o $@ + +example: $(EXAMPLE_EXECS) ## Build and run example program, demonstrating usage of ML-KEM API + $(foreach exec,$^,./$(exec);)