fall back from clang to cc in build.bqn & default makefile to cc

even without the makefile change here, a `make o3` will work without clang, but it gave harmless errors from the CC_IS_CLANG check before the makefile recurses to where the custom CC is set (and CC_IS_CLANG recomputed)
This commit is contained in:
dzaima 2023-08-04 21:44:36 +03:00
parent 682d5986d8
commit fd4477992f
3 changed files with 22 additions and 9 deletions

View File

@ -6,7 +6,6 @@
1. `make` 1. `make`
- Third-party packages and other ways to run BQN are listed [here](https://mlochbaum.github.io/BQN/running.html) - Third-party packages and other ways to run BQN are listed [here](https://mlochbaum.github.io/BQN/running.html)
- Add `CC=cc` if `clang` isn't installed
- Add `FFI=0` if your system doesn't have libffi - Add `FFI=0` if your system doesn't have libffi
- Use `gmake` on BSD - Use `gmake` on BSD
- Add `REPLXX=0` if C++ is unavailable (will remove line editing/coloring/name completion in the REPL) - Add `REPLXX=0` if C++ is unavailable (will remove line editing/coloring/name completion in the REPL)
@ -38,7 +37,7 @@ For native builds, targeted extensions are determined by `/proc/cpuinfo` (or `sy
### Build flags ### Build flags
`CC=...` - choose a different C compiler (default is `clang`) `CC=...` - choose a different C compiler (default is `clang`, or `cc` if unavailable; CBQN is more tuned for clang, but gcc also works)
`CXX=...` - choose a different C++ compiler; needed only for REPLXX (default is `c++`) `CXX=...` - choose a different C++ compiler; needed only for REPLXX (default is `c++`)
`OUTPUT=path/to/somewhere` - change output location; for `emcc-o3` it will be the destination folder for `BQN.js` and `BQN.wasm`, for everything else - the filename `OUTPUT=path/to/somewhere` - change output location; for `emcc-o3` it will be the destination folder for `BQN.js` and `BQN.wasm`, for everything else - the filename
`target_arch=(x86-64|aarch64|generic)` - target architecture. Inferred from `uname` by default. Used for deciding target optimizations. `target_arch=(x86-64|aarch64|generic)` - target architecture. Inferred from `uname` by default. Used for deciding target optimizations.

View File

@ -138,11 +138,15 @@ Options:
{(on<Lowercase 𝕩)gvs} {(on<Lowercase 𝕩)gvs}
} }
SH { SH { # if 𝕨≢@, returns 𝕨 if failed to spawn
coe •SH{𝕊: 𝕩 {𝕊: "Error: Failed to spawn ",𝕨}_assert_ 0} 𝕩 defres 𝕨 @
coe •SH{defres@? ¯1defres@; ("Error: Failed to spawn ",𝕩)_assert_ 0} 𝕩
{
c¯1? o;
Log(×) e Log(×) e
𝕩 {𝕊: "Error: ",𝕨," exited with error code ",•Repr 𝕩}_assert_(0=) c 𝕩 {𝕊: "Error: ",𝕨," exited with error code ",•Repr 𝕩}_assert_(0=) c
o o
}𝕩
} }
TrySH {1•SH1𝕨"" 𝕩} TrySH {1•SH1𝕨"" 𝕩}
@ -194,6 +198,17 @@ po ← { # parsed options
"Error: Static linking for wasm is pointless"_assert_¬ staticBin wasm "Error: Static linking for wasm is pointless"_assert_¬ staticBin wasm
cc {emcc? "emcc"; "clang"} DOpt "CC" cc {emcc? "emcc"; "clang"} DOpt "CC"
ccClang {
clangd? 1;
TryVersion {𝕩 SH cc"--version"}
vs TryVersion {@GetOpt"CC"? ¯1; @}
{𝕊: cc"cc" Log "Note: default CC 'clang' wasn't found; building with 'cc'; add a `CC=cc` argument to hide" vsTryVersion@} vs¯1
´"clang"vs
}
cxx GetOpt "CXX" cxx GetOpt "CXX"
debug GetOpt "debug" debug GetOpt "debug"
rtverify GetOpt "rtverify" rtverify GetOpt "rtverify"
@ -262,7 +277,6 @@ po ← { # parsed options
singeliDir singeli SubmoduleDir "singeli" "Singeli" LogDir singeliDir singeliDir singeli SubmoduleDir "singeli" "Singeli" LogDir singeliDir
{𝕊: "Output location: "𝕩}_verboseLog output {𝕊: "Output location: "𝕩}_verboseLog output
ccClang {clangd? 1; ´"clang"SH cc"--version"}
ccColor ((¬clangd) tui DOpt "color") / ccClang"-fdiagnostics-color=always""-fcolor-diagnostics" ccColor ((¬clangd) tui DOpt "color") / ccClang"-fdiagnostics-color=always""-fcolor-diagnostics"
cbqnc { cbqnc {

View File

@ -93,7 +93,7 @@ heapverifyn-singeli: heapverifyn
rtverifyn-singeli: rtverifyn rtverifyn-singeli: rtverifyn
# compiler setup # compiler setup
i_CC := clang i_CC := cc
i_PIE := i_PIE :=
i_LIBS_LD := -lm i_LIBS_LD := -lm
i_LIBS_CC := -fvisibility=hidden i_LIBS_CC := -fvisibility=hidden