summaryrefslogtreecommitdiff
path: root/mk/c.mk
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2015-11-20 13:24:30 -0500
committerOri Bernstein <ori@eigenstate.org>2015-11-20 13:24:30 -0500
commitdeb670e7a0677f294ad3614b33536f1186acf646 (patch)
tree848c3b132e79b7de13e75dd1ceae4cc1371afa6f /mk/c.mk
parentf2027c43e0e85e679c4988954b8e9b35c0a1bdd3 (diff)
downloadmc-deb670e7a0677f294ad3614b33536f1186acf646.tar.gz
A few makefile tweaks.
.PRECIOUS to prevent spurious rebuilds.
Diffstat (limited to 'mk/c.mk')
-rw-r--r--mk/c.mk13
1 files changed, 7 insertions, 6 deletions
diff --git a/mk/c.mk b/mk/c.mk
index 218c34c..4e5dfc2 100644
--- a/mk/c.mk
+++ b/mk/c.mk
@@ -1,6 +1,5 @@
.DEFAULT_GOAL=all
-_DEPSDIR = .deps
-_DEPS=$(addprefix $(_DEPSDIR)/, $(OBJ:.o=.d))
+_DEPS=$(addprefix .deps/, $(OBJ:.o=.d))
_LIBSRCHPATHS=$(addprefix -L, $(dir $(DEPS)))
_LIBINCPATHS=$(addprefix -I, $(dir $(DEPS)))
@@ -8,13 +7,14 @@ _LIBPATHS=$(addprefix -l, $(patsubst lib%.a,%,$(notdir $(DEPS))))
# yeah, I should probably remove -Werror, but it's nice for developing alone.
CFLAGS += -Wall -Werror -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wno-sign-compare -Wno-array-bounds -g
-CFLAGS += -MMD -MP -MF ${_DEPSDIR}/$(subst /,-,$*).d
+CFLAGS += -MMD -MP -MF .deps/$(subst /,-,$*).d
LIB ?= $(INSTLIB)
BIN ?= $(INSTBIN)
# disable implicit rules.
.SUFFIXES:
+.PRECIOUS: $(GENHDR)
.PHONY: clean clean-gen clean-bin clean-obj clean-misc clean-backups
.PHONY: all
@@ -52,6 +52,7 @@ subdirs-install:
clean: subdirs-clean $(EXTRACLEAN)
rm -f ${BIN} ${OBJ} ${CLEAN} ${LIB}
+ rm -rf .deps/
install: subdirs-install $(INSTBIN) $(INSTLIB) $(INSTHDR) $(INSTPKG) $(EXTRAINSTALL)
@for i in $(INSTBIN); do \
@@ -111,11 +112,11 @@ uninstall: subdirs-uninstall $(EXTRAUNINSTALL)
rm -f $(abspath $(DESTDIR)/$(INST_ROOT)/share/man/man$${sect}/$$i); \
done
-%.o: %.c $(GENHDR) .deps
+%.o: %.c $(GENHDR) .deps/stamp
$(CC) -c $(CFLAGS) $(_LIBINCPATHS) $<
-.deps:
- mkdir -p $(_DEPSDIR)
+.deps/stamp:
+ mkdir -p .deps && touch .deps/stamp
config.mk: configure
./configure --redo