From eb47bcda9bf50d2440511e49a583939f74e5b033 Mon Sep 17 00:00:00 2001 From: Ivar Fatland Date: Sun, 5 Oct 2025 00:19:09 +0200 Subject: [PATCH] make tags target for ctags I want to generate ctags whenever I make --- .gitignore | 1 + makefile | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6e92f57 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +tags diff --git a/makefile b/makefile index ab013b5..8347375 100644 --- a/makefile +++ b/makefile @@ -7,7 +7,7 @@ TESTBIN := /tmp/all_tests .PHONY: test -test: +test: tags @echo "Discovering test files..." @files=$$(find . -type f -name 'test*.c'); \ if [ -z "$$files" ]; then \ @@ -18,3 +18,11 @@ test: echo "Running tests..."; \ $(TESTBIN); \ fi + + +PROJECT_ROOT := $(shell pwd) +PROJECT_C_FILES := $(shell find $(PROJECT_ROOT) \( -name '*.c' -o -name '*.h' \)) +CRITERION_HEADERS := $(shell find /usr/include/criterion) +ALL_FILES := $(PROJECT_C_FILES) $(CRITERION_HEADERS) +tags: $(ALL_FILES) + ctags $(ALL_FILES)