This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [trunk][patch] Install headers and plugin-version.o


* Rafael Espindola wrote on Tue, May 05, 2009 at 07:20:52PM CEST:
> --- a/gcc/Makefile.in
> +++ b/gcc/Makefile.in

> +# 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 ) \

Sure you didn't mean this here?
	  "$(srcdir)"/config/* | "$(srcdir)"/*.def ) \

> +	    base=`echo $$path | sed "s|$(srcdir)||"`;; \

Ouch.  $(srcdir) could contain a backslash, a dot, and other
regex-active characters.  Automake uses one of two methods to strip
$(srcdir)/, namely either
  srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
  case $$p in \
    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
    *) f=$$p;; \
  esac;

or
  srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`; \
  list=`for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"`

where the second works on lists and doesn't require case matching for
whether a path contains $(srcdir)/ or not.

Cheers,
Ralf


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]