From 253e7e1e242ef05cddab95a98dc8bdc80fc6dabf Mon Sep 17 00:00:00 2001 From: nub31 Date: Sun, 29 Jun 2025 15:50:06 +0200 Subject: [PATCH] include c std lib --- example/makefile | 4 +++- example/src/c.nub | 2 +- src/runtime/makefile | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/example/makefile b/example/makefile index 984c229..2ab521c 100644 --- a/example/makefile +++ b/example/makefile @@ -1,8 +1,10 @@ +CFLAGS = -Wall -Werror -Wextra -g + OBJECTS := $(shell dotnet run --project ../src/compiler/CLI/CLI.csproj src/main.nub src/c.nub) example: mkdir -p bin - gcc -o bin/out $(OBJECTS) + gcc $(CFLAGS) -o bin/out lib/libruntime_x64.a $(OBJECTS) clean: rm -r bin bin-int diff --git a/example/src/c.nub b/example/src/c.nub index 8347d6a..c0a5b4c 100644 --- a/example/src/c.nub +++ b/example/src/c.nub @@ -1,4 +1,4 @@ namespace c -extern func printf(fmt: cstring, arg: u64): void +// extern func printf(fmt: cstring, arg: u64): void extern func puts(fmt: cstring) diff --git a/src/runtime/makefile b/src/runtime/makefile index f620c40..d868586 100644 --- a/src/runtime/makefile +++ b/src/runtime/makefile @@ -1,7 +1,7 @@ CC ?= x86_64-linux-gnu-gcc TARGET ?= x64 -CFLAGS = -nostdlib -ffreestanding -Wall -Werror -Wextra -g +CFLAGS = -Wall -Werror -Wextra -g libruntime: bin-int/runtime.o $(CC) $(CFLAGS) -c targets/$(TARGET).s -o bin-int/$(TARGET).o