shithub: mc

Download patch

ref: deb670e7a0677f294ad3614b33536f1186acf646
parent: f2027c43e0e85e679c4988954b8e9b35c0a1bdd3
author: Ori Bernstein <[email protected]>
date: Fri Nov 20 08:24:30 EST 2015

A few makefile tweaks.

    .PRECIOUS to prevent spurious rebuilds.

--- 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,7 +7,7 @@
 
 # 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)
@@ -15,6 +14,7 @@
 
 # disable implicit rules.
 .SUFFIXES:
+.PRECIOUS: $(GENHDR)
 .PHONY: clean clean-gen clean-bin clean-obj clean-misc clean-backups
 .PHONY: all
 
@@ -52,6 +52,7 @@
 
 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 @@
 		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