commit: 87432890a9d8f91831c60d847c496fe1b714f02d
parent a28e3a074dd1a6e55dd5d042d3247202321fd1aa
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date: Wed, 26 Mar 2025 15:32:43 +0100
lib/sys_signame.c: remove, always regenerate
Diffstat:
4 files changed, 13 insertions(+), 98 deletions(-)
diff --git a/Makefile b/Makefile
@@ -61,7 +61,7 @@ lint: $(MAN1SO)
.PHONY: clean
clean:
- $(RM) -fr $(EXE) ${EXE:=.c.gcov} ${EXE:=.gcda} ${EXE:=.gcno} cmd/expr.tab.c $(MAN1SO) $(TEST_CMDS) $(TEST_LIBS) ${LIBUTILS_O}
+ $(RM) -fr $(EXE) ${EXE:=.c.gcov} ${EXE:=.gcda} ${EXE:=.gcno} cmd/expr.tab.c $(MAN1SO) $(TEST_CMDS) $(TEST_LIBS) ${LIBUTILS_O} build
install: all
mkdir -p ${DESTDIR}${BINDIR}/
@@ -77,18 +77,22 @@ C_SOURCES = cmd/*.c lib/*.h lib/*.c test-lib/*.c configure.d/*.c
format: $(C_SOURCES)
clang-format -style=file -assume-filename=.clang-format -i $(C_SOURCES)
-lib/sys_signame.c: lib/sys_signame.sh
- lib/sys_signame.sh >|lib/sys_signame.c
+# Needs to be in build/ otherwise re-running ./configure catches it for libutils.a
+build/sys_signame.c: lib/sys_signame.sh cmd/cat cmd/printf cmd/mkdir
+ ./cmd/mkdir -p build
+ PATH="$$(pwd)/cmd/:$$PATH" lib/sys_signame.sh >|build/sys_signame.c
LIBUTILS_O = ${LIBUTILS_C:.c=.o}
lib/utils.a: ${LIBUTILS_O} ${LIBUTILS_H} config.mk config.h Makefile
${AR} rc ${ARFLAGS} lib/utils.a ${LIBUTILS_O}
-build/cmd/date.1: cmd/date.1.in lib/iso_parse.mdoc Makefile
- $(M4) cmd/date.1.in > $@
+build/cmd/date.1: cmd/date.1.in lib/iso_parse.mdoc cmd/mkdir
+ ./cmd/mkdir -p build/cmd
+ $(M4) cmd/date.1.in > build/cmd/date.1
-build/cmd/touch.1: cmd/touch.1.in lib/iso_parse.mdoc Makefile
- $(M4) cmd/touch.1.in > $@
+build/cmd/touch.1: cmd/touch.1.in lib/iso_parse.mdoc cmd/mkdir
+ ./cmd/mkdir -p build/cmd
+ $(M4) cmd/touch.1.in > build/cmd/touch.1
cmd/expr.tab.c: cmd/expr.y Makefile
$(YACC) -b cmd/expr cmd/expr.y
@@ -149,7 +153,7 @@ cmd/strings: cmd/strings.c lib/utils.a
cmd/sync: cmd/sync.c lib/utils.a
cmd/tee: cmd/tee.c lib/utils.a
cmd/time: cmd/time.c lib/utils.a
-cmd/timeout: cmd/timeout.c lib/utils.a
+cmd/timeout: cmd/timeout.c build/sys_signame.c lib/utils.a
cmd/touch: cmd/touch.c lib/utils.a
cmd/truncate: cmd/truncate.c lib/utils.a
cmd/uname: cmd/uname.c lib/utils.a
diff --git a/build/cmd/.keep b/build/cmd/.keep
diff --git a/lib/sys_signame.c b/lib/sys_signame.c
@@ -1,89 +0,0 @@
-// utils-std: Collection of commonly available Unix tools
-// SPDX-FileCopyrightText: 2017 Haelwenn (lanodan) Monnier <contact+utils@hacktivis.me>
-// SPDX-License-Identifier: CC0-1.0 OR WTFPL
-// /!\ File generated by lib/sys_signame.sh avoid editing
-#include "sys_signame.h"
-
-const char *util_sys_signame[NSIG] = {
-#ifdef SIGABRT
- [SIGABRT] = "ABRT",
-#endif
-#ifdef SIGALRM
- [SIGALRM] = "ALRM",
-#endif
-#ifdef SIGBUS
- [SIGBUS] = "BUS",
-#endif
-#ifdef SIGCHLD
- [SIGCHLD] = "CHLD",
-#endif
-#ifdef SIGCONT
- [SIGCONT] = "CONT",
-#endif
-#ifdef SIGFPE
- [SIGFPE] = "FPE",
-#endif
-#ifdef SIGHUP
- [SIGHUP] = "HUP",
-#endif
-#ifdef SIGILL
- [SIGILL] = "ILL",
-#endif
-#ifdef SIGINT
- [SIGINT] = "INT",
-#endif
-#ifdef SIGKILL
- [SIGKILL] = "KILL",
-#endif
-#ifdef SIGPIPE
- [SIGPIPE] = "PIPE",
-#endif
-#ifdef SIGQUIT
- [SIGQUIT] = "QUIT",
-#endif
-#ifdef SIGSEGV
- [SIGSEGV] = "SEGV",
-#endif
-#ifdef SIGSTOP
- [SIGSTOP] = "STOP",
-#endif
-#ifdef SIGTERM
- [SIGTERM] = "TERM",
-#endif
-#ifdef SIGTSTP
- [SIGTSTP] = "TSTP",
-#endif
-#ifdef SIGTTIN
- [SIGTTIN] = "TTIN",
-#endif
-#ifdef SIGTTOU
- [SIGTTOU] = "TTOU",
-#endif
-#ifdef SIGUSR1
- [SIGUSR1] = "USR1",
-#endif
-#ifdef SIGUSR2
- [SIGUSR2] = "USR2",
-#endif
-#ifdef SIGWINCH
- [SIGWINCH] = "WINCH",
-#endif
-#ifdef SIGSYS
- [SIGSYS] = "SYS",
-#endif
-#ifdef SIGTRAP
- [SIGTRAP] = "TRAP",
-#endif
-#ifdef SIGURG
- [SIGURG] = "URG",
-#endif
-#ifdef SIGVTALRM
- [SIGVTALRM] = "VTALRM",
-#endif
-#ifdef SIGXCPU
- [SIGXCPU] = "XCPU",
-#endif
-#ifdef SIGXFSZ
- [SIGXFSZ] = "XFSZ",
-#endif
-};
diff --git a/lib/sys_signame.sh b/lib/sys_signame.sh
@@ -4,7 +4,7 @@ cat <<-EOF
// SPDX-FileCopyrightText: 2017 Haelwenn (lanodan) Monnier <contact+utils@hacktivis.me>
// SPDX-License-Identifier: CC0-1.0 OR WTFPL
// /!\ File generated by lib/sys_signame.sh avoid editing
-#include "sys_signame.h"
+#include "../lib/sys_signame.h"
const char *util_sys_signame[NSIG] = {
EOF