diff --git a/doc/html/Makefile.in b/doc/html/Makefile.in
index 432973a2..ec7713f3 100644
--- a/doc/html/Makefile.in
+++ b/doc/html/Makefile.in
@@ -8,7 +8,11 @@ include $(MAGICDIR)/defs.mak
HTML_INSTDIR=$(INSTALL_LIBDIR)/magic/doc/html
install: $(DESTDIR)${HTML_INSTDIR}
- tar -C $(srcdir) -cf - . | (cd $(DESTDIR)${HTML_INSTDIR}; tar xf - )
+ # Ship only the HTML content, not the build files. $(srcdir) holds
+ # Makefile.in (always) and, for an in-tree build, the config.status-generated
+ # Makefile; excluding both keeps the install identical in-tree vs out-of-tree.
+ tar -C $(srcdir) --exclude=./Makefile --exclude=./Makefile.in -cf - . \
+ | (cd $(DESTDIR)${HTML_INSTDIR}; tar xf - )
$(DESTDIR)${HTML_INSTDIR}:
${SCRIPTS}/mkdirs $(DESTDIR)${HTML_INSTDIR}