@@ -21,25 +21,27 @@ cd ..
2121ls -la vtcc/vtcc
2222./vtcc/vtcc --version
2323
24-if [[ "$(uname)" == "Darwin" ]]; then
25- show "macOS: vtcc built successfully (TCC cannot target ARM64, skipping full test)"
26- rm -rf vtcc/
27- exit 0
28-fi
29-
3024show "Generate the C file, for the current V version"
3125./v -o vlang.c cmd/v
3226ls -la vlang.c
3327
34-show "Compile the C file with vtcc"
35-./vtcc/vtcc -o v_compiled_with_vtcc vlang.c -lpthread
36-ls -la v_compiled_with_vtcc
37-
38-show "Test the resulting V compiler"
39-./v_compiled_with_vtcc version
40-
41-show "Compile and run hello with vtcc"
42-./v_compiled_with_vtcc -cc vtcc/vtcc -showcc run examples/hello_world.v
43-
44-show "Remove the generated temporary files, so the script can be re-run cleanly"
45-rm -rf v_compiled_with_vtcc vlang.c vtcc/
28+if [[ "$(uname)" == "Darwin" ]]; then
29+ show "Compile the C file with vtcc (object only, vtcc targets x86_64 ELF)"
30+ SDK_PATH="$(xcrun --show-sdk-path)"
31+ ./vtcc/vtcc -c vlang.c -o vlang.o -I"${SDK_PATH}/usr/include"
32+ ls -la vlang.o
33+ rm -rf vlang.o vlang.c vtcc/
34+else
35+ show "Compile the C file with vtcc"
36+ ./vtcc/vtcc -o v_compiled_with_vtcc vlang.c -lpthread
37+ ls -la v_compiled_with_vtcc
38+
39+ show "Test the resulting V compiler"
40+ ./v_compiled_with_vtcc version
41+
42+ show "Compile and run hello with vtcc"
43+ ./v_compiled_with_vtcc -cc vtcc/vtcc -showcc run examples/hello_world.v
44+
45+ show "Remove the generated temporary files, so the script can be re-run cleanly"
46+ rm -rf v_compiled_with_vtcc vlang.c vtcc/
47+fi