- C 95.3%
- Assembly 2.4%
- Makefile 1%
- C++ 0.5%
- Shell 0.4%
- Other 0.4%
| bench | ||
| examples | ||
| include | ||
| lib | ||
| src | ||
| tests | ||
| win32 | ||
| .gitignore | ||
| CLAUDE.md | ||
| CodingStyle | ||
| configure | ||
| conftest.c | ||
| license.md | ||
| Makefile | ||
| optclash | ||
| readme.md | ||
| scc-doc.texi | ||
| stab.def | ||
| tcc-doc.info | ||
| texi2pod.pl | ||
| TODO | ||
| todo-opti.md | ||
| todo.md | ||
| USES | ||
| VERSION | ||
Sharkk C Compiler
A hard fork of TCC, using it as a building block for a C compiler that approaches the ease of use of self-contained compilers like those for Go and Odin.
Installation
./configure
make
make install
CLI Usage
SCC uses Go-style subcommands for a clean, intuitive interface.
Commands
| Command | Description |
|---|---|
build |
Compile source files to executable |
run |
JIT compile and run |
obj |
Compile to object file |
pp |
Preprocess only |
lib |
Build shared library |
ar |
Archive tool |
version |
Show version |
help |
Show help |
Build
Compile source files to an executable.
scc build file.c # Output: a.out
scc build -o myapp file.c # Output: myapp
scc build -g -O2 file.c # With debug info and optimization
scc build file.c -lm -lpthread # Link with libraries
Run
JIT compile and execute immediately.
scc run file.c # Compile and run
scc run file.c -- arg1 arg2 # Pass arguments to program
scc run -DDEBUG file.c # With macro definition
Object Files
Compile to object files for later linking.
scc obj file.c # Output: file.o
scc obj -o custom.o file.c # Custom output name
scc obj file1.c file2.c # Multiple files
Preprocess
Run the preprocessor only.
scc pp file.c # Output to stdout
scc pp -o file.i file.c # Output to file
scc pp -P file.c # Without line markers
Shared Libraries
Build shared libraries (.so/.dll).
scc lib -o libfoo.so foo.c # Build shared library
scc lib -o libfoo.so foo.c -lm # With dependencies
Archive Tool
Create and manage static libraries.
scc ar rcs libfoo.a foo.o bar.o # Create archive
scc ar t libfoo.a # List contents
scc ar x libfoo.a # Extract
Common Flags
| Flag | Description |
|---|---|
-o FILE |
Output file |
-g |
Generate debug info |
-O[0-3] |
Optimization level |
-I DIR |
Add include path |
-D NAME[=VAL] |
Define macro |
-U NAME |
Undefine macro |
-L DIR |
Add library path |
-l LIB |
Link library |
-W NAME |
Warning option |
-static |
Static linking |
-pthread |
Enable pthreads |
-std=VERSION |
C standard (c11, gnu11) |
-v |
Verbose output |
-w |
Suppress warnings |
-B DIR |
Set compiler paths |
--project DIR |
Set project root explicitly |
--no-auto-paths |
Disable automatic path detection |
Project Detection
SCC automatically detects project structure and infers include/library paths, similar to Go and Odin. This eliminates the need for explicit -I flags in most cases.
How It Works
When you run scc build or scc run, the compiler walks up the directory tree looking for project markers:
scc.toml(explicit project file - highest priority).gitor.hg(version control roots)MakefileorCMakeLists.txt(build system markers)
Once a project root is found, these paths are automatically added if they exist:
| Directory | Added to | Purpose |
|---|---|---|
{root}/include/ |
Include paths | Project headers |
{root}/src/ |
Include paths | Source-relative includes |
{root}/vendor/ |
Include paths | Third-party code |
{root}/lib/ |
Library paths | Project libraries |
Directory Compilation
You can pass a directory instead of individual files to compile all .c files within it:
scc build src/ -o myapp # Compile all .c files in src/
scc build src/ lib/ -o myapp # Multiple directories
Implicit Directory Mode
When no files are specified, SCC will compile the project automatically:
cd myproject
scc build -o myapp # Compiles src/*.c (or project root if no src/)
Example Project Structure
myproject/
├── .git/ # Project root marker
├── include/
│ └── mylib.h # Auto-added to include path
├── src/
│ ├── main.c
│ └── utils.c
└── vendor/
└── json/
└── json.h # Auto-added to include path
# Old way (explicit paths)
scc build -Iinclude -Ivendor src/main.c src/utils.c -o myapp
# New way (auto-detected)
cd myproject
scc build src/main.c src/utils.c -o myapp
# Even simpler (directory compilation)
scc build src/ -o myapp
# Simplest (implicit mode)
scc build -o myapp
Controlling Auto-Detection
# Disable auto-detection entirely
scc build --no-auto-paths -Iinclude src/*.c -o myapp
# Explicitly set project root (useful when building from outside project)
scc build --project=/path/to/project src/*.c -o myapp
Help
scc help # General help
scc help build # Help for build command
scc help run # Help for run command
Examples
# Hello World
echo 'int main() { printf("Hello\\n"); }' > hello.c
scc run hello.c
# Build with optimization
scc build -O2 -o fast program.c
# Debug build
scc build -g -o debug program.c
# Link multiple files with libraries
scc build main.c utils.c -lm -o app
# Compile to object, then link
scc obj file1.c file2.c
scc build file1.o file2.o -o app
License
LGPL-2.1 (inherited from TCC)