diff options
author | Tomasz Kramkowski <tomasz@kramkow.ski> | 2024-05-02 20:36:14 +0100 |
---|---|---|
committer | Tomasz Kramkowski <tomasz@kramkow.ski> | 2024-05-02 20:36:14 +0100 |
commit | 38f90d7bd6669bd6f48be178669a6186e40b30de (patch) | |
tree | ba9101d5039c5ac01a3ab888142f35d5b07d87a0 | |
parent | 4738c0ffe90fc5e46a2a31b061b76d49317b6b1e (diff) |
Makefile: Use a more complete dependency graph
Use the compiler to generate make-compatible dependency files and
include them to ensure targets are recompiled when a header file
changes.
Also make objects depend on the Makefile explicitly to ensure objects
are re-built when the makefile changes.
-rw-r--r-- | Makefile | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -5,7 +5,7 @@ TARGET := stem SRCEXT := c SOURCES := $(shell find $(SRCDIR) -type f -name *.$(SRCEXT)) OBJECTS := $(patsubst $(SRCDIR)/%,$(BUILDDIR)/%,$(SOURCES:.$(SRCEXT)=.o)) -CFLAGS := +CFLAGS := -MMD -MP LIB := -L lib -lm INC := -I include @@ -13,7 +13,7 @@ $(TARGET): $(OBJECTS) @echo " Linking..." @echo " $(CC) $^ -o $(TARGET) $(LIB)"; $(CC) $^ -o $(TARGET) $(LIB) -O3 -$(BUILDDIR)/%.o: $(SRCDIR)/%.$(SRCEXT) +$(BUILDDIR)/%.o: $(SRCDIR)/%.$(SRCEXT) Makefile @echo " Building..." @mkdir -p $(BUILDDIR) @echo " $(CC) $(CFLAGS) $(INC) -c -o $@ $<"; $(CC) $(CFLAGS) $(INC) -c -o $@ $< -save-temps -O3 @@ -33,3 +33,5 @@ doc: site: doxygen rsync -uvrP --delete-after "html/" root@nullring.xyz:/var/www/stemdoc + +-include $(OBJECTS:.o=.d) |