about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--dist.mk2
-rw-r--r--install.mk4
-rw-r--r--lib.mk6
-rw-r--r--libraries.mk4
-rw-r--r--patterns.mk6
-rw-r--r--programs.mk4
6 files changed, 14 insertions, 12 deletions
diff --git a/dist.mk b/dist.mk
index bf97b697f95f..cd11463e8a68 100644
--- a/dist.mk
+++ b/dist.mk
@@ -11,4 +11,6 @@ $(dist_name).tar.bz2: $(dist_files)
 
 clean_files += $(dist_name).tar.bz2
 
+print-top-help += echo "  dist: Generate a source distribution";
+
 endif
diff --git a/install.mk b/install.mk
index aee4bf38ba7a..093f30b810e2 100644
--- a/install.mk
+++ b/install.mk
@@ -51,3 +51,7 @@ define install-symlink =
 	$$(trace-install) ln -sfn $(1) $(2)
 
 endef
+
+
+print-top-help += \
+  echo "  install: Install into \$$(prefix) (currently set to '$(prefix)')";
diff --git a/lib.mk b/lib.mk
index cbed773fe762..f43fdd56c479 100644
--- a/lib.mk
+++ b/lib.mk
@@ -45,11 +45,7 @@ ifeq ($(BUILD_DEBUG), 1)
 endif
 
 
-# Utility function for recursively finding files, e.g.
-# ‘$(call rwildcard, path/to/dir, *.c *.h)’.
-rwildcard=$(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2) $(filter $(subst *,%,$2),$d))
-
-
+include mk/functions.mk
 include mk/tracing.mk
 include mk/clean.mk
 include mk/dist.mk
diff --git a/libraries.mk b/libraries.mk
index 90eb125a65d9..461a3e9a6291 100644
--- a/libraries.mk
+++ b/libraries.mk
@@ -107,10 +107,10 @@ define build-library =
   $$(foreach obj, $$($(1)_OBJS), $$(eval $$(obj): $$($(1)_COMMON_DEPS)))
 
   # Include .dep files, if they exist.
-  $(1)_DEPS := $$(addsuffix .dep, $$(basename $$(_srcs)))
+  $(1)_DEPS := $$(foreach fn, $$($(1)_OBJS), $$(call filename-to-dep, $$(fn)))
   -include $$($(1)_DEPS)
 
   libs_list += $$($(1)_PATH)
-  clean_files += $$(_d)/*.a $$(_d)/*.$(SO_EXT) $$(_d)/*.o $$(_d)/*.dep $$($(1)_DEPS) $$($(1)_OBJS)
+  clean_files += $$(_d)/*.a $$(_d)/*.$(SO_EXT) $$(_d)/*.o $$(_d)/.*.dep $$($(1)_DEPS) $$($(1)_OBJS)
   dist_files += $$(_srcs)
 endef
diff --git a/patterns.mk b/patterns.mk
index 91a758f3389d..f5674d40436c 100644
--- a/patterns.mk
+++ b/patterns.mk
@@ -1,8 +1,8 @@
 %.o: %.cc
-	$(trace-cxx) $(CXX) -o $@ -c $< $(GLOBAL_CXXFLAGS) $(CXXFLAGS) $($@_CXXFLAGS) -MMD -MF $(basename $@).dep -MP
+	$(trace-cxx) $(CXX) -o $@ -c $< $(GLOBAL_CXXFLAGS) $(CXXFLAGS) $($@_CXXFLAGS) -MMD -MF $(call filename-to-dep, $@) -MP
 
 %.o: %.cpp
-	$(trace-cxx) $(CXX) -o $@ -c $< $(GLOBAL_CXXFLAGS) $(CXXFLAGS) $($@_CXXFLAGS) -MMD -MF $(basename $@).dep -MP
+	$(trace-cxx) $(CXX) -o $@ -c $< $(GLOBAL_CXXFLAGS) $(CXXFLAGS) $($@_CXXFLAGS) -MMD -MF $(call filename-to-dep, $@) -MP
 
 %.o: %.c
-	$(trace-cc) $(CC) -o $@ -c $< $(GLOBAL_CFLAGS) $(CFLAGS) $($@_CFLAGS) -MMD -MF $(basename $@).dep -MP
+	$(trace-cc) $(CC) -o $@ -c $< $(GLOBAL_CFLAGS) $(CFLAGS) $($@_CFLAGS) -MMD -MF $(call filename-to-dep, $@) -MP
diff --git a/programs.mk b/programs.mk
index c608a6f25aa4..0478e16d0bd6 100644
--- a/programs.mk
+++ b/programs.mk
@@ -53,10 +53,10 @@ define build-program =
   $$(foreach obj, $$($(1)_OBJS), $$(eval $$(obj): $$($(1)_COMMON_DEPS)))
 
   # Include .dep files, if they exist.
-  $(1)_DEPS := $$(addsuffix .dep, $$(basename $$(_srcs)))
+  $(1)_DEPS := $$(foreach fn, $$($(1)_OBJS), $$(call filename-to-dep, $$(fn)))
   -include $$($(1)_DEPS)
 
   programs_list += $$($(1)_PATH)
-  clean_files += $$($(1)_PATH) $$(_d)/*.o $$(_d)/*.dep $$($(1)_DEPS) $$($(1)_OBJS)
+  clean_files += $$($(1)_PATH) $$(_d)/*.o $$(_d)/.*.dep $$($(1)_DEPS) $$($(1)_OBJS)
   dist_files += $$(_srcs)
 endef