c3c(1)

NAME
c3c - Compiler for the C3 programming language

SYNOPSIS
c3c [options ...] command [args ...]

DESCRIPTION
c3c is the compiler for the C3 language, providing commands for compilation, project management, testing, and distribution. The available commands allow users to compile files, initialize projects, build targets, run benchmarks, clean build files, and more.

COMMANDS

c3c compile file1 [file2 ...]
    Compile files without a project into an executable.

c3c init project name
    Initialize a new project structure.

c3c init-lib library name
    Initialize a new library structure.

c3c build [target]
    Build the target in the current project.

c3c benchmark
    Run the benchmarks in the current project.

c3c test
    Run the unit tests in the current project.

c3c clean
    Clean all build files.

c3c run [target] [-- [arg1 ...]]
    Run (and build if needed) the target in the current project.

c3c dist [target]
    Clean and build a target for distribution.

c3c directives [target]
    Generate documentation for the target.

c3c bench [target]
    Benchmark a target.

c3c clean-run [target] [-- [arg1 ...]]
    Clean, then run the target.

c3c compile-run file1 [file2 ...] [-- [arg1 ...]]
    Compile files then immediately run the result.

c3c compile-only file1 [file2 ...]
    Compile files but do not perform linking.

c3c compile-benchmark file1 [file2 ...]
    Compile files into an executable and run benchmarks.

c3c compile-test file1 [file2 ...]
    Compile files into an executable and run unit tests.

c3c static-lib file1 [file2 ...]
    Compile files without a project into a static library.

c3c dynamic-lib file1 [file2 ...]
    Compile files without a project into a dynamic library.

c3c headers file1 [file2 ...]
    Analyze files and generate C headers for public methods.

c3c vendor-fetch library ...
    Fetch one or more libraries from the vendor collection.

c3c project subcommand ...
    Manipulate or view project files.

c3c fetch windows-sdk|macos-sdk|android-ndk [options ...]
    Fetches the SDK required for cross-compiling.

OPTIONS

--stdlib dir
    Use this directory as the C3 standard library path.

--no-entry
    Do not generate (or require) a main function.

--libdir dir
    Add this directory to the C3 library search paths.

--lib name
    Add this library to the compilation.

--path dir
    Use this as the base directory for the current command.

--template template
    Select template for 'init': "exe", "static-lib", "dynamic-lib" or a path.

--about Prints a short description of C3.

--symtab value
    Sets the preferred symtab size.

--max-mem value
    Sets the preferred max memory size.

--run-once
    After running the output file, delete it immediately.

-V, --version Print version information.

-E Lex only.

-P Only parse and output the AST as JSON.

-C Only lex, parse and check.

- code...
    Read code from standard in.

-o file
    Write output to file.

-O0 Safe, no optimizations, emit debug info.

-O1 Safe, high optimization, emit debug info.

-O2 Unsafe, high optimization, emit debug info.

-O3 Unsafe, high optimization, single module, emit debug info.

-O4 Unsafe, highest optimization, relaxed maths, single module, emit debug info, no panic messages.

-O5 Unsafe, highest optimization, fast maths, single module, emit debug info, no panic messages, no backtrace.

-Os Unsafe, high optimization, small code, single module, no debug info, no panic messages.

-Oz Unsafe, high optimization, tiny code, single module, no debug info, no panic messages, no backtrace.

-D name
    Add feature flag name.

-U name
    Remove feature flag name.

--trust= option
    Trust level: none (default), include ($include allowed), full ($exec / exec allowed).

--output-dir dir
    Override general output directory.

--threads number
    Set the number of threads to use for compilation.

--show-backtrace= yes|no
    Show detailed backtrace on segfaults.

-g Emit debug info.

-g0 Emit no debug info.

-l library
    Link with the library provided.

-L library dir
    Append the directory to the linker search paths.

-z argument
    Send the argument as a parameter to the linker.

--cc path
    Set C compiler (for C files in projects and use as system linker).

--linker= option [path]
    Specify the linker: builtin, cc, custom (default is 'cc'). 'Custom' requires a path.

--use-stdlib= yes|no
    Include the standard library (default: yes).

--link-libc= yes|no
    Link libc and other default libraries (default: yes).

--emit-stdlib= yes|no
    Output files for the standard library (default: yes).

--panicfn name
    Override the panic function name.

--testfn name
    Override the test runner function name.

--benchfn name
    Override the benchmark runner function name.

--reloc= option
    Specify the relocation model: none, pic, PIC, pie, PIE.

--x86cpu= option
    Set general level of x64 CPU: baseline, ssse3, sse4, avx1, avx2-v1, avx2-v2 (Skylake/Zen1+), avx512 (Icelake/Zen4+), native.

--x86vec= option
    Set maximum type of vector use: none, mmx, sse, avx, avx512, default.

--riscvfloat= option
    Set type of RISC-V float support: none, float, double.

--memory-env= option
    Set the memory environment: normal, small, tiny, none.

--strip-unused= yes|no
    Strip unused code and globals from the output (default: yes).

--fp-math= option
    Specify floating-point math behavior: strict, relaxed, fast.

--win64-simd= option
    Windows SIMD ABI: array, full.

--debug-stats Print debug statistics.

--print-linking Print linker arguments.

--debug-log Print debug logging to stdout.

--benchmarking Run built-in benchmarks.

--testing Run built-in tests.

--list-attributes List all attributes.

--list-builtins List all builtins.

--list-keywords List all keywords.

--list-operators List all operators.

--list-precedence List operator precedence order.

--list-project-properties List all available keys used in project.json files.

--list-manifest-properties List all available keys used in manifest.json files.

--list-targets List all architectures the compiler supports.

--list-type-properties List all type properties.

--print-output Print the object files created to stdout.

--print-input Print inputted C3 files to stdout.

--win-sdk dir
    Set the directory for Windows system library files for cross-compilation.

--wincrt= option
    Windows CRT linking: none, static-debug, static, dynamic-debug (default if debug info enabled), dynamic (default).

--windef file
    Use Windows 'def' file for function exports instead of 'dllexport'.

--macos-sdk dir
    Set the directory for the MacOS SDK for cross-compilation.

--macos-min-version ver
    Set the minimum MacOS version to compile for.

--macos-sdk-version ver
    Set the MacOS SDK version to compile for.

--linux-crt dir
    Set the directory to use for finding crt1.o and related files.

--linux-crtbegin dir
    Set the directory to use for finding crtbegin.o and related files.

--android-ndk dir
    Set the directory for the Android NDK for cross-compilation.

--android-api ver
    Set the Android API version to target.

--vector-conv= option
    Set vector conversion behavior: default, old.

--sanitize= option
    Enable a sanitizer: address, memory, thread.

EXAMPLES

Create a project:
    c3c init new_project

Create a library project:
    c3c init-lib new_library

Compile a file:
    c3c compile main.c3

Build the current project:
    c3c build

Run tests for the current project:
    c3c test