From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1521) id 6D55B3858D20; Tue, 1 Mar 2022 00:39:32 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6D55B3858D20 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Michael Frysinger To: newlib-cvs@sourceware.org Subject: [newlib-cygwin] newlib: speed up targ-include setup & add error checking X-Act-Checkin: newlib-cygwin X-Git-Author: Mike Frysinger X-Git-Refname: refs/heads/master X-Git-Oldrev: ed459780f4d21ff6c691ec1f0fb64be5ad9671a1 X-Git-Newrev: a531ad97267fa483fa6a9e7543bac331bbf295b9 Message-Id: <20220301003932.6D55B3858D20@sourceware.org> Date: Tue, 1 Mar 2022 00:39:32 +0000 (GMT) X-BeenThere: newlib-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Newlib GIT logs List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Mar 2022 00:39:32 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dnewlib-cygwin.git;h=3Da531ad97267= fa483fa6a9e7543bac331bbf295b9 commit a531ad97267fa483fa6a9e7543bac331bbf295b9 Author: Mike Frysinger Date: Sat Feb 19 00:54:20 2022 -0500 newlib: speed up targ-include setup & add error checking =20 The current targ-include setup runs `cp` every header file it installs, in serial. This can be a little noticeable on systems, so cleanup the logic to rely on cp's ability to copy multiple files to a directory in a single call. =20 We still need a check for empty directories with no headers (i.e. the glob doesn't match anything), so add a helper variable to contain that logic to reduce the boiler plate a little. Diff: --- newlib/Makefile.am | 84 ++++++++++++------------------------------------ newlib/Makefile.in | 93 +++++++++++++++-----------------------------------= ---- 2 files changed, 47 insertions(+), 130 deletions(-) diff --git a/newlib/Makefile.am b/newlib/Makefile.am index 6ee0adf04..ba0a3822f 100644 --- a/newlib/Makefile.am +++ b/newlib/Makefile.am @@ -204,77 +204,35 @@ all-recursive: stmp-targ-include # The targ-include directory just holds the includes files for the # particular system and machine we have been configured for. It is # used while building. +TARG_INCLUDE_CP_DIR =3D \ + ; srcdir=3D"$(srcdir)/libc/$$s"; dstdir=3D"targ-include/$$d"; \ + if (cd $$srcdir 2>/dev/null && [ "`echo *.h`" !=3D "*.h" ]); then cp $$sr= cdir/*.h $$dstdir/; fi stmp-targ-include: config.status $(AM_V_GEN)rm -rf targ-include stmp-targ-include $(AM_V_at)$(MAKE) targ-include/sys \ targ-include/machine \ targ-include/bits - -$(AM_V_at)if [ -n "$(shared_machine_dir)" ]; then \ - for i in $(srcdir)/libc/machine/$(shared_machine_dir)/machine/*.h; do= \ - [ -f $$i ] && cp $$i targ-include/machine/; \ - done; \ - for i in $(srcdir)/libc/machine/$(shared_machine_dir)/sys/*.h; do \ - [ -f $$i ] && cp $$i targ-include/sys/; \ - done; \ - for i in $(srcdir)/libc/machine/$(shared_machine_dir)/include/*.h; do= \ - [ -f $$i ] && cp $$i targ-include/; \ - done; \ + $(AM_V_at)if [ -n "$(shared_machine_dir)" ]; then \ + s=3Dmachine/$(shared_machine_dir)/machine d=3Dmachine $(TARG_INCLUDE_= CP_DIR) || exit $$?; \ + s=3Dmachine/$(shared_machine_dir)/sys d=3Dsys $(TARG_INCLUDE_CP_DIR) = || exit $$?; \ + s=3Dmachine/$(shared_machine_dir)/include d=3D $(TARG_INCLUDE_CP_DIR)= || exit $$?; \ fi - -$(AM_V_at)for i in $(srcdir)/libc/machine/$(machine_dir)/machine/*.h; do= \ - if [ -f $$i ]; then \ - cp $$i targ-include/machine/; \ - else true; fi ; \ - done - -$(AM_V_at)for i in $(srcdir)/libc/machine/$(machine_dir)/sys/*.h; do \ - if [ -f $$i ]; then \ - cp $$i targ-include/sys/; \ - else true; fi ; \ - done - -$(AM_V_at)for i in $(srcdir)/libc/machine/$(machine_dir)/include/*.h; do= \ - if [ -f $$i ]; then \ - cp $$i targ-include/; \ - else true; fi ; \ - done - -$(AM_V_at)for i in $(srcdir)/libc/sys/$(sys_dir)/include/*.h; do \ - if [ -f $$i ]; then \ - cp $$i targ-include/; \ - else true; fi ; \ - done - -$(AM_V_at)for i in $(srcdir)/libc/sys/$(sys_dir)/include/*; do \ + $(AM_V_at)s=3Dmachine/$(machine_dir)/machine d=3Dmachine $(TARG_INCLUDE_C= P_DIR) + $(AM_V_at)s=3Dmachine/$(machine_dir)/sys d=3Dsys $(TARG_INCLUDE_CP_DIR) + $(AM_V_at)s=3Dmachine/$(machine_dir)/include d=3D $(TARG_INCLUDE_CP_DIR) + $(AM_V_at)s=3Dsys/$(sys_dir)/include d=3D $(TARG_INCLUDE_CP_DIR) + $(AM_V_at)for i in $(srcdir)/libc/sys/$(sys_dir)/include/*/; do \ if [ -d $$i ]; then \ - for j in $$i/*.h; do \ - if [ ! -d targ-include/`basename $$i` ]; then \ - mkdir targ-include/`basename $$i`; \ - fi; \ - cp $$j targ-include/`basename $$i`/`basename $$j`; \ - done \ - else true; fi ; \ - done - -$(AM_V_at)for i in $(srcdir)/libc/sys/$(sys_dir)/sys/*.h; do \ - if [ -f $$i ]; then \ - cp $$i targ-include/sys/; \ - else true; fi ; \ - done - -$(AM_V_at)for i in $(srcdir)/libc/sys/$(sys_dir)/bits/*.h; do \ - if [ -f $$i ]; then \ - cp $$i targ-include/bits/; \ - else true; fi ; \ - done - -$(AM_V_at)for i in $(srcdir)/libc/sys/$(sys_dir)/machine/*.h; do \ - if [ -f $$i ]; then \ - cp $$i targ-include/machine/; \ - else true; fi ; \ - done - -$(AM_V_at)for i in $(srcdir)/libc/sys/$(sys_dir)/machine/$(machine_dir)/= *.h; do \ - if [ -f $$i ]; then \ - cp $$i targ-include/machine/; \ - else true; fi ; \ - done - -$(AM_V_at)for i in $(srcdir)/libc/sys/$(sys_dir)/machine/$(machine_dir)/= include/*.h; do \ - if [ -f $$i ]; then \ - cp $$i targ-include/machine/; \ - else true; fi ; \ + d=3D`basename $$i`; \ + $(MKDIR_P) targ-include/$$d; \ + s=3Dsys/${sys_dir}/include/$$d $(TARG_INCLUDE_CP_DIR) || exit $$?; \ + fi \ done + $(AM_V_at)s=3Dsys/$(sys_dir)/sys d=3Dsys $(TARG_INCLUDE_CP_DIR) + $(AM_V_at)s=3Dsys/$(sys_dir)/bits d=3Dbits $(TARG_INCLUDE_CP_DIR) + $(AM_V_at)s=3Dsys/$(sys_dir)/machine d=3Dmachine $(TARG_INCLUDE_CP_DIR) + $(AM_V_at)s=3Dsys/$(sys_dir)/machine/$(machine_dir) d=3Dmachine $(TARG_IN= CLUDE_CP_DIR) + $(AM_V_at)s=3Dsys/$(sys_dir)/machine/$(machine_dir)/include d=3Dmachine $= (TARG_INCLUDE_CP_DIR) $(AM_V_at)$(MAKE) targ-include/newlib.h $(AM_V_at)touch $@ =20 diff --git a/newlib/Makefile.in b/newlib/Makefile.in index 6213d6328..e0deacb61 100644 --- a/newlib/Makefile.in +++ b/newlib/Makefile.in @@ -1420,6 +1420,14 @@ libm_a_SOURCES =3D $(am__append_6) $(am__append_9) $= (libm_common_src) \ libm_a_CFLAGS =3D $(AM_CFLAGS) $(libm_a_CFLAGS_$(subst /,_,$(@D))) $(libm_= a_CFLAGS_$(subst /,_,$(@D)_$(/dev/null && [ "`echo *.h`" !=3D "*.h" ]); then cp $$sr= cdir/*.h $$dstdir/; fi + CONFIG_STATUS_DEPENDENCIES =3D $(newlib_basedir)/configure.host MULTISRCTOP =3D=20 MULTIBUILDTOP =3D=20 @@ -8727,81 +8735,32 @@ targ-include/_newlib_version.h: _newlib_version.h t= arg-include $(AM_V_GEN)cp _newlib_version.h $@ =20 all-recursive: stmp-targ-include - -# The targ-include directory just holds the includes files for the -# particular system and machine we have been configured for. It is -# used while building. stmp-targ-include: config.status $(AM_V_GEN)rm -rf targ-include stmp-targ-include $(AM_V_at)$(MAKE) targ-include/sys \ targ-include/machine \ targ-include/bits - -$(AM_V_at)if [ -n "$(shared_machine_dir)" ]; then \ - for i in $(srcdir)/libc/machine/$(shared_machine_dir)/machine/*.h; do= \ - [ -f $$i ] && cp $$i targ-include/machine/; \ - done; \ - for i in $(srcdir)/libc/machine/$(shared_machine_dir)/sys/*.h; do \ - [ -f $$i ] && cp $$i targ-include/sys/; \ - done; \ - for i in $(srcdir)/libc/machine/$(shared_machine_dir)/include/*.h; do= \ - [ -f $$i ] && cp $$i targ-include/; \ - done; \ + $(AM_V_at)if [ -n "$(shared_machine_dir)" ]; then \ + s=3Dmachine/$(shared_machine_dir)/machine d=3Dmachine $(TARG_INCLUDE_= CP_DIR) || exit $$?; \ + s=3Dmachine/$(shared_machine_dir)/sys d=3Dsys $(TARG_INCLUDE_CP_DIR) = || exit $$?; \ + s=3Dmachine/$(shared_machine_dir)/include d=3D $(TARG_INCLUDE_CP_DIR)= || exit $$?; \ fi - -$(AM_V_at)for i in $(srcdir)/libc/machine/$(machine_dir)/machine/*.h; do= \ - if [ -f $$i ]; then \ - cp $$i targ-include/machine/; \ - else true; fi ; \ - done - -$(AM_V_at)for i in $(srcdir)/libc/machine/$(machine_dir)/sys/*.h; do \ - if [ -f $$i ]; then \ - cp $$i targ-include/sys/; \ - else true; fi ; \ - done - -$(AM_V_at)for i in $(srcdir)/libc/machine/$(machine_dir)/include/*.h; do= \ - if [ -f $$i ]; then \ - cp $$i targ-include/; \ - else true; fi ; \ - done - -$(AM_V_at)for i in $(srcdir)/libc/sys/$(sys_dir)/include/*.h; do \ - if [ -f $$i ]; then \ - cp $$i targ-include/; \ - else true; fi ; \ - done - -$(AM_V_at)for i in $(srcdir)/libc/sys/$(sys_dir)/include/*; do \ + $(AM_V_at)s=3Dmachine/$(machine_dir)/machine d=3Dmachine $(TARG_INCLUDE_C= P_DIR) + $(AM_V_at)s=3Dmachine/$(machine_dir)/sys d=3Dsys $(TARG_INCLUDE_CP_DIR) + $(AM_V_at)s=3Dmachine/$(machine_dir)/include d=3D $(TARG_INCLUDE_CP_DIR) + $(AM_V_at)s=3Dsys/$(sys_dir)/include d=3D $(TARG_INCLUDE_CP_DIR) + $(AM_V_at)for i in $(srcdir)/libc/sys/$(sys_dir)/include/*/; do \ if [ -d $$i ]; then \ - for j in $$i/*.h; do \ - if [ ! -d targ-include/`basename $$i` ]; then \ - mkdir targ-include/`basename $$i`; \ - fi; \ - cp $$j targ-include/`basename $$i`/`basename $$j`; \ - done \ - else true; fi ; \ - done - -$(AM_V_at)for i in $(srcdir)/libc/sys/$(sys_dir)/sys/*.h; do \ - if [ -f $$i ]; then \ - cp $$i targ-include/sys/; \ - else true; fi ; \ - done - -$(AM_V_at)for i in $(srcdir)/libc/sys/$(sys_dir)/bits/*.h; do \ - if [ -f $$i ]; then \ - cp $$i targ-include/bits/; \ - else true; fi ; \ - done - -$(AM_V_at)for i in $(srcdir)/libc/sys/$(sys_dir)/machine/*.h; do \ - if [ -f $$i ]; then \ - cp $$i targ-include/machine/; \ - else true; fi ; \ - done - -$(AM_V_at)for i in $(srcdir)/libc/sys/$(sys_dir)/machine/$(machine_dir)/= *.h; do \ - if [ -f $$i ]; then \ - cp $$i targ-include/machine/; \ - else true; fi ; \ - done - -$(AM_V_at)for i in $(srcdir)/libc/sys/$(sys_dir)/machine/$(machine_dir)/= include/*.h; do \ - if [ -f $$i ]; then \ - cp $$i targ-include/machine/; \ - else true; fi ; \ + d=3D`basename $$i`; \ + $(MKDIR_P) targ-include/$$d; \ + s=3Dsys/${sys_dir}/include/$$d $(TARG_INCLUDE_CP_DIR) || exit $$?; \ + fi \ done + $(AM_V_at)s=3Dsys/$(sys_dir)/sys d=3Dsys $(TARG_INCLUDE_CP_DIR) + $(AM_V_at)s=3Dsys/$(sys_dir)/bits d=3Dbits $(TARG_INCLUDE_CP_DIR) + $(AM_V_at)s=3Dsys/$(sys_dir)/machine d=3Dmachine $(TARG_INCLUDE_CP_DIR) + $(AM_V_at)s=3Dsys/$(sys_dir)/machine/$(machine_dir) d=3Dmachine $(TARG_IN= CLUDE_CP_DIR) + $(AM_V_at)s=3Dsys/$(sys_dir)/machine/$(machine_dir)/include d=3Dmachine $= (TARG_INCLUDE_CP_DIR) $(AM_V_at)$(MAKE) targ-include/newlib.h $(AM_V_at)touch $@