diff --git a/Makefile.am.in b/Makefile.am.in
index 3d45005b13c0b9c88a59236c8d0addaf8a1bc564..c65c1cdde367a3bc51126632734b8fb1f1626bde 100644
--- a/Makefile.am.in
+++ b/Makefile.am.in
@@ -90,7 +90,9 @@ ctags: ctags-recursive $(HEADERS) $(SOURCES) $(CONFIG_HEADER) $(TAGS_DEPENDENCIE
 	  awk '    { files[$$0] = 1; } \
 	       END { for (i in files) print i; }'`; \
 	test -z "$(CTAGS_ARGS)$(CONFIG_HEADER)$$unique$(LISP)$$tags" \
-	  || (cd $(srcdir) && ctags -o $$here/tags $(CTAGS_ARGS) $$tags $(CONFIG_HEADER) $$unique $(LISP))
+	  || (cd $(srcdir) && ctags --langmap=c:.c.x -o $$here/tags $(CTAGS_ARGS) $$tags $(CONFIG_HEADER) $$unique $(LISP))
+# This treats .h.x files as C files rather than headers, but we can't
+# distinguish them from .c.x files with ctags.
 
 # Override the standard distclean-tags target, as this doesn't support `tags'
 distclean-tags:
diff --git a/include/Makefile.am.in b/include/Makefile.am.in
index 4bf06a1862678ad22e4bef9d09a716193b4e67b1..f13a9be60548c52b938fced1201176aca299b642 100644
--- a/include/Makefile.am.in
+++ b/include/Makefile.am.in
@@ -25,7 +25,9 @@ ctags: ctags-recursive $(HEADERS) $(SOURCES) $(CONFIG_HEADER) $(TAGS_DEPENDENCIE
 	  awk '    { files[$$0] = 1; } \
 	       END { for (i in files) print i; }'`; \
 	test -z "$(CTAGS_ARGS)$(CONFIG_HEADER)$$unique$(LISP)$$tags" \
-	  || (cd $(srcdir) && ctags -o $$here/tags $(CTAGS_ARGS) $$tags $(CONFIG_HEADER) $$unique $(LISP))
+	  || (cd $(srcdir) && ctags --langmap=c:.c.x -o $$here/tags $(CTAGS_ARGS) $$tags $(CONFIG_HEADER) $$unique $(LISP))
+# This treats .h.x files as C files rather than headers, but we can't
+# distinguish them from .c.x files with ctags.
 
 # Override the standard distclean-tags target, as this doesn't support `tags'
 distclean-tags: