diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 19e28bd4a..cfa579247 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -7,6 +7,36 @@ on: branches: [ master ] jobs: + + build-msvc: + runs-on: windows-latest + strategy: + # Don't abort runners if a single one fails + fail-fast: false + matrix: + build_type: [ Release, Debug ] + + defaults: + run: + shell: cmd + steps: + - uses: actions/checkout@v3 + + - name: CMake + run: | + cmake -B build -G "Visual Studio 17 2022" -A x64 -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} + cmake --build build --config ${{ matrix.build_type }} + + - name: Build testproject + run: | + cd resources/testproject + ..\..\build\${{ matrix.build_type }}\c3c.exe --debug-log run hello_world_win32 + + - name: run compiler tests + run: | + cd test + python3.exe src/tester.py ..\build\${{ matrix.build_type }}\c3c.exe test_suite/ + build-msys2-mingw: runs-on: windows-latest strategy: @@ -38,13 +68,14 @@ jobs: - name: Build testproject run: | cd resources/testproject - ../../build/c3c build --debug-log + ../../build/c3c run --debug-log - name: run compiler tests run: | cd test python3 src/tester.py ../build/c3c.exe test_suite/ + build-msys2-clang: runs-on: windows-latest #if: ${{ false }} @@ -73,7 +104,7 @@ jobs: - name: Build testproject run: | cd resources/testproject - ../../build/c3c build --debug-log + ../../build/c3c run --debug-log - name: run compiler tests run: | @@ -118,7 +149,12 @@ jobs: - name: Build testproject run: | cd resources/testproject - ../../build/c3c build --debug-log + ../../build/c3c run --debug-log + + - name: Build testproject direct linker + run: | + cd resources/testproject + ../../build/c3c run --debug-log --forcelinker - name: run compiler tests run: | @@ -150,7 +186,12 @@ jobs: - name: Build testproject run: | cd resources/testproject - ../../build/c3c build --debug-log + ../../build/c3c run --debug-log + + - name: Build testproject direct linker + run: | + cd resources/testproject + ../../build/c3c run --debug-log --forcelinker - name: run compiler tests run: | diff --git a/CMakeLists.txt b/CMakeLists.txt index fb878b4e2..06e431adb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,10 +1,18 @@ -cmake_minimum_required(VERSION 3.10) +cmake_minimum_required(VERSION 3.15) project(c3c) include(FetchContent) include(FeatureSummary) set(CMAKE_FIND_PACKAGE_SORT_ORDER NATURAL) set(CMAKE_FIND_PACKAGE_SORT_DIRECTION DEC) +set(CMAKE_C_STANDARD 11) +set(CMAKE_CXX_STANDARD 17) + +set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O1") +set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -gdwarf-3 -O3") +set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -gdwarf-3") + +option(C3_USE_TB "Enable TB" OFF) set(C3_LLVM_VERSION "auto" CACHE STRING "Use LLVM version [default: auto]") option(C3_USE_MIMALLOC "Use built-in mimalloc" OFF) set(C3_MIMALLOC_TAG "v1.7.3" CACHE STRING "Used version of mimalloc") @@ -23,29 +31,49 @@ if(C3_USE_MIMALLOC) FetchContent_MakeAvailable(mimalloc) endif() -if(NOT C3_LLVM_VERSION STREQUAL "auto") - if(${C3_LLVM_VERSION} VERSION_LESS 12 OR ${C3_LLVM_VERSION} VERSION_GREATER 15) +if (NOT C3_LLVM_VERSION STREQUAL "auto") + if (${C3_LLVM_VERSION} VERSION_LESS 12 OR ${C3_LLVM_VERSION} VERSION_GREATER 15) message(FATAL_ERROR "LLVM ${C3_LLVM_VERSION} is not supported!") endif() - find_package(LLVM ${C3_LLVM_VERSION} REQUIRED CONFIG) +endif() + +if(CMAKE_C_COMPILER_ID STREQUAL "MSVC") + if (C3_LLVM_VERSION STREQUAL "auto") + set(C3_LLVM_VERSION "14") + endif() + FetchContent_Declare( + LLVM_Windows + URL https://github.com/c3lang/win-llvm/releases/download/llvm-lld-14.0.1/llvm-14.0.1-windows-amd64-msvc16-libcmt.7z + ) + FetchContent_Declare( + LLVM_Windows_debug + URL https://github.com/c3lang/win-llvm/releases/download/llvm-lld-14.0.1/llvm-14.0.1-windows-amd64-msvc16-libcmt-dbg.7z + ) + if(CMAKE_BUILD_TYPE STREQUAL "Debug") + message("Loading Windows LLVM debug libraries, this may take a while...") + FetchContent_MakeAvailable(LLVM_Windows_debug) + set(CMAKE_SYSTEM_PREFIX_PATH ${llvm_windows_debug_SOURCE_DIR} ${CMAKE_SYSTEM_PREFIX_PATH}) + else() + message("Loading Windows LLVM libraries, this may take a while...") + FetchContent_MakeAvailable(LLVM_Windows) + set(CMAKE_SYSTEM_PREFIX_PATH ${llvm_windows_SOURCE_DIR} ${CMAKE_SYSTEM_PREFIX_PATH}) + endif() + find_package(LLVM REQUIRED CONFIG) + find_package(LLD REQUIRED CONFIG) else() - find_package(LLVM REQUIRED CONFIG) + if (NOT C3_LLVM_VERSION STREQUAL "auto") + find_package(LLVM ${C3_LLVM_VERSION} REQUIRED CONFIG) + else() + find_package(LLVM REQUIRED CONFIG) + endif() endif() message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}") message(STATUS "Using LLVMConfig.cmake in: ${LLVM_DIR}") message(STATUS "Libraries located in: ${LLVM_LIBRARY_DIRS}") - include_directories(${LLVM_INCLUDE_DIRS}) add_definitions(${LLVM_DEFINITIONS}) -set(CMAKE_C_STANDARD 11) -set(CMAKE_CXX_STANDARD 17) - -set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O1") -set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -gdwarf-3 -O3") -set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -gdwarf-3") - set(LLVM_LINK_COMPONENTS AllTargetsAsmParsers AllTargetsCodeGens @@ -73,7 +101,7 @@ set(LLVM_LINK_COMPONENTS Target TransformUtils WindowsManifest - ) +) if (${LLVM_PACKAGE_VERSION} VERSION_GREATER 14.1) set(LLVM_LINK_COMPONENTS ${LLVM_LINK_COMPONENTS} WindowsDriver) @@ -83,25 +111,31 @@ llvm_map_components_to_libnames(llvm_libs ${LLVM_LINK_COMPONENTS}) file(COPY ${CMAKE_SOURCE_DIR}/lib DESTINATION ${CMAKE_BINARY_DIR}) + # These don't seem to be reliable on windows. -if(UNIX) - message(STATUS "using find_library") -# find_library(TB_LIB NAMES tinybackend.a PATHS ${CMAKE_SOURCE_DIR}/resources/tblib) - find_library(LLD_COFF NAMES lldCOFF.a liblldCOFF.a PATHS ${LLVM_LIBRARY_DIRS}) - find_library(LLD_COMMON NAMES lldCommon.a liblldCommon.a PATHS ${LLVM_LIBRARY_DIRS}) - find_library(LLD_ELF NAMES lldELF.a liblldELF.a PATHS ${LLVM_LIBRARY_DIRS}) - find_library(LLD_MACHO NAMES lldMachO.a liblldMachO.a PATHS ${LLVM_LIBRARY_DIRS}) - find_library(LLD_MINGW NAMES lldMinGW.a liblldMinGW.a PATHS ${LLVM_LIBRARY_DIRS}) - find_library(LLD_WASM NAMES lldWasm.a liblldWasm.a PATHS ${LLVM_LIBRARY_DIRS}) +message(STATUS "using find_library") +if(C3_USE_TB) + find_library(TB_LIB NAMES tinybackend.a tinybackend.lib PATHS ${CMAKE_SOURCE_DIR}/resources/tblib) +endif() +find_library(LLD_COFF NAMES lldCOFF.lib lldCOFF.a liblldCOFF.a PATHS ${LLVM_LIBRARY_DIRS}) +find_library(LLD_COMMON NAMES lldCommon.lib lldCommon.a liblldCommon.a PATHS ${LLVM_LIBRARY_DIRS}) +find_library(LLD_ELF NAMES lldELF.lib lldELF.a liblldELF.a PATHS ${LLVM_LIBRARY_DIRS}) +if (${LLVM_PACKAGE_VERSION} VERSION_LESS 14) + find_library(LLD_MACHO NAMES lldMachO2.lib lldMachO2.a liblldMachO2.a PATHS ${LLVM_LIBRARY_DIRS}) +else () + find_library(LLD_MACHO NAMES lldMachO.lib lldMachO.a liblldMachO.a PATHS ${LLVM_LIBRARY_DIRS}) +endif () +find_library(LLD_MINGW NAMES lldMinGW.lib lldMinGW.a liblldMinGW.a PATHS ${LLVM_LIBRARY_DIRS}) +find_library(LLD_WASM NAMES lldWasm.lib lldWasm.a liblldWasm.a PATHS ${LLVM_LIBRARY_DIRS}) - if (${LLVM_PACKAGE_VERSION} VERSION_LESS 14) - find_library(LLD_CORE NAMES lldCore.a liblldCore.a PATHS ${LLVM_LIBRARY_DIRS}) - find_library(LLD_DRIVER NAMES lldDriver.a liblldDriver.a PATHS ${LLVM_LIBRARY_DIRS}) - find_library(LLD_READER_WRITER NAMES lldReaderWriter.a liblldReaderWriter.a PATHS ${LLVM_LIBRARY_DIRS}) - find_library(LLD_YAML NAMES lldYAML.a liblldYAML.a PATHS ${LLVM_LIBRARY_DIRS}) - endif() +if (${LLVM_PACKAGE_VERSION} VERSION_LESS 14) + find_library(LLD_CORE NAMES lldCore.lib lldCore.a liblldCore.a PATHS ${LLVM_LIBRARY_DIRS}) + find_library(LLD_DRIVER NAMES lldDriver.lib lldDriver.a liblldDriver.a PATHS ${LLVM_LIBRARY_DIRS}) + find_library(LLD_READER_WRITER NAMES lldReaderWriter.lib lldReaderWriter.a liblldReaderWriter.a PATHS ${LLVM_LIBRARY_DIRS}) + find_library(LLD_YAML NAMES lldYAML.lib lldYAML.a liblldYAML.a PATHS ${LLVM_LIBRARY_DIRS}) +endif () - set(lld_libs +set(lld_libs ${LLD_COFF} ${LLD_COMMON} ${LLD_WASM} @@ -113,10 +147,12 @@ if(UNIX) ${LLD_YAML} ${LLD_CORE} ) - message(STATUS "linking to llvm libs ${llvm_libs} ${lld_libs}") -endif() +if (APPLE) + set(lld_libs ${lld_libs} xar) +endif () -message(STATUS "Found LLD ${lld_libs}") +message(STATUS "linking to llvm libs ${lld_libs}") +message(STATUS "Found lld libs ${lld_libs}") add_library(c3c_wrappers STATIC wrapper/src/wrapper.cpp) @@ -138,6 +174,7 @@ add_executable(c3c src/compiler/float.c src/compiler/headers.c src/compiler/lexer.c + src/compiler/libraries.c src/compiler/linker.c src/compiler/llvm_codegen.c src/compiler/llvm_codegen_c_abi_aarch64.c @@ -196,11 +233,13 @@ add_executable(c3c src/utils/vmem.h src/utils/whereami.c src/compiler/decltable.c + src/compiler/mac_support.c src/compiler/tilde_codegen_storeload.c src/compiler/llvm_codegen_storeload.c src/compiler/tilde_codegen_expr.c src/compiler/tilde_codegen_stmt.c - src/compiler/tilde_codegen_type.c) + src/compiler/tilde_codegen_type.c + src/compiler/windows_support.c) if(NOT CMAKE_C_COMPILER_ID STREQUAL "MSVC") message(STATUS "using gcc/clang warning switches") @@ -219,20 +258,31 @@ target_include_directories(c3c_wrappers PRIVATE -if(UNIX) - target_link_libraries(c3c_wrappers ${llvm_libs} ${lld_libs}) - target_link_libraries(c3c m ${llvm_libs} c3c_wrappers ${lld_libs}) -# target_link_libraries(c3c m ${llvm_libs} c3c_wrappers ${TB_LIB} ${lld_libs}) - if(C3_USE_MIMALLOC) - target_link_libraries(c3c m mimalloc-static) - endif() +target_link_libraries(c3c_wrappers ${llvm_libs} ${lld_libs}) +target_link_libraries(c3c ${llvm_libs} c3c_wrappers ${lld_libs}) +if(C3_USE_TB) + target_link_libraries(c3c c3c_wrappers ${TB_LIB}) + target_compile_definitions(c3c PUBLIC TB_BACKEND=1) else() - # todo: maybe get this from llvm-config somehow? it should be in LLVM_DIR\..\..\..\bin I think. - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -LIBPATH:C:\\llvm\\llvm\\build\\Release\\lib") # needed for lldCommon.lib - #set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -LIBPATH:${LLVM_LIBPATH}") # This doesn't seem to work for some reason - message(STATUS "${LLVM_LIBPATH}") - target_link_libraries(c3c debug ${llvm_libs} c3c_wrappers lldCommon lldCore lldCOFF lldWASM lldMinGW lldELF lldDriver lldReaderWriter lldMachO lldYAML Advapi32) - target_link_libraries(c3c optimized ${llvm_libs} c3c_wrappers lldCommon lldCore lldCOFF lldWASM lldMinGW lldELF lldDriver lldReaderWriter lldMachO lldYAML Advapi32) + target_compile_definitions(c3c PUBLIC TB_BACKEND=0) +endif() + +if(C3_USE_MIMALLOC) + target_link_libraries(c3c mimalloc-static) +endif() + +if(CMAKE_C_COMPILER_ID STREQUAL "MSVC") + message("Adding MSVC options") + target_compile_options(c3c PRIVATE /wd4068 /wd4090 /WX) + target_compile_options(c3c_wrappers PUBLIC /wd4624 /wd4267 /wd4244 /WX) + if(CMAKE_BUILD_TYPE STREQUAL "Debug") + target_compile_options(c3c PUBLIC /MTd) + target_compile_options(c3c_wrappers PUBLIC /MTd) + else() + target_compile_options(c3c PUBLIC /MT) + target_compile_options(c3c_wrappers PUBLIC /MT) + endif() + endif() if (WIN32) diff --git a/README.md b/README.md index ced0d3ec3..cc64308f4 100644 --- a/README.md +++ b/README.md @@ -129,7 +129,7 @@ fn void test() ### Current status -The current version of the compiler is alpha release 0.1.0. +The current version of the compiler is alpha release 0.2. It's possible to try out the current C3 compiler in the browser: https://ide.judge0.com/ – this is courtesy of the developer of Judge0. @@ -142,8 +142,7 @@ Follow the issues [here](https://github.com/c3lang/c3c/issues). If you have suggestions on how to improve the language, either [file an issue](https://github.com/c3lang/c3c/issues) or discuss C3 on its dedicated Discord: [https://discord.gg/qN76R87](https://discord.gg/qN76R87). -The compiler should compile on Linux, Windows (under MSVC, Mingw or MSYS2) and MacOS, -but needs some install documentation for Windows. +The compiler currently compile on Linux, Windows and MacOS. diff --git a/resources/testfragments/raylibtest.c3 b/resources/testfragments/raylibtest.c3 new file mode 100644 index 000000000..d6b21dd53 --- /dev/null +++ b/resources/testfragments/raylibtest.c3 @@ -0,0 +1,167 @@ +module foo; +extern fn void printf(char*, ...); + +enum Foo : int (int offset, char* extra_name, double x) +{ + BAZ(12, "hello", 3.0), + BOO(33, "oekfe", 4.0) = 3, +} + +fn void main() +{ + int screenWidth = 800; + int screenHeight = 450; + + raylib::init_window(screenWidth, screenHeight, "raylib [core] example - keyboard input"); + + Vector2 ballPosition = { (float)screenWidth/2, (float)screenHeight/2 }; + + raylib::set_target_fps(60); // Set our game to run at 60 frames-per-second + //-------------------------------------------------------------------------------------- + foo2::tester(screenHeight); + // Main game loop + while (!raylib::window_should_close()) // Detect window close button or ESC key + { + // Update + //---------------------------------------------------------------------------------- + if (raylib::is_key_down(KeyboardKey.RIGHT)) ballPosition.x += 2.0f; + if (raylib::is_key_down(KeyboardKey.LEFT)) ballPosition.x -= 2.0f; + if (raylib::is_key_down(KeyboardKey.UP)) ballPosition.y -= 2.0f; + if (raylib::is_key_down(KeyboardKey.DOWN)) ballPosition.y += 2.0f; + //---------------------------------------------------------------------------------- + + // Draw + //---------------------------------------------------------------------------------- + raylib::begin_drawing(); + + raylib::clear_background(raylib::RAYWHITE); + + raylib::draw_text("move the ball with arrow keys", 10, 10, 20, raylib::DARKGRAY); + + raylib::draw_circle_v(ballPosition, 50, raylib::MAROON); + + raylib::end_drawing(); + //---------------------------------------------------------------------------------- + } + + // De-Initialization + //-------------------------------------------------------------------------------------- + raylib::close_window(); // Close window and OpenGL context + //-------------------------------------------------------------------------------------- +} +/* +struct Game +{ + int answer; + bool done; + int guesses; + int high; +} + +int err_count = 0; + + +import "core:bufio" +import "core:fmt" +import "core:io" +import "core:mem" +import "core:os" +import "core:strconv" +import "core:time" +import "core:math/rand" + +Game :: struct { + answer: int, + done: bool, + guesses: int, + high: int, +} + +int err_count = 0; +*/ +/* +fn int ask_guess(int high) +{ + libc::printf("Guess a number between 1 and %d: ", high); + +} +ask_guess :: proc(high: int) -> (result: int, ok: bool) { + fmt.printf("Guess a number between 1 and %d: ", high) + if text, ok := read_line(); ok { + defer mem.delete(text) + return strconv.parse_int(s = text, base = 10) + } + return +} + +ask_guess_multi :: proc(high: int) -> int { + for { + if result, ok := ask_guess(high); ok { + return result + } + fmt.println("I didn't understand") + err_count += 1 + } +} + +pick_answer :: proc(high: int, r: ^rand.Rand) -> int { + return rand.int_max(high, r) + 1 +} + +play :: proc(game: ^Game) { + for !game.done { + guess := ask_guess_multi(game.high) + report(game^, guess) + game^ = update(game^, guess) + } +} + +read_line :: proc() -> (result: string, ok: bool) { + // See also: + // - https://github.com/odin-lang/Odin/issues/1214 + // - https://p.teknik.io/Raw/IT996 + s := os.stream_from_handle(os.stdin) + r: bufio.Reader + bufio.reader_init(&r, io.Reader{s}) + defer bufio.reader_destroy(&r) + if line, err := bufio.reader_read_string(&r, '\n'); err == .None { + return line[:len(line) - 1], true + } + return +} + +report :: proc(game: Game, guess: int) { + // game.done = true + // fmt.println(&game) + description := ( + "too low" if guess < game.answer else + "too high" if guess > game.answer else + "the answer!" + ) + fmt.println(guess, "is", description) +} + +update :: proc(game: Game, guess: int) -> (next: Game) { + next = game + next.done = guess == game.answer + next.guesses += 1 + return +} + +main :: proc() { + high :: 100 + r := rand.create(transmute(u64)time.now()) + // Or use nil for default random. + answer := pick_answer(high, &r) + game := Game {answer = answer, done = false, guesses = 0, high = high} + play(&game) + fmt.println("Finished in", game.guesses, "guesses"); + fmt.println("Total input errors:", err_count) +} +*/ + +module foo2; +fn void tester(int x) +{ + assert(x > 1000, "Shit!"); +} diff --git a/resources/testproject/hello_world.c3 b/resources/testproject/hello_world.c3 index 9e3b61836..095dcdd91 100644 --- a/resources/testproject/hello_world.c3 +++ b/resources/testproject/hello_world.c3 @@ -1,7 +1,13 @@ module hello_world; -import bar; +$if (env::OS_TYPE == OsType.WIN32): +fn int test_doubler(int x) +{ + return x * x; +} +$else: extern fn int test_doubler(int); +$endif; extern fn void printf(char *, ...); fn int main() @@ -9,5 +15,5 @@ fn int main() printf("Hello World!\n"); bar::test(); printf("Hello double: %d\n", test_doubler(11)); - return 1; + return 17; } \ No newline at end of file diff --git a/resources/testproject/project.c3p b/resources/testproject/project.c3p index f13a01548..284544d76 100644 --- a/resources/testproject/project.c3p +++ b/resources/testproject/project.c3p @@ -16,12 +16,16 @@ // c compiler "cc": "cc", // c sources - "csources": [ - "./csource/**" - ], "targets": { "hello_world": { "type": "executable", + "csources": [ + "./csource/**" + ] + }, + "hello_world_win32": { + "type": "executable", } + }, } \ No newline at end of file diff --git a/src/build/build_options.c b/src/build/build_options.c index 9396e4d72..133b82b8a 100644 --- a/src/build/build_options.c +++ b/src/build/build_options.c @@ -14,6 +14,7 @@ #include #include "../utils/whereami.h" +extern int llvm_version_major; static int arg_index; static int arg_count; @@ -23,30 +24,30 @@ extern const char* llvm_version; extern const char* llvm_target; char *arch_os_target[ARCH_OS_TARGET_LAST + 1] = { - [X86_FREEBSD] = "x86-freebsd", - [X86_OPENBSD] = "x86-openbsd", - [X86_NETBSD] = "x86-netbsd", - [X86_MCU] = "x86-mcu", - [X86_ELF] = "x86-elf", - [X86_WINDOWS] = "x86-windows", - [X86_LINUX] = "x86-linux", - [X64_DARWIN] = "x64-darwin", - [X64_LINUX] = "x64-linux", - [X64_WINDOWS] = "x64-windows", - [X64_WINDOWS_GNU] = "x64-mingw", - [X64_FREEBSD] = "x64-freebsd", - [X64_OPENBSD] = "x64-openbsd", - [X64_NETBSD] = "x64-netbsd", - [X64_ELF] = "x64-elf", - [AARCH64_LINUX] = "aarch64-linux", - [AARCH64_DARWIN] = "aarch64-darwin", - [AARCH64_ELF] = "aarch64-elf", - [RISCV32_LINUX] = "riscv32-linux", - [RISCV32_ELF] = "riscv32-elf", - [RISCV64_LINUX] = "riscv64-linux", - [RISCV64_ELF] = "riscv64-elf", + [WINDOWS_X86] = "windows-x86", + [WINDOWS_X64] = "windows-x64", + [MINGW_X64] = "mingw-x64", + [MACOS_X64] = "macos-x64", + [MACOS_AARCH64] = "macos-aarch64", + [LINUX_X86] = "linux-x86", + [LINUX_X64] = "linux-x64", + [LINUX_AARCH64] = "linux-aarch64", + [LINUX_RISCV32] = "linux-riscv32", + [LINUX_RISCV64] = "linux-riscv64", [WASM32] = "wasm32", [WASM64] = "wasm64", + [ELF_X86] = "elf-x86", + [ELF_X64] = "elf-x64", + [ELF_AARCH64] = "elf-aarch64", + [ELF_RISCV32] = "elf-riscv32", + [ELF_RISCV64] = "elf-riscv64", + [FREEBSD_X86] = "freebsd-x86", + [FREEBSD_X64] = "freebsd-x64", + [OPENBSD_X86] = "openbsd-x86", + [OPENBSD_X64] = "openbsd-x64", + [NETBSD_X86] = "netbsd-x86", + [NETBSD_X64] = "netbsd-x64", + [MCU_X86] = "mcu-x86", }; #define EOUTPUT(string, ...) fprintf(stderr, string "\n", ##__VA_ARGS__) @@ -74,7 +75,8 @@ static void usage(void) OUTPUT("Options:"); OUTPUT(" --tinybackend - Use the TinyBackend for compilation."); OUTPUT(" --stdlib - Use this directory as the C3 standard library path."); - OUTPUT(" --lib - Use this directory as the C3 library path."); + OUTPUT(" --libdir - Add this directory to the C3 library search paths."); + OUTPUT(" --lib - Add this library to the compilation."); OUTPUT(" --path - Use this as the base directory for the current command."); OUTPUT(" --template