+PLUGIN_HEADERS = $(TREE_H) $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
+ $(TOPLEV_H) $(BASIC_BLOCK_H) $(GIMPLE_H) $(TREE_PASS_H) gcc-plugin.h intl.h \
+ $(PLUGIN_VERSION_H)
+
+# Install the headers needed to build a plugin.
+install-plugin: installdirs
+# We keep the directory structure for files in config and .def files. All
+# other files are flattened to a single directory.
+ $(mkinstalldirs) $(DESTDIR)$(plugin_includedir)
+ headers=`echo $(PLUGIN_HEADERS) | tr ' ' '\n' | sort -u`; \
+ for file in $$headers; do \
+ if [ -f $$file ] ; then \
+ path=$$file; \
+ elif [ -f $(srcdir)/$$file ]; then \
+ path=$(srcdir)/$$file; \
+ else continue; \
+ fi; \
+ case $$path in \
+ "$(srcdir)"*/config/* | "$(srcdir)"/*.def ) \
+ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`; \
+ base=`echo "$$path" | sed -e "s|$$srcdirstrip/||"`;; \
+ *) base=`basename $$path` ;; \
+ esac; \
+ dest=$(plugin_includedir)/$$base; \
+ echo $(INSTALL_DATA) $$path $(DESTDIR)/$$dest; \
+ dir=`dirname $$dest`; \
+ $(mkinstalldirs) $$dir; \
+ $(INSTALL_DATA) $$path $(DESTDIR)/$$dest; \
+ done
+