commit 7d8e17d4ff3c126ebd1ec743225f4acd1b6198cf
Author:     Laslo Hunhold <d...@frign.de>
AuthorDate: Fri Jun 24 00:45:56 2022 +0200
Commit:     Laslo Hunhold <d...@frign.de>
CommitDate: Fri Jun 24 00:45:56 2022 +0200

    Explicitly use object-files in library-generation
    
    The macro $? only evaluates to the list of prerequisites that are
    newer than the current target. While this incidentally works when
    simply compiling, this leads to the library-files only including
    the changed .o-file (and nothing else!) when a single source file
    has been changed.
    
    This is easily fixed by explicitly listing the object-files.
    
    Signed-off-by: Laslo Hunhold <d...@frign.de>

diff --git a/Makefile b/Makefile
index 2866c92..6e6baa1 100644
--- a/Makefile
+++ b/Makefile
@@ -187,11 +187,11 @@ $(TEST):
        $(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $<
 
 libgrapheme.a: $(SRC:=.o)
-       $(AR) rc $@ $?
+       $(AR) rc $@ $(SRC:=.o)
        $(RANLIB) $@
 
 libgrapheme.so: $(SRC:=.o)
-       $(CC) -o $@ -shared $?
+       $(CC) -o $@ -shared $(SRC:=.o)
 
 benchmark: $(BENCHMARK)
        for m in $(BENCHMARK); do ./$$m; done

Reply via email to