From a18b73adad8a72c2ceb3782477f946b70ca6eeea Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Fri, 19 Aug 2022 23:50:54 +0300 Subject: Add compile and link options to build scripts --- build-clang.bat.in | 52 +++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 45 insertions(+), 7 deletions(-) (limited to 'build-clang.bat.in') diff --git a/build-clang.bat.in b/build-clang.bat.in index dadb1f7..c983aae 100644 --- a/build-clang.bat.in +++ b/build-clang.bat.in @@ -8,7 +8,7 @@ goto start :usage echo. -echo Usage: %0 [/?] [^] [^] +echo Usage: %0 [/?] [^] [--] [^] [^] [-- ^] echo Options: echo --local Don't build from packages, only from local source. echo --no-bpkg Don't install bpkg nor bdep ^(requires --local^). @@ -263,15 +263,48 @@ if "_%~1_" == "_--verbose_" ( if "_%~1_" == "_--_" shift -rem Validate options and arguments. -rem - rem Compiler. rem if "_%1_" == "__" ( set "cxx=clang++" ) else ( - set "cxx=%1" + set "cxx=%~1" + shift +) + +rem Compile and link options. +rem +set "compile_ops=" +set "link_ops=" + +:compile_options +if not "_%1_" == "__" ( + if not "_%~1_" == "_--_" ( + set "compile_ops=%compile_ops% %~1" + shift + goto compile_options + ) else ( + shift + ) +) + +:link_options +if not "_%1_" == "__" ( + set "link_ops=%link_ops% %~1" + shift + goto link_options +) + +if not "_%compile_ops%_" == "__" ( + set coptions="config.cc.coptions=-m64%compile_ops%" +) else ( + set coptions="config.cc.coptions=-m64 -O2" +) + +if not "_%link_ops%_" == "__" ( + set loptions="config.cc.loptions=%link_ops:~1%" +) else ( + set "loptions=" ) rem Merge jobs and make_options into make. @@ -284,6 +317,9 @@ if not "_%make%_" == "__" ( if not "_%make_options%_" == "__" set "make=!make!%make_options%" ) +rem Validate options and arguments. +rem + rem If --no-bpkg is specified, then we require --local to also be specified rem since it won't be possible to build things from packages without bpkg. rem Also imply --no-bdep in this case, since bdep is pretty much useless @@ -454,7 +490,8 @@ cd .. build2\build2\b-boot %verbose% configure^ config.config.hermetic=true^ config.cxx=%cxx%^ - "config.cc.coptions=-m64 -O2"^ + %coptions%^ + %loptions%^ config.bin.lib=shared^ config.install.root=%idir%^ %conf_exe_affixes% @@ -575,7 +612,8 @@ cd %cdir% cc^ config.config.hermetic=true^ config.cxx=%cxx%^ - "config.cc.coptions=-m64 -O2"^ + %coptions%^ + %loptions%^ config.bin.lib=shared^ config.install.root=%idir%^ %conf_exe_affixes% -- cgit v1.1