2023-06-12 16:44:04 +02:00
|
|
|
# Variables
|
|
|
|
FTBENCH_DIR = $(TOP_DIR)/src/tools/ftbench
|
|
|
|
FTBENCH_SRC = $(FTBENCH_DIR)/ftbench.c
|
2023-06-16 22:16:14 +02:00
|
|
|
FTBENCH_BIN = $(OBJ_DIR)/bench.o
|
2023-06-19 21:15:55 +02:00
|
|
|
FTBENCH_FLAG = -c 50
|
2023-06-12 16:44:04 +02:00
|
|
|
FONTS = $(wildcard $(FTBENCH_DIR)/fonts/*.ttf)
|
2023-06-16 22:16:14 +02:00
|
|
|
BASELINE = $(addprefix $(FTBENCH_DIR)/baseline/, $(notdir $(FONTS:.ttf=.txt)))
|
|
|
|
BENCHMARK = $(addprefix $(FTBENCH_DIR)/benchmark/, $(notdir $(FONTS:.ttf=.txt)))
|
|
|
|
BASELINE_DIR = $(FTBENCH_DIR)/baseline/
|
|
|
|
BENCHMARK_DIR = $(FTBENCH_DIR)/benchmark/
|
2023-06-12 16:44:04 +02:00
|
|
|
HTMLCREATOR = $(FTBENCH_DIR)/src/tohtml.py
|
|
|
|
HTMLFILE = $(TOP_DIR)/benchmark.html
|
|
|
|
|
2023-06-16 22:16:14 +02:00
|
|
|
# Create directories for baseline and benchmark
|
|
|
|
$(OBJ_DIR) $(BASELINE_DIR) $(BENCHMARK_DIR):
|
|
|
|
@echo "Creating directory..."
|
2023-06-12 16:44:04 +02:00
|
|
|
@mkdir -p $@
|
|
|
|
|
|
|
|
# Build ftbench
|
2023-06-16 22:16:14 +02:00
|
|
|
$(FTBENCH_BIN): $(FTBENCH_SRC) | $(OBJ_DIR)
|
2023-06-12 16:44:04 +02:00
|
|
|
@echo "Building ftbench..."
|
2023-06-16 22:16:14 +02:00
|
|
|
@$(CC) -I$(TOP_DIR)/include -lfreetype $< -o $@
|
2023-06-12 16:44:04 +02:00
|
|
|
|
|
|
|
# Create a baseline
|
|
|
|
.PHONY: baseline
|
2023-06-16 22:16:14 +02:00
|
|
|
baseline: $(FTBENCH_BIN) $(BASELINE_DIR)
|
2023-06-12 16:44:04 +02:00
|
|
|
@echo "Creating baseline..."
|
|
|
|
@$(foreach font, $(FONTS), \
|
2023-06-20 15:16:53 +02:00
|
|
|
echo "Parameters: $(FTBENCH_FLAG)" > $(BASELINE_DIR)$(notdir $(font:.ttf=.txt)); \
|
|
|
|
echo "Commit ID: `git rev-parse HEAD`" >> $(BASELINE_DIR)$(notdir $(font:.ttf=.txt)); \
|
|
|
|
echo "Commit Date: `git show -s --format=%ci HEAD`" >> $(BASELINE_DIR)$(notdir $(font:.ttf=.txt)); \
|
|
|
|
echo "Branch: `git rev-parse --abbrev-ref HEAD`" >> $(BASELINE_DIR)$(notdir $(font:.ttf=.txt)); \
|
|
|
|
$(FTBENCH_BIN) $(FTBENCH_FLAG) $(font) >> $(BASELINE_DIR)$(notdir $(font:.ttf=.txt)); \
|
2023-06-12 16:44:04 +02:00
|
|
|
)
|
|
|
|
@echo "Baseline created."
|
|
|
|
|
|
|
|
# Benchmark and compare to baseline
|
|
|
|
.PHONY: benchmark
|
2023-06-16 22:16:14 +02:00
|
|
|
benchmark: $(FTBENCH_BIN) $(BENCHMARK_DIR)
|
2023-06-12 16:44:04 +02:00
|
|
|
@echo "Creating benchmark..."
|
|
|
|
@$(foreach font, $(FONTS), \
|
2023-06-20 15:16:53 +02:00
|
|
|
echo "Parameters: $(FTBENCH_FLAG)" > $(BENCHMARK_DIR)$(notdir $(font:.ttf=.txt)); \
|
|
|
|
echo "Commit ID: `git rev-parse HEAD`" >> $(BENCHMARK_DIR)$(notdir $(font:.ttf=.txt)); \
|
|
|
|
echo "Commit Date: `git show -s --format=%ci HEAD`" >> $(BENCHMARK_DIR)$(notdir $(font:.ttf=.txt)); \
|
|
|
|
echo "Branch: `git rev-parse --abbrev-ref HEAD`" >> $(BENCHMARK_DIR)$(notdir $(font:.ttf=.txt)); \
|
|
|
|
$(FTBENCH_BIN) $(FTBENCH_FLAG) $(font) >> $(BENCHMARK_DIR)$(notdir $(font:.ttf=.txt)); \
|
2023-06-12 16:44:04 +02:00
|
|
|
)
|
2023-06-19 21:15:55 +02:00
|
|
|
@$(PYTHON) $(HTMLCREATOR)
|
2023-06-12 16:44:04 +02:00
|
|
|
@echo "Benchmark created."
|
|
|
|
|
2023-06-20 15:16:53 +02:00
|
|
|
|
2023-06-12 16:44:04 +02:00
|
|
|
.PHONY: clean-benchmark
|
|
|
|
clean-benchmark:
|
|
|
|
@echo "Cleaning..."
|
2023-06-16 22:16:14 +02:00
|
|
|
@$(RM) $(FTBENCH_BIN)
|
|
|
|
@$(RM) -rf $(BASELINE_DIR) $(BENCHMARK_DIR) $(HTMLFILE)
|
2023-06-12 16:44:04 +02:00
|
|
|
@echo "Cleaned."
|