You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

48 lines
1.4 KiB

2 years ago
# Variables
FTBENCH_DIR = $(TOP_DIR)/src/tools/ftbench
FTBENCH_SRC = $(FTBENCH_DIR)/ftbench.c
2 years ago
FTBENCH_BIN = $(OBJ_DIR)/bench.o
2 years ago
FONTS = $(wildcard $(FTBENCH_DIR)/fonts/*.ttf)
2 years ago
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/
2 years ago
HTMLCREATOR = $(FTBENCH_DIR)/src/tohtml.py
HTMLFILE = $(TOP_DIR)/benchmark.html
2 years ago
# Create directories for baseline and benchmark
$(OBJ_DIR) $(BASELINE_DIR) $(BENCHMARK_DIR):
@echo "Creating directory..."
2 years ago
@mkdir -p $@
# Build ftbench
2 years ago
$(FTBENCH_BIN): $(FTBENCH_SRC) | $(OBJ_DIR)
2 years ago
@echo "Building ftbench..."
2 years ago
@$(CC) -I$(TOP_DIR)/include -lfreetype $< -o $@
2 years ago
# Create a baseline
.PHONY: baseline
2 years ago
baseline: $(FTBENCH_BIN) $(BASELINE_DIR)
2 years ago
@echo "Creating baseline..."
@$(foreach font, $(FONTS), \
2 years ago
$(FTBENCH_BIN) $(font) > $(BASELINE_DIR)$(notdir $(font:.ttf=.txt)); \
2 years ago
)
@echo "Baseline created."
# Benchmark and compare to baseline
.PHONY: benchmark
2 years ago
benchmark: $(FTBENCH_BIN) $(BENCHMARK_DIR)
2 years ago
@echo "Creating benchmark..."
@$(foreach font, $(FONTS), \
2 years ago
$(FTBENCH_BIN) $(font) > $(BENCHMARK_DIR)$(notdir $(font:.ttf=.txt)); \
2 years ago
)
@$(PYTHON) $(HTMLCREATOR) > $(HTMLFILE)
@echo "Benchmark created."
.PHONY: clean-benchmark
clean-benchmark:
@echo "Cleaning..."
2 years ago
@$(RM) $(FTBENCH_BIN)
@$(RM) -rf $(BASELINE_DIR) $(BENCHMARK_DIR) $(HTMLFILE)
2 years ago
@echo "Cleaned."