[hackers] [sbase] build: Fix OBJ definition and remove MAN || Roberto E. Vargas Caballero

From: <git_AT_suckless.org>
Date: Fri, 19 Jan 2024 22:01:37 +0100 (CET)

commit 6b9da17eb42e671946bf9326476a20f1b9497bdc
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Fri Jan 19 21:56:40 2024 +0100
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Fri Jan 19 22:01:25 2024 +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.

diff --git a/Makefile b/Makefile
index 95bb21d..8cfd981 100644
--- a/Makefile
+++ b/Makefile
_AT_@ -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 $_AT_ $< $(LIB)
_AT_@ -205,6 +204,9 @@ $(OBJ): $(HDR)
 .c.o:
         $(CC) $(CPPFLAGS) $(CFLAGS) -o $_AT_ -c $<
 
+.c:
+ $(CC) $(CPPFLAGS) $(CFLAGS) -o $_AT_ $< $(LIB)
+
 libutf.a: $(LIBUTFOBJ)
         $(AR) $(ARFLAGS) $_AT_ $?
         $(RANLIB) $_AT_
Received on Fri Jan 19 2024 - 22:01:37 CET

This archive was generated by hypermail 2.3.0 : Fri Jan 19 2024 - 22:12:34 CET