about summary refs log tree commit diff
path: root/Makerules
diff options
context:
space:
mode:
Diffstat (limited to 'Makerules')
-rw-r--r--Makerules22
1 files changed, 16 insertions, 6 deletions
diff --git a/Makerules b/Makerules
index 027beef31b..e376dabae1 100644
--- a/Makerules
+++ b/Makerules
@@ -267,6 +267,8 @@ $(+sysdir_pfx)sysd-rules: $(+sysdir_pfx)config.make $(..)Makerules \
 	   done; \
 	   echo "\$$(objpfx)m_%.S: $$dir/s_%.S; \$$(+make-include-of-dep)";   \
 	   echo "\$$(objpfx)m_%.c: $$dir/s_%.c; \$$(+make-include-of-dep)";   \
+	   echo "\$$(inst_includedir)/%.h: $$dir/%.h \$$(+force); \
+	   	 	\$$(do-install)"; 				      \
 	 done;								      \
 	 echo "\$$(objpfx)m_%.c: s_%.c; \$$(+make-include-of-dep)";   \
 	 echo 'sysd-rules-done = t') > $@T
@@ -283,11 +285,6 @@ echo '#include <$<>' > $@T
 mv -f $@T $@
 endef
 
-# It matters that this set of rules, for compiling from sources in
-# the current directory (the $srcdir/$subdir) come before the
-# generated sysdep rules in included from sysd-rules below.  When
-# compiling in the source tree, generated sources go into the current
-# directory, and those should be chosen before any sources in sysdeps.
 define o-iterator-doit
 $(objpfx)%$o: %.S $(before-compile); $$(compile-command.S)
 endef
@@ -1126,8 +1123,21 @@ $(addprefix $(inst_datadir)/,$(install-data)): $(inst_datadir)/%: % $(+force)
 endif
 headers := $(strip $(headers))
 ifdef headers
-$(addprefix $(inst_includedir)/,$(headers)): $(inst_includedir)/%: % $(+force)
+# This implicit rule installs headers from the source directory.
+# It may be ignored in preference to rules from sysd-rules to find
+# headers in the sysdeps tree.
+$(inst_includedir)/%.h: $(objpfx)%.h $(+force)
 	$(do-install)
+$(inst_includedir)/%.h: %.h $(+force)
+	$(do-install)
+$(inst_includedir)/%.h: $(..)include/%.h $(+force)
+	$(do-install)
+headers-nonh := $(filter-out %.h,$(headers))
+ifdef headers-nonh
+$(addprefix $(inst_includedir)/,$(headers-nonh)): $(inst_includedir)/%: \
+						 % $(+force)
+	$(do-install)
+endif	# headers-nonh
 endif	# headers
 
 .PHONY: install-bin-nosubdir install-bin-script-nosubdir \