cli improvements

This commit is contained in:
nub31
2025-08-18 17:38:51 +02:00
parent 8e36aa4d95
commit 0b4bad6772
6 changed files with 62 additions and 105 deletions

4
example/.gitignore vendored
View File

@@ -1,2 +1,2 @@
bin
bin-int
build
out

View File

@@ -1,17 +1,18 @@
CC = clang
NUBC = ../src/compiler/NubLang.CLI/bin/Debug/net9.0/nubc
out: $(NUBC) main.nub
$(NUBC) main.nub
out: build/out.a
$(CC) -o out build/out.a
build/out.a: $(NUBC) src/main.nub
$(NUBC) src/main.nub
$(NUBC):
dotnet build ../src/compiler/NubLang.CLI/NubLang.CLI.csproj
run: out
out
./out
clean:
@rm -r build 2>/dev/null || true
@rm out 2>/dev/null || true
@rm out.a 2>/dev/null || true
@find . -name "*.o" -type f -delete
@find . -name "*.s" -type f -delete
@find . -name "*.ssa" -type f -delete

8
example/src/main.nub Normal file
View File

@@ -0,0 +1,8 @@
// c
extern func puts(text: cstring)
func main(args: []cstring): i64
{
puts("Hello, World")
return 0
}