diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-11-15 05:22:44 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-11-15 05:22:44 +0000 |
commit | 3dac8eda4127a3c9442848dd4e547f4c8d5cb577 (patch) | |
tree | befc30981083183fc7dab18a64d3d7823b1e488a /tool/mjit_archflag.sh | |
parent | 2212c1dc165fa4251ff5085eec768daf3a0f69e5 (diff) | |
download | ruby-3dac8eda4127a3c9442848dd4e547f4c8d5cb577.tar.gz |
tool/mjit_archflag.sh: separated, too many escapes
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65735 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'tool/mjit_archflag.sh')
-rw-r--r-- | tool/mjit_archflag.sh | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/tool/mjit_archflag.sh b/tool/mjit_archflag.sh new file mode 100644 index 0000000000..4bb3321aff --- /dev/null +++ b/tool/mjit_archflag.sh @@ -0,0 +1,39 @@ +# -*- 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'} +} |