commit 56fbc46d042ff0f8fffe459fe5fcf6c40f5234b9
parent 41a97760a75995790084aa02e45f1cabfc0a737f
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Thu, 15 May 2025 12:44:10 +0200
Update of test compilation targets
Replace the .b suffix with .t, generated files used to define the target
of the Makefile that lists the tests to be built. The 'binary' meaning
of the .b extension was not clear, namely that it refers to the list of
test executables. The more neutral .t (for ‘target’) extension refers to
the definition of the target of a Makefile, which is in fact what is
done in these files.
Diffstat:
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/Makefile b/Makefile
@@ -115,7 +115,7 @@ clean: clean_test
TEST_SRC = src/test_smeteo.c src/test_smeteo_load.c
TEST_OBJ = $(TEST_SRC:.c=.o)
TEST_DEP = $(TEST_SRC:.c=.d)
-TEST_BIN = $(TEST_SRC:.c=.b)
+TEST_TGT = $(TEST_SRC:.c=.t)
PKG_CONFIG_LOCAL = PKG_CONFIG_PATH="./:$${PKG_CONFIG_PATH}" $(PKG_CONFIG)
INCS_TEST = $$($(PKG_CONFIG_LOCAL) $(PCFLAGS) --cflags rsys smeteo-local.pc)
@@ -127,14 +127,14 @@ LDFLAGS_TEST = $(LDFLAGS_EXE) $(LIBS_TEST)
tests: library $(TEST_DEP) $(TEST_BIN)
@$(MAKE) -fMakefile \
$$(for i in $(TEST_DEP); do echo -f"$${i}"; done) \
- $$(for i in $(TEST_BIN); do echo -f"$${i}"; done) \
- test_bin
+ $$(for i in $(TEST_TGT); do echo -f"$${i}"; done) \
+ test_list
-.c.b:
+$(TEST_TGT):
@{ \
- bin="$$(basename "$<" ".c")"; \
- printf '%s: %s\n' "$${bin}" $(<:.c=.o); \
- printf 'test_bin: %s\n' "$${bin}"; \
+ exe="$$(basename "$@" ".t")"; \
+ printf '%s: %s\n' "$${exe}" $(@:.t=.o); \
+ printf 'test_list: %s\n' "$${exe}"; \
} > $@
$(TEST_DEP): config.mk smeteo-local.pc
@@ -149,7 +149,8 @@ test_smeteo_load \
$(CC) $(CFLAGS_TEST) -o $@ src/$@.o $(LDFLAGS_TEST)
clean_test:
- rm -f $(TEST_BIN) $(TEST_DEP) $(TEST_OBJ)
+ rm -f $(TEST_DEP) $(TEST_OBJ) $(TEST_TGT)
+ rm -f test.txt
for i in $(TEST_SRC); do rm -f "$$(basename "$${i}" ".c")"; done
test: tests