From ab17b2e78d54aff16dc7896787f529d64ce985f7 Mon Sep 17 00:00:00 2001 From: Dmitry Baryshkov Date: Wed, 19 Mar 2025 16:02:11 +0200 Subject: [PATCH] make: don't rebuild util.o (and dependencies) unnecessary Using fake target name forces make to rebuild all targets that depend on it. Properly specify version.h as a target name and use double-colon to let make know that it's a special build target. Signed-off-by: Dmitry Baryshkov --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 99c2e6a..be1c904 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,7 @@ KS_OUT := ks KS_SRCS := ks.c sahara.c util.c ux.c KS_OBJS := $(KS_SRCS:.c=.o) -default: versionfile $(QDL) $(RAMDUMP) $(KS_OUT) +default: $(QDL) $(RAMDUMP) $(KS_OUT) $(QDL): $(QDL_OBJS) $(CC) -o $@ $^ $(LDFLAGS) @@ -30,11 +30,11 @@ $(KS_OUT): $(KS_OBJS) compile_commands.json: $(QDL_SRCS) $(KS_SRCS) @echo -n $^ | jq -snR "[inputs|split(\" \")[]|{directory:\"$(PWD)\", command: \"$(CC) $(CFLAGS) -c \(.)\", file:.}]" > $@ -versionfile: +version.h:: @echo "#define VERSION \"$(VERSION)\"" > .version.h @cmp -s .version.h version.h || cp .version.h version.h -util.o: versionfile +util.o: version.h clean: rm -f $(QDL) $(QDL_OBJS)