[llvm-commits] [PATCH] Makefile.rules: [PR9321] "make install" may install include files along explicit pattern.

Joerg Sonnenberger joerg at britannica.bec.de
Mon Mar 7 16:56:18 PST 2011


On Mon, Feb 28, 2011 at 01:53:07PM +0900, NAKAMURA Takumi wrote:
> diff --git a/Makefile.rules b/Makefile.rules
> index c0a9112..94d2e2c 100644
> --- a/Makefile.rules
> +++ b/Makefile.rules
> @@ -2139,8 +2139,13 @@ install-local::
>  	$(Verb) $(MKDIR) $(DESTDIR)$(PROJ_includedir)
>  	$(Verb) if test -d "$(PROJ_SRC_ROOT)/include" ; then \
>  	  cd $(PROJ_SRC_ROOT)/include && \
> -	  for  hdr in `find . -type f '!' '(' -name '*~' \
> -	      -o -name '.#*' -o -name '*.in' ')' -print | grep -v CVS | \
> +	  for hdr in `find . -type f '(' \
> +	        -name LICENSE.TXT \
> +	        -or -name '*.def' \
> +	        -or -name '*.h' \
> +	        -or -name '*.inc' \
> +	        -or -name '*.td' \
> +	      ')' -print | grep -v CVS | \
>  	      grep -v .svn` ; do \
>  	    instdir=`dirname "$(DESTDIR)$(PROJ_includedir)/$$hdr"` ; \
>  	    if test \! -d "$$instdir" ; then \
> @@ -2153,7 +2158,19 @@ install-local::
>  ifneq ($(PROJ_SRC_ROOT),$(PROJ_OBJ_ROOT))
>  	$(Verb) if test -d "$(PROJ_OBJ_ROOT)/include" ; then \
>  	  cd $(PROJ_OBJ_ROOT)/include && \
> -	  for hdr in `find . -type f -print | grep -v CVS` ; do \
> +	  for hdr in `find . -type f '(' \
> +	        -name LICENSE.TXT \
> +	        -or -name '*.def' \
> +	        -or -name '*.h' \
> +	        -or -name '*.inc' \
> +	        -or -name '*.td' \
> +	      ')' -print | grep -v CVS | \
> +	      grep -v .svn` ; do \
> +	    instdir=`dirname "$(DESTDIR)$(PROJ_includedir)/$$hdr"` ; \
> +	    if test \! -d "$$instdir" ; then \
> +	      $(EchoCmd) Making install directory $$instdir ; \
> +	      $(MKDIR) $$instdir ;\
> +	    fi ; \
>  	    $(DataInstall) $$hdr $(DESTDIR)$(PROJ_includedir)/$$hdr ; \
>  	  done ; \
>  	fi

Same here too -- SUS says the syntax is "-o", not "-or". Please also
merge the grep calls using ! '(' -path '*/CVS/*' -o -path '*/.svn/*'
')'. The find ... | while read hdr ideom is IMO more readable too and
doesn't force the shell to read all names at once.

Joerg



More information about the llvm-commits mailing list