aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile9
1 files changed, 7 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index 242e93f..9ee2833 100644
--- a/Makefile
+++ b/Makefile
@@ -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,11 +13,14 @@ $(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
+compile_flags.txt: Makefile
+ printf "%s\n" $(CFLAGS) $(INC) >$@
+
clean:
@echo " Cleaning...";
@echo " $(RM) -r $(BUILDDIR) $(TARGET)"; $(RM) -r $(BUILDDIR) $(TARGET)
@@ -33,3 +36,5 @@ doc:
site:
doxygen
rsync -uvrP --delete-after "html/" root@nullring.xyz:/var/www/stemdoc
+
+-include $(OBJECTS:.o=.d)