Hi,
I tried to make my plugin compile using only installed headers and
turned out that I needed more gcc headers to be installed.
Unfortunately, I needed C++ headers which currently aren't installed. I
modified the cp/Make-lang.in with logic copied from gcc/Makefile.in to
add a c++.install-plugin target.
Now I'm stuck, it's not clear to me how to call my new target from
Makefile.in properly. In the attachment, I call it as a dependency on
install-plugin, but that's obviously hack. Can someone suggest a proper
way to do this?
Thanks,
Taras
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -4042,10 +4042,11 @@ installdirs:
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)
+ intl.h $(PLUGIN_VERSION_H) $(DIAGNOSTIC_H) $(C_COMMON_H) $(C_PRETTY_PRINT_H) \
+ tree-iterator.h $(PLUGIN_H) $(TREE_FLOW_H) langhooks.h
# Install the headers needed to build a plugin.
-install-plugin: installdirs
+install-plugin: installdirs c++.install-plugin
# 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)
diff --git a/gcc/cp/Make-lang.in b/gcc/cp/Make-lang.in
--- a/gcc/cp/Make-lang.in
+++ b/gcc/cp/Make-lang.in
@@ -41,7 +41,7 @@ CXX_INSTALL_NAME := $(shell echo c++|sed
GXX_INSTALL_NAME := $(shell echo g++|sed '$(program_transform_name)')
CXX_TARGET_INSTALL_NAME := $(target_noncanonical)-$(shell echo c++|sed '$(program_transform_name)')
GXX_TARGET_INSTALL_NAME := $(target_noncanonical)-$(shell echo g++|sed '$(program_transform_name)')
-
+CP_PLUGIN_HEADERS := cp-tree.h cxx-pretty-print.h name-lookup.h
#
# Define the names for selecting c++ in LANGUAGES.
# Note that it would be nice to move the dependency on g++
@@ -189,6 +189,24 @@ c++.install-man: $(DESTDIR)$(man1dir)/$(
-$(INSTALL_DATA) $< $@
-chmod a-x $@
+c++.install-plugin: installdirs
+# We keep the directory structure for files in config and .def files. All
+# other files are flattened to a single directory.
+ headers=`echo $(CP_PLUGIN_HEADERS) | tr ' ' '\n' | sort -u`; \
+ for file in $$headers; do \
+ if [ -f $$file ] ; then \
+ path=$$file; \
+ elif [ -f $(srcdir)/cp/$$file ]; then \
+ path=$(srcdir)/cp/$$file; \
+ else continue; \
+ fi; \
+ dest=$(plugin_includedir)/$$file; \
+ echo $(INSTALL_DATA) $$path $(DESTDIR)/$$dest; \
+ dir=`dirname $$dest`; \
+ $(mkinstalldirs) $$dir; \
+ $(INSTALL_DATA) $$path $(DESTDIR)/$$dest; \
+ done
+
c++.uninstall:
-rm -rf $(DESTDIR)$(bindir)/$(CXX_INSTALL_NAME)$(exeext)
-rm -rf $(DESTDIR)$(bindir)/$(GXX_INSTALL_NAME)$(exeext)