Skip to content

Commit 7944f20

Browse files
committed
Add Makefile target for ease of running example(s)
Signed-off-by: Anjan Roy <hello@itzmeanjan.in>
1 parent 2189cf4 commit 7944f20

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

Makefile

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ BUILD_DIR := build
2424

2525
include tests/test.mk
2626
include benchmarks/bench.mk
27+
include examples/example.mk
2728

2829
$(SHA3_INC_DIR):
2930
git submodule update --init sha3

examples/example.mk

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
EXAMPLE_BUILD_DIR := $(BUILD_DIR)/example
2+
3+
EXAMPLE_DIR := examples
4+
EXAMPLE_SOURCES := $(wildcard $(EXAMPLE_DIR)/*.cpp)
5+
EXAMPLE_HEADERS := $(wildcard $(EXAMPLE_DIR)/*.hpp)
6+
EXAMPLE_EXECS := $(addprefix $(EXAMPLE_BUILD_DIR)/, $(notdir $(EXAMPLE_SOURCES:.cpp=.exe)))
7+
8+
$(EXAMPLE_BUILD_DIR):
9+
mkdir -p $@
10+
11+
$(EXAMPLE_BUILD_DIR)/%.exe: $(EXAMPLE_DIR)/%.cpp $(EXAMPLE_BUILD_DIR) $(SHA3_INC_DIR)
12+
$(CXX) $(CXX_DEFS) $(CXX_FLAGS) $(WARN_FLAGS) $(RELEASE_FLAGS) $(I_FLAGS) $(DEP_IFLAGS) $< -o $@
13+
14+
example: $(EXAMPLE_EXECS) ## Build and run example program, demonstrating usage of ML-DSA API
15+
$(foreach exec,$^,./$(exec);)

0 commit comments

Comments
 (0)