ruby-changes:53519
From: nobu <ko1@a...>
Date: Thu, 15 Nov 2018 14:22:50 +0900 (JST)
Subject: [ruby-changes:53519] nobu:r65735 (trunk): tool/mjit_archflag.sh: separated, too many escapes
nobu 2018-11-15 14:22:44 +0900 (Thu, 15 Nov 2018) New Revision: 65735 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=65735 Log: tool/mjit_archflag.sh: separated, too many escapes Added files: trunk/tool/mjit_archflag.sh Modified files: trunk/Makefile.in Index: Makefile.in =================================================================== --- Makefile.in (revision 65734) +++ Makefile.in (revision 65735) @@ -583,31 +583,8 @@ un-runnable: https://github.com/ruby/ruby/blob/trunk/Makefile.in#L583 mjit_config.h: $(ECHO) making $@ @{ \ - quote() { \ - printf "#define $$1"; shift; \ - $${1+printf} $${1+' "%s"'$$sep} $${1+"$$@"}; \ - echo; \ - }; \ - parse_arch_flag() { \ - while [ "$$#" -gt 0 ]; do \ - case "$$1" in \ - -arch) \ - shift; \ - archs="$${archs:+$$archs }$$1"; \ - shift; \ - ;; \ - *) \ - arch_flag="$${arch_flag:+$${arch_flag} }$$1"; \ - shift; \ - ;; \ - esac; \ - done; \ - }; \ + . $(srcdir)/tool/mjit_archflag.sh "$(UNIVERSAL_ARCHNAMES)" $(ARCH_FLAG); \ test "$(Q)" = @ || set -x; \ - archs="$(UNIVERSAL_ARCHNAMES)"; \ - arch_flag=""; \ - parse_arch_flag $(ARCH_FLAG); \ - need_mjit_archflag="$${archs}$${arch_flag}"; \ echo '#ifndef RUBY_MJIT_CONFIG_H'; \ echo '#define RUBY_MJIT_CONFIG_H 1'; \ echo; \ @@ -615,23 +592,14 @@ mjit_config.h: https://github.com/ruby/ruby/blob/trunk/Makefile.in#L592 quote MJIT_MIN_HEADER_NAME "/$(MJIT_HEADER_INSTALL_DIR)/$(MJIT_MIN_HEADER_NAME)"; \ sep=,; \ quote "MJIT_CC_COMMON " $(MJIT_CC); \ - quote "MJIT_CFLAGS $${need_mjit_archflag:+ MJIT_ARCHFLAG}" $(MJIT_CFLAGS); \ + quote "MJIT_CFLAGS MJIT_ARCHFLAG" $(MJIT_CFLAGS); \ quote "MJIT_OPTFLAGS " $(MJIT_OPTFLAGS); \ quote "MJIT_DEBUGFLAGS " $(MJIT_DEBUGFLAGS); \ quote "MJIT_LDSHARED " $(MJIT_LDSHARED); \ - quote "MJIT_DLDFLAGS $${need_mjit_archflag:+ MJIT_ARCHFLAG}" $(MJIT_DLDFLAGS); \ + quote "MJIT_DLDFLAGS MJIT_ARCHFLAG" $(MJIT_DLDFLAGS); \ quote "MJIT_LIBS " $(LIBRUBYARG_SHARED); \ quote 'PRELOADENV "@PRELOADENV@"'; \ - $${archs:+echo} $${archs:+'#if 0'}; \ - for arch in $$archs; do \ - echo "#elif defined __$${arch%=*}__"; \ - quote " MJIT_ARCHFLAG " -arch $${arch%=*}; \ - done; \ - $${archs:+echo} $${archs:+'#else'}; \ - if [ "$${arch_flag}" != "" ]; then \ - quote " MJIT_ARCHFLAG " $${arch_flag}; \ - fi; \ - $${archs:+echo} $${archs:+'#endif'}; \ + indent=$${archs+ } define_arch_flags; \ echo; \ echo '#endif /* RUBY_MJIT_CONFIG_H */'; \ } > $@ Index: tool/mjit_archflag.sh =================================================================== --- tool/mjit_archflag.sh (nonexistent) +++ tool/mjit_archflag.sh (revision 65735) @@ -0,0 +1,39 @@ https://github.com/ruby/ruby/blob/trunk/tool/mjit_archflag.sh#L1 +# -*- sh -*- + +quote() { + printf "#${indent}define $1" + shift + ${1+printf} ${1+' "%s"'$sep} ${1+"$@"} + echo +} + +archs="" +arch_flag="" + +for arch in $1; do + archs="${archs:+$archs }${arch%=*}" +done + +while shift && [ "$#" -gt 0 ]; do + case "$1" in + -arch) + shift + archs="${archs:+$archs }$1" + ;; + *) + arch_flag="${arch_flag:+${arch_flag} }$1" + ;; + esac +done + +define_arch_flags() { + local indent=${archs:+ } + ${archs:+echo} ${archs:+'#if 0'} + for arch in $archs; do + echo "#elif defined __${arch}__" + quote "MJIT_ARCHFLAG " -arch "${arch}" + done + ${archs:+echo} ${archs:+'#else'} + quote "MJIT_ARCHFLAG ${arch_flag:- /* no flag */}" ${arch_flag} + ${archs:+echo} ${archs:+'#endif'} +} -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/