From d8cea21e1e6533caf69fe57f7f60e4f67210b173 Mon Sep 17 00:00:00 2001 From: Jan Polensky Date: Mon, 23 Mar 2026 18:58:49 +0100 Subject: [PATCH] zdev: Makefile: deduplicate *_usage.c generation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Consolidate the duplicated sed command sequences used to generate *_usage.c files into a shared CSTR_SED definition and a single pattern rule: %_usage.c: %_usage.txt This removes the copy/pasted rules for chzdev_usage.c and lszdev_usage.c and keeps the Makefile easier to maintain. Also drop the explicit chzdev.o/lszdev.o prerequisites on the generated sources as dependencies are already tracked via the .*.o.d depfiles. Reviewed-by: Jan Höppner Signed-off-by: Jan Polensky Signed-off-by: Jan Höppner --- zdev/src/Makefile | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/zdev/src/Makefile b/zdev/src/Makefile index dc56c9b3..19efe019 100644 --- a/zdev/src/Makefile +++ b/zdev/src/Makefile @@ -84,21 +84,14 @@ ifneq (${HAVE_JSONC}, 0) LDLIBS += -ljson-c endif -chzdev_usage.c: chzdev_usage.txt - $(SED) $< >$@ -e 's/\\/\\\\/g' -e 's/"/\\"/g' -e 's/^/"/g' \ - -e 's/$$/\\n"/g' +CSTR_SED = -e 's/\\/\\\\/g' -e 's/"/\\"/g' -e 's/^/"/g' -e 's/$$/\\n"/g' + +%_usage.c: %_usage.txt + $(SED) $(CSTR_SED) $< >$@ .chzdev.o.d: chzdev_usage.c - -lszdev_usage.c: lszdev_usage.txt - $(SED) $< >$@ -e 's/\\/\\\\/g' -e 's/"/\\"/g' -e 's/^/"/g' \ - -e 's/$$/\\n"/g' - .lszdev.o.d: lszdev_usage.c -chzdev.o: chzdev_usage.c -lszdev.o: lszdev_usage.c - libs = $(rootdir)/libap/libap.a \ $(rootdir)/libutil/libutil.a