freetype-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[freetype2] GSoC-2023-Ahmet f5713fa13: makefile fixed


From: Werner Lemberg
Subject: [freetype2] GSoC-2023-Ahmet f5713fa13: makefile fixed
Date: Fri, 16 Jun 2023 16:22:30 -0400 (EDT)

branch: GSoC-2023-Ahmet
commit f5713fa136029b16a9b952278440ec45af73c387
Author: goksu <25721443+goeksu@users.noreply.github.com>
Commit: goksu <25721443+goeksu@users.noreply.github.com>

    makefile fixed
---
 builds/testing.mk                                  |  31 +++++++++++----------
 .../fonts/{deactivated => }/Roboto_subset.ttf      | Bin
 src/tools/ftbench/fonts/tool/sub.sh                |  15 ++++++++++
 src/tools/ftbench/src/tohtml.py                    |   6 ++--
 4 files changed, 34 insertions(+), 18 deletions(-)

diff --git a/builds/testing.mk b/builds/testing.mk
index cf16f2daf..4549e0181 100644
--- a/builds/testing.mk
+++ b/builds/testing.mk
@@ -1,39 +1,40 @@
 # Variables
 FTBENCH_DIR = $(TOP_DIR)/src/tools/ftbench
 FTBENCH_SRC = $(FTBENCH_DIR)/ftbench.c
-FTBENCH_BIN = $(FTBENCH_DIR)/bench
-FTBENCH_FLAGS = $(shell pkg-config --cflags freetype2) -lfreetype
+FTBENCH_BIN = $(OBJ_DIR)/bench.o
 FONTS = $(wildcard $(FTBENCH_DIR)/fonts/*.ttf)
-BASELINES = $(addprefix $(FTBENCH_DIR)/baselines/, $(notdir 
$(FONTS:.ttf=.txt)))
-BENCHMARKS = $(addprefix $(FTBENCH_DIR)/benchmarks/, $(notdir 
$(FONTS:.ttf=.txt)))
-PYTHON = python3
+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/
 HTMLCREATOR = $(FTBENCH_DIR)/src/tohtml.py
 HTMLFILE = $(TOP_DIR)/benchmark.html
 
-# Create directories for baselines and benchmarks
-$(FTBENCH_DIR)/baselines/ $(FTBENCH_DIR)/benchmarks/:
+# Create directories for baseline and benchmark
+$(OBJ_DIR) $(BASELINE_DIR) $(BENCHMARK_DIR):
+       @echo "Creating directory..."
        @mkdir -p $@
 
 # Build ftbench
-$(FTBENCH_BIN): $(FTBENCH_SRC)
+$(FTBENCH_BIN): $(FTBENCH_SRC) | $(OBJ_DIR)
        @echo "Building ftbench..."
-       @gcc $(FTBENCH_FLAGS) $< -o $@
+       @$(CC) -I$(TOP_DIR)/include -lfreetype $< -o $@
 
 # Create a baseline
 .PHONY: baseline
-baseline: $(FTBENCH_BIN) $(FTBENCH_DIR)/baselines/
+baseline: $(FTBENCH_BIN) $(BASELINE_DIR)
        @echo "Creating baseline..."
        @$(foreach font, $(FONTS), \
-               $(FTBENCH_BIN) $(font) > $(FTBENCH_DIR)/baselines/$(notdir 
$(font:.ttf=.txt)); \
+               $(FTBENCH_BIN) $(font) > $(BASELINE_DIR)$(notdir 
$(font:.ttf=.txt)); \
        )
        @echo "Baseline created."
 
 # Benchmark and compare to baseline
 .PHONY: benchmark
-benchmark: $(FTBENCH_BIN) $(FTBENCH_DIR)/benchmarks/
+benchmark: $(FTBENCH_BIN) $(BENCHMARK_DIR)
        @echo "Creating benchmark..."
        @$(foreach font, $(FONTS), \
-               $(FTBENCH_BIN) $(font) > $(FTBENCH_DIR)/benchmarks/$(notdir 
$(font:.ttf=.txt)); \
+               $(FTBENCH_BIN) $(font) > $(BENCHMARK_DIR)$(notdir 
$(font:.ttf=.txt)); \
        )
        @$(PYTHON) $(HTMLCREATOR) > $(HTMLFILE)
        @echo "Benchmark created."
@@ -41,6 +42,6 @@ benchmark: $(FTBENCH_BIN) $(FTBENCH_DIR)/benchmarks/
 .PHONY: clean-benchmark
 clean-benchmark:
        @echo "Cleaning..."
-       @rm -f $(FTBENCH_BIN)
-       @rm -rf $(FTBENCH_DIR)/baselines/ $(FTBENCH_DIR)/benchmarks/ $(HTMLFILE)
+       @$(RM) $(FTBENCH_BIN)
+       @$(RM) -rf $(BASELINE_DIR) $(BENCHMARK_DIR) $(HTMLFILE) 
        @echo "Cleaned."
diff --git a/src/tools/ftbench/fonts/deactivated/Roboto_subset.ttf 
b/src/tools/ftbench/fonts/Roboto_subset.ttf
similarity index 100%
rename from src/tools/ftbench/fonts/deactivated/Roboto_subset.ttf
rename to src/tools/ftbench/fonts/Roboto_subset.ttf
diff --git a/src/tools/ftbench/fonts/tool/sub.sh 
b/src/tools/ftbench/fonts/tool/sub.sh
new file mode 100644
index 000000000..3b114cce8
--- /dev/null
+++ b/src/tools/ftbench/fonts/tool/sub.sh
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+# Define the Unicode range
+unicodes="U+0021-007E"
+
+# Loop over all .ttf files in the current directory
+for fontfile in *.ttf
+do
+  # Generate the output filename
+  output="${fontfile%.ttf}_subset.ttf"
+
+  # Run the pyftsubset command
+  pyftsubset "$fontfile" --unicodes=$unicodes --output-file="$output"
+done
+
diff --git a/src/tools/ftbench/src/tohtml.py b/src/tools/ftbench/src/tohtml.py
index c5b912e7b..95b11f3d9 100644
--- a/src/tools/ftbench/src/tohtml.py
+++ b/src/tools/ftbench/src/tohtml.py
@@ -11,9 +11,9 @@ with open('../../../../benchmark.html', 'w') as f:
     f.write('<h1>Benchmark Results</h1>\n')
 
     # Traverse through the 'baselines' directory
-    for filename in os.listdir('../baselines'):
-        baseline_filepath = os.path.join('../baselines', filename)
-        benchmark_filepath = os.path.join('../benchmarks', filename)
+    for filename in os.listdir('../baseline'):
+        baseline_filepath = os.path.join('../baseline', filename)
+        benchmark_filepath = os.path.join('../benchmark', filename)
 
         # Process the baseline file
         with open(baseline_filepath, 'r') as baseline_file:



reply via email to

[Prev in Thread] Current Thread [Next in Thread]