[patch] link headers if possible

Jeff Johnston jjohnstn@redhat.com
Fri Jan 25 04:33:00 GMT 2008


Neal H. Walfield wrote:
> This patch removes one scenario where I've had to run make clean to
> make the build system recognize some changes that I've made in the
> source tree.  Specifically, it tries first to link header files to
> targ-include and only falls back to copying them if that fails.
> 
> 2008-01-22  Neal H. Walfield  <neal@gnu.org>
> 
> 	* configure.in: Check for ln -s.
> 	* Makefile.am (stmp-targ-include): Prefer to link header
> 	files into the targ-include directory.  Only fallback to
> 	copying them if that fails.
>

Some comments.

The fall-back to cp for libc/machine/$(machine_dir)/machine/*.h ends up 
being extraneous.

Why are you specifying absolute paths to LN_S?  This will cause problems 
if the build directory is moved.

-- Jeff J.

> 
> --- newlib-1.16.0/newlib/configure.in	2007-05-24 19:33:30.000000000 +0200
> +++ newlib/newlib/configure.in	2008-01-22 00:06:51.000000000 +0100
> @@ -127,6 +127,8 @@ AC_LIBTOOL_WIN32_DLL
>  AM_PROG_LIBTOOL
>  fi
>  
> +AC_PROG_LN_S
> +
>  AC_ARG_ENABLE(newlib_hw_fp,
>  [  --enable-newlib-hw-fp    Turn on hardware floating point math],
>  [case "${enableval}" in
> --- newlib-1.16.0/newlib/Makefile.am	2007-05-24 19:33:29.000000000 +0200
> +++ newlib/newlib/Makefile.am	2008-01-22 00:23:46.000000000 +0100
> @@ -195,50 +195,51 @@ all-recursive: stmp-targ-include
>  stmp-targ-include: config.status
>  	-rm -rf targ-include stmp-targ-include
>  	mkdir targ-include targ-include/sys targ-include/machine targ-include/bits
> -	cp newlib.h targ-include/newlib.h
> +	$(LN_S) $(abspath newlib.h) targ-include/newlib.h;
>  	-for i in $(srcdir)/libc/machine/$(machine_dir)/machine/*.h; do \
>  	    if [ -f $$i ]; then \
> -	      cp $$i targ-include/machine/`basename $$i`; \
> +	      $(LN_S) $$i targ-include/machine/`basename $$i` \
> +		|| cp $$i targ-include/machine/`basename $$i`; \
>  	    else true; fi ; \
>  	  done
>  	-for i in $(srcdir)/libc/machine/$(machine_dir)/sys/*.h; do \
>  	    if [ -f $$i ]; then \
> -	      cp $$i targ-include/sys/`basename $$i`; \
> +	      $(LN_S) `realpath $$i` targ-include/sys/`basename $$i`; \
>  	    else true; fi ; \
>  	  done
>  	-for i in $(srcdir)/libc/machine/$(machine_dir)/include/*.h; do \
>  	    if [ -f $$i ]; then \
> -	      cp $$i targ-include/`basename $$i`; \
> +	      $(LN_S) `realpath $$i` targ-include/`basename $$i`; \
>  	    else true; fi ; \
>  	  done
>  	-for i in $(srcdir)/libc/sys/$(sys_dir)/include/*.h; do \
>  	    if [ -f $$i ]; then \
> -	      cp $$i targ-include/`basename $$i`; \
> +	      $(LN_S) `realpath $$i` targ-include/`basename $$i`; \
>  	    else true; fi ; \
>  	  done
>  	-for i in $(srcdir)/libc/sys/$(sys_dir)/sys/*.h; do \
>  	    if [ -f $$i ]; then \
> -	      cp $$i targ-include/sys/`basename $$i`; \
> +	      $(LN_S) `realpath $$i` targ-include/sys/`basename $$i`; \
>  	    else true; fi ; \
>  	  done
>  	-for i in $(srcdir)/libc/sys/$(sys_dir)/bits/*.h; do \
>  	    if [ -f $$i ]; then \
> -	      cp $$i targ-include/bits/`basename $$i`; \
> +	      $(LN_S) `realpath $$i` targ-include/bits/`basename $$i`; \
>  	    else true; fi ; \
>  	  done
>  	-for i in $(srcdir)/libc/sys/$(sys_dir)/machine/*.h; do \
>  	    if [ -f $$i ]; then \
> -	      cp $$i targ-include/machine/`basename $$i`; \
> +	      $(LN_S) `realpath $$i` targ-include/machine/`basename $$i`; \
>  	    else true; fi ; \
>  	  done
>  	-for i in $(srcdir)/libc/sys/$(sys_dir)/machine/$(machine_dir)/*.h; do \
>  	    if [ -f $$i ]; then \
> -	      cp $$i targ-include/machine/`basename $$i`; \
> +	      $(LN_S) `realpath $$i` targ-include/machine/`basename $$i`; \
>  	    else true; fi ; \
>  	  done
>  	-for i in $(srcdir)/libc/sys/$(sys_dir)/machine/$(machine_dir)/include/*.h; do \
>  	    if [ -f $$i ]; then \
> -	      cp $$i targ-include/machine/`basename $$i`; \
> +	      $(LN_S) `realpath $$i` targ-include/machine/`basename $$i`; \
>  	    else true; fi ; \
>  	  done
>  	touch $@



More information about the Newlib mailing list