[PATCH 03/14] Add dependency for generated trace inline header files

Valerie Aurora val at versity.com
Thu Feb 27 06:16:12 PST 2025


The tracing system generates a required header file, but the
dependency wasn't expressed in the Makefile, so trying to build a
single binary after a make clean would fail. Add the dependency.

Signed-off-by: Valerie Aurora <val at versity.com>
---
 Makefile | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/Makefile b/Makefile
index 4912f8c..5fd3d85 100644
--- a/Makefile
+++ b/Makefile
@@ -18,6 +18,7 @@ DIR := cli devd shared shared/lk
 SRC := $(foreach d,$(DIR),$(wildcard $(d)/*.c))
 OBJ := $(patsubst %.c,%.o,$(SRC))
 DEP := $(foreach d,$(DIR),$(wildcard $(d)/*.d))
+DGH := shared/generated-trace-inlines.h
 
 # source with main() is linked as a binary
 BIN := $(patsubst %.c,%,$(shell grep -l "^int main" $(SRC)))
@@ -33,7 +34,7 @@ BIN := $(patsubst %.c,%,$(shell grep -l "^int main" $(SRC)))
 PADCHECK := $(patsubst %.h,%.o.padcheck,$(wildcard shared/format-*.h))
 
 .PHONY: all
-all: shared/generated-trace-inlines.h $(PADCHECK) $(BIN)
+all: $(PADCHECK) $(BIN) $(DGH)
 
 ifneq ($(DEP),)
 -include $(DEP)
@@ -49,21 +50,19 @@ $(BIN): %: %.o 	$$(filter $$(dir %)$$(PERCENT),$$(OBJ)) \
 
 #	gcc $(LDFLAGS) -o $(call binname,$@) $^
 
-%.o %.d: %.c Makefile
+%.o %.d: %.c $(DGH) Makefile
 	gcc $(CFLAGS) -MD -MP -MF $*.d -c $< -o $*.o
 	./scripts/sparse.sh -Wbitwise -D__CHECKER__ $(CFLAGS) $<
 
 $(PADCHECK): %.o.padcheck: %.h Makefile
 	gcc $(CFLAGS) -Wpadded -c $< -o $@
 
-shared/generated-trace-inlines.h: scripts/generate-trace-events.awk \
-				  shared/trace-events.txt Makefile
+$(DGH): scripts/generate-trace-events.awk shared/trace-events.txt Makefile
 	gawk -f $< < shared/trace-events.txt > $@
 
 .PHONY: clean
 clean:
-	@rm -f $(BIN) $(OBJ) $(DEP) $(PADCHECK) \
+	@rm -f $(BIN) $(OBJ) $(DEP) $(PADCHECK) $(DGH) \
 		$(foreach d,$(DIR),$(wildcard $(d)/*.[is])) \
-		shared/generated-trace-inlines.h \
 		.sparse.gcc-defines.h .sparse.output
 
-- 
2.48.1




More information about the ngnfs-devel mailing list