Index | Thread | Search

From:
John Ericson <git@JohnEricson.me>
Subject:
[PATCH] Allow building libc without generating tags
To:
tech@openbsd.org
Date:
Wed, 15 May 2024 02:01:44 -0400

Download raw body.

Thread
When bootstrapping from scratch, it is nice to avoid dependencies (like
`ctags`) that are not strictly needed.

This makefile change introduces a new `LIBC_TAGS` variable, defaulted to
`y` (i.e. "yes": do build tags, just like today), to control whether
`make all` / `make install` should build/install (respectively) the tags.

The underlying rules for tags can still be run regardless of the choice
of variable.
---
 lib/libc/Makefile | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/lib/libc/Makefile b/lib/libc/Makefile
index 4bb4b67fcbb..9cfae207130 100644
--- a/lib/libc/Makefile
+++ b/lib/libc/Makefile
@@ -26,7 +26,14 @@ SYMBOL_LISTS=	${LIBCSRCDIR}/Symbols.list \
 LIBCSRCDIR=${.CURDIR}
 .include "${LIBCSRCDIR}/Makefile.inc"
 
+all: ${SRCS}
+
+LIBC_TAGS ?= yes
+.if ${LIBC_TAGS} == "yes"
 all: tags
+beforeinstall: install_tags
+.endif
+
 tags: ${SRCS}
 	ctags -w ${.ALLSRC:M*.c}
 	egrep "^SYSENTRY(.*)|^ENTRY(.*)|^FUNC(.*)|^SYSCALL(.*)" \
@@ -34,7 +41,8 @@ tags: ${SRCS}
 	    sed "s;\([^:]*\):\([^(]*\)(\([^, )]*\)\(.*\);\3	\1	/^\2(\3\4$$/;" \
 	    >> tags; sort -o tags tags
 
-beforeinstall:
+.PHONY: install_tags
+install_tags:
 	${INSTALL} ${INSTALL_COPY} -o ${BINOWN} -g ${BINGRP} -m 444 tags \
 		${DESTDIR}/var/db/lib${LIB}.tags
 
-- 
2.42.0