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:
parent
682d5986d8
commit
fd4477992f
@ -6,7 +6,6 @@
|
||||
|
||||
1. `make`
|
||||
- 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
|
||||
- Use `gmake` on BSD
|
||||
- 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
|
||||
|
||||
`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++`)
|
||||
`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.
|
||||
|
||||
@ -138,11 +138,15 @@ Options:
|
||||
{(⊑on⊐<Lowercase 𝕩)⊑gvs}
|
||||
}
|
||||
|
||||
SH ← {
|
||||
c‿o‿e ← •SH⎊{𝕊: 𝕩 {𝕊: ∾⟨"Error: Failed to spawn ",⊑𝕨⟩}_assert_⊢ 0} 𝕩
|
||||
SH ← { # if 𝕨≢@, returns 𝕨 if failed to spawn
|
||||
defres ← 𝕨 ⊣ @
|
||||
c‿o‿e ← •SH⎊{defres≢@? ¯1‿defres‿@; (∾⟨"Error: Failed to spawn ",⊑𝕩⟩)_assert_⊢ 0} 𝕩
|
||||
{
|
||||
c≡¯1? o;
|
||||
Log⍟(×≠) e
|
||||
𝕩 {𝕊: ∾⟨"Error: ",⊑𝕨," exited with error code ",•Repr 𝕩⟩}_assert_(0=⊢) c
|
||||
o
|
||||
}𝕩
|
||||
}
|
||||
TrySH ← {1⊑•SH⎊1‿𝕨‿"" 𝕩}
|
||||
|
||||
@ -194,6 +198,17 @@ po ← { # parsed options
|
||||
"Error: Static linking for wasm is pointless"_assert_¬ staticBin ∧ wasm
|
||||
|
||||
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" ⋄ vs↩TryVersion@}⍟⊢ vs≡¯1
|
||||
∨´"clang"⍷vs
|
||||
}
|
||||
|
||||
cxx ← GetOpt "CXX"
|
||||
debug ⇐ GetOpt "debug"
|
||||
rtverify ⇐ GetOpt "rtverify"
|
||||
@ -262,7 +277,6 @@ po ← { # parsed options
|
||||
singeliDir ⇐ singeli SubmoduleDir "singeli" ⋄ "Singeli" LogDir singeliDir
|
||||
{𝕊: "Output location: "∾𝕩}_verboseLog output
|
||||
|
||||
ccClang ← {clangd? 1; ∨´"clang"⍷SH cc‿"--version"}
|
||||
ccColor ⇐ ((¬clangd) ∧ tui DOpt "color") / ⟨ccClang⊑"-fdiagnostics-color=always"‿"-fcolor-diagnostics"⟩
|
||||
|
||||
cbqnc ← {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user