sbase

suckless unix tools
git clone git://git.suckless.org/sbase
Log | Files | Refs | README | LICENSE

commit 6b9da17eb42e671946bf9326476a20f1b9497bdc
parent 270ca025ce236885e3177cd7acfd2cfbdf6e36a5
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Fri, 19 Jan 2024 21:56:40 +0100

build: Fix OBJ definition and remove MAN

The MAN macro was not used, and it and OBJ had the same problem
because they were defined using an empty string in the replace
pattern of the macro expansion, but as it is said by POSIX:

	The subst1 to be replaced shall be recognized when it is a suffix
	at the end of a word in string1

so, an empty string should not be used.

Also, a new inference rule is added to generate the binary
directly from the .c without generating the intermediate
object, removing the need of chaining different inference
rules which is not guaranteed to work in all the make
implementations.

Diffstat:
MMakefile | 8+++++---
1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile @@ -190,14 +190,13 @@ BIN =\ xinstall\ yes -OBJ = $(BIN:=.o) $(LIBUTFOBJ) $(LIBUTILOBJ) -MAN = $(BIN:=.1) +OBJ = $(LIBUTFOBJ) $(LIBUTILOBJ) all: $(BIN) $(BIN): $(LIB) -$(OBJ): $(HDR) +$(OBJ) $(BIN): $(HDR) .o: $(CC) $(LDFLAGS) -o $@ $< $(LIB) @@ -205,6 +204,9 @@ $(OBJ): $(HDR) .c.o: $(CC) $(CPPFLAGS) $(CFLAGS) -o $@ -c $< +.c: + $(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $< $(LIB) + libutf.a: $(LIBUTFOBJ) $(AR) $(ARFLAGS) $@ $? $(RANLIB) $@