logo

utils-std

Collection of commonly available Unix tools
commit: 726b168d8e6fa197f3acbb93330d54d0ddfb284e
parent 28a40f1004ea3b35cc156788cbfb3aef901335c9
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Fri,  7 Jun 2024 15:51:27 +0200

Makefile: Use RM variable instead of hardcoding rm

Diffstat:

MMakefile54++++++++++++++++++++++++++++--------------------------
1 file changed, 28 insertions(+), 26 deletions(-)

diff --git a/Makefile b/Makefile @@ -8,14 +8,16 @@ SCRIPTS=cmd/yes # Commands linking to another executable SYMLINKS=cmd/'[' cmd/chgrp cmd/readlink +RM=rm + all: $(EXE) $(MAN1SO) .c: - rm -f ${<:=.gcov} ${@:=.gcda} ${@:=.gcno} + $(RM) -f ${<:=.gcov} ${@:=.gcda} ${@:=.gcno} $(CC) -std=c99 $(CFLAGS) -o $@ $< $(LDFLAGS) $(LDSTATIC) .c.o: - rm -f ${<:=.gcov} ${@:=.gcda} ${@:=.gcno} + $(RM) -f ${<:=.gcov} ${@:=.gcda} ${@:=.gcno} $(CC) -std=c99 $(CFLAGS) -c -o $@ $< # Manpages with examples that cram/prysk can grok @@ -46,9 +48,9 @@ lint: $(MAN1SO) .PHONY: clean clean: - rm -fr $(EXE) $(MAN1SO) $(TEST_LIBS) - rm -fr ${EXE:=.c.gcov} ${EXE:=.gcda} ${EXE:=.gcno} - rm -f cmd/expr.tab.c + $(RM) -fr $(EXE) $(MAN1SO) $(TEST_LIBS) + $(RM) -fr ${EXE:=.c.gcov} ${EXE:=.gcda} ${EXE:=.gcno} + $(RM) -f cmd/expr.tab.c install: all mkdir -p ${DESTDIR}${BINDIR}/ @@ -68,25 +70,25 @@ lib/sys_signame.h: lib/sys_signame.sh lib/sys_signame.sh >|lib/sys_signame.h cmd/date: cmd/date.c lib/iso_parse.c Makefile - rm -f ${<:=.gcov} ${@:=.gcda} ${@:=.gcno} + $(RM) -f ${<:=.gcov} ${@:=.gcda} ${@:=.gcno} $(CC) -std=c99 $(CFLAGS) -o $@ cmd/date.c lib/iso_parse.c $(LDFLAGS) $(LDSTATIC) build/cmd/date.1: cmd/date.1.in lib/iso_parse.mdoc Makefile $(M4) cmd/date.1.in > $@ cmd/touch: cmd/touch.c lib/iso_parse.c Makefile - rm -f ${<:=.gcov} ${@:=.gcda} ${@:=.gcno} + $(RM) -f ${<:=.gcov} ${@:=.gcda} ${@:=.gcno} $(CC) -std=c99 $(CFLAGS) -o $@ cmd/touch.c lib/iso_parse.c $(LDFLAGS) $(LDSTATIC) build/cmd/touch.1: cmd/touch.1.in lib/iso_parse.mdoc Makefile $(M4) cmd/touch.1.in > $@ cmd/sleep: cmd/sleep.c lib/strtodur.c Makefile - rm -f ${<:=.gcov} ${@:=.gcda} ${@:=.gcno} + $(RM) -f ${<:=.gcov} ${@:=.gcda} ${@:=.gcno} $(CC) -std=c99 $(CFLAGS) -o $@ cmd/sleep.c lib/strtodur.c $(LDFLAGS) $(LDSTATIC) cmd/timeout: cmd/timeout.c lib/strtodur.c lib/sys_signame.h Makefile - rm -f ${<:=.gcov} ${@:=.gcda} ${@:=.gcno} + $(RM) -f ${<:=.gcov} ${@:=.gcda} ${@:=.gcno} $(CC) -std=c99 $(CFLAGS) -o $@ cmd/timeout.c lib/strtodur.c $(LDFLAGS) $(LDSTATIC) test-lib/mode: test-lib/mode.c lib/mode.c Makefile @@ -102,64 +104,64 @@ test-lib/truncation: test-lib/truncation.c lib/truncation.c Makefile $(CC) -std=c99 $(CFLAGS) -o $@ test-lib/truncation.c lib/truncation.c $(LDFLAGS) $(LDSTATIC) cmd/df: cmd/df.c lib/humanize.c Makefile - rm -f ${<:=.gcov} ${@:=.gcda} ${@:=.gcno} + $(RM) -f ${<:=.gcov} ${@:=.gcda} ${@:=.gcno} $(CC) -std=c99 $(CFLAGS) -o $@ cmd/df.c lib/humanize.c $(LDFLAGS) $(LDSTATIC) cmd/chmod: cmd/chmod.c lib/mode.c lib/symbolize_mode.c Makefile - rm -f ${<:=.gcov} ${@:=.gcda} ${@:=.gcno} + $(RM) -f ${<:=.gcov} ${@:=.gcda} ${@:=.gcno} $(CC) -std=c99 $(CFLAGS) -o $@ cmd/chmod.c lib/mode.c lib/symbolize_mode.c $(LDFLAGS) $(LDSTATIC) cmd/mkdir: cmd/mkdir.c lib/mode.c lib/mode.h lib/mkdir.c lib/mkdir.h Makefile - rm -f ${<:=.gcov} ${@:=.gcda} ${@:=.gcno} + $(RM) -f ${<:=.gcov} ${@:=.gcda} ${@:=.gcno} $(CC) -std=c99 $(CFLAGS) -o $@ cmd/mkdir.c lib/mode.c lib/mkdir.c $(LDFLAGS) $(LDSTATIC) cmd/mknod: cmd/mknod.c lib/mode.c Makefile - rm -f ${<:=.gcov} ${@:=.gcda} ${@:=.gcno} + $(RM) -f ${<:=.gcov} ${@:=.gcda} ${@:=.gcno} $(CC) -std=c99 $(CFLAGS) -o $@ cmd/mknod.c lib/mode.c $(LDFLAGS) $(LDSTATIC) cmd/mkfifo: cmd/mkfifo.c lib/mode.c Makefile - rm -f ${<:=.gcov} ${@:=.gcda} ${@:=.gcno} + $(RM) -f ${<:=.gcov} ${@:=.gcda} ${@:=.gcno} $(CC) -std=c99 $(CFLAGS) -o $@ cmd/mkfifo.c lib/mode.c $(LDFLAGS) $(LDSTATIC) cmd/seq: cmd/seq.c Makefile - rm -f ${<:=.gcov} ${@:=.gcda} ${@:=.gcno} + $(RM) -f ${<:=.gcov} ${@:=.gcda} ${@:=.gcno} $(CC) -std=c99 $(CFLAGS) -o $@ cmd/seq.c -lm $(LDFLAGS) $(LDSTATIC) -cmd/rm: cmd/rm.c lib/consent.c lib/consent.h Makefile - rm -f ${<:=.gcov} ${@:=.gcda} ${@:=.gcno} - $(CC) -std=c99 $(CFLAGS) -o $@ cmd/rm.c lib/consent.c $(LDFLAGS) $(LDSTATIC) +cmd/$(RM): cmd/$(RM).c lib/consent.c lib/consent.h Makefile + $(RM) -f ${<:=.gcov} ${@:=.gcda} ${@:=.gcno} + $(CC) -std=c99 $(CFLAGS) -o $@ cmd/$(RM).c lib/consent.c $(LDFLAGS) $(LDSTATIC) cmd/truncate: cmd/truncate.c lib/truncation.c lib/truncation.h Makefile - rm -f ${<:=.gcov} ${@:=.gcda} ${@:=.gcno} + $(RM) -f ${<:=.gcov} ${@:=.gcda} ${@:=.gcno} $(CC) -std=c99 $(CFLAGS) -o $@ cmd/truncate.c lib/truncation.c $(LDFLAGS) $(LDSTATIC) cmd/head: cmd/head.c lib/truncation.c lib/truncation.h Makefile - rm -f ${<:=.gcov} ${@:=.gcda} ${@:=.gcno} + $(RM) -f ${<:=.gcov} ${@:=.gcda} ${@:=.gcno} $(CC) -std=c99 $(CFLAGS) -o $@ cmd/head.c lib/truncation.c $(LDFLAGS) $(LDSTATIC) cmd/tr: cmd/tr.c lib/tr_str.c lib/tr_str.h Makefile - rm -f ${<:=.gcov} ${@:=.gcda} ${@:=.gcno} + $(RM) -f ${<:=.gcov} ${@:=.gcda} ${@:=.gcno} $(CC) -std=c99 $(CFLAGS) -o $@ cmd/tr.c lib/tr_str.c $(LDFLAGS) $(LDSTATIC) cmd/chown: cmd/chown.c lib/fs.c lib/fs.h lib/user_group_parse.c lib/user_group_parse.h Makefile - rm -f ${<:=.gcov} ${@:=.gcda} ${@:=.gcno} + $(RM) -f ${<:=.gcov} ${@:=.gcda} ${@:=.gcno} $(CC) -std=c99 $(CFLAGS) -o $@ cmd/chown.c lib/fs.c lib/user_group_parse.c $(LDFLAGS) $(LDSTATIC) cmd/realpath: cmd/realpath.c lib/fs.c lib/fs.h Makefile - rm -f ${<:=.gcov} ${@:=.gcda} ${@:=.gcno} + $(RM) -f ${<:=.gcov} ${@:=.gcda} ${@:=.gcno} $(CC) -std=c99 $(CFLAGS) -o $@ cmd/realpath.c lib/fs.c $(LDFLAGS) $(LDSTATIC) cmd/expr.tab.c: cmd/expr.y Makefile $(YACC) -b cmd/expr cmd/expr.y cmd/expr: cmd/expr.tab.c Makefile - rm -f ${<:=.gcov} ${@:=.gcda} ${@:=.gcno} + $(RM) -f ${<:=.gcov} ${@:=.gcda} ${@:=.gcno} $(CC) -std=c99 $(CFLAGS) -o $@ cmd/expr.tab.c $(LDFLAGS) $(LDSTATIC) cmd/install: cmd/install.c lib/mode.c lib/user_group_parse.c lib/user_group_parse.h lib/fs.c lib/fs.h lib/mkdir.c lib/mkdir.h Makefile - rm -f ${<:=.gcov} ${@:=.gcda} ${@:=.gcno} + $(RM) -f ${<:=.gcov} ${@:=.gcda} ${@:=.gcno} $(CC) -std=c99 $(CFLAGS) -o $@ cmd/install.c lib/mode.c lib/user_group_parse.c lib/fs.c lib/mkdir.c $(LDFLAGS) $(LDSTATIC) cmd/mv: cmd/mv.c lib/consent.c lib/consent.h lib/fs.c lib/fs.h Makefile - rm -f ${<:=.gcov} ${@:=.gcda} ${@:=.gcno} + $(RM) -f ${<:=.gcov} ${@:=.gcda} ${@:=.gcno} $(CC) -std=c99 $(CFLAGS) -o $@ cmd/mv.c lib/consent.c lib/fs.c $(LDFLAGS) $(LDSTATIC)