diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rwxr-xr-x | bin/initmk | 2 | ||||
-rw-r--r-- | compile_commands.json | 68 | ||||
-rw-r--r-- | include/libn.h | 12 | ||||
-rw-r--r-- | sys/rules.mk | 6 |
5 files changed, 68 insertions, 21 deletions
@@ -3,3 +3,4 @@ dep/ build/ vendor/ sys/cc +sys/nixos @@ -36,7 +36,7 @@ BINS := $(BINS) $(BINS_$(d)) $(LIBS_$(d)): $(OBJS_$(d)) $(ARCHIVE) -$(BINS_$(d)): $(OBJ_DIR)/libn/test.o +$(BINS_$(d)): $(OBJS_$(d)) $(LINK) # ---- Pop off stack ---- diff --git a/compile_commands.json b/compile_commands.json index 31a2936..99168be 100644 --- a/compile_commands.json +++ b/compile_commands.json @@ -7,13 +7,16 @@ "-fno-strict-aliasing", "-fwrapv", "-fms-extensions", + "-ffreestanding", + "-fno-builtin", + "-nostdlib", "-Iinclude", "-o", - "build/libn/error.o", - "sys/libn/error.c" + "build/libc/string.o", + "sys/libc/string.c" ], "directory": "/home/nolln/root", - "file": "sys/libn/error.c" + "file": "sys/libc/string.c" }, { "arguments": [ @@ -25,11 +28,11 @@ "-fms-extensions", "-Iinclude", "-o", - "build/libn/coro.o", - "sys/libn/coro.c" + "build/libn/test.o", + "sys/libn/test.c" ], "directory": "/home/nolln/root", - "file": "sys/libn/coro.c" + "file": "sys/libn/test.c" }, { "arguments": [ @@ -60,11 +63,27 @@ "-fms-extensions", "-Iinclude", "-o", - "build/libn/string.o", - "sys/libn/string.c" + "build/libn/error.o", + "sys/libn/error.c" ], "directory": "/home/nolln/root", - "file": "sys/libn/string.c" + "file": "sys/libn/error.c" + }, + { + "arguments": [ + "clang", + "-c", + "-g", + "-fno-strict-aliasing", + "-fwrapv", + "-fms-extensions", + "-Iinclude", + "-o", + "build/libn/bufio.o", + "sys/libn/bufio.c" + ], + "directory": "/home/nolln/root", + "file": "sys/libn/bufio.c" }, { "arguments": [ @@ -92,11 +111,11 @@ "-fms-extensions", "-Iinclude", "-o", - "build/libn/test.o", - "sys/libn/test.c" + "build/libn/io.o", + "sys/libn/io.c" ], "directory": "/home/nolln/root", - "file": "sys/libn/test.c" + "file": "sys/libn/io.c" }, { "arguments": [ @@ -106,15 +125,28 @@ "-fno-strict-aliasing", "-fwrapv", "-fms-extensions", - "-ffreestanding", - "-fno-builtin", - "-nostdlib", "-Iinclude", "-o", - "build/libc/string.o", - "sys/libc/string.c" + "build/libn/coro.o", + "sys/libn/coro.c" ], "directory": "/home/nolln/root", - "file": "sys/libc/string.c" + "file": "sys/libn/coro.c" + }, + { + "arguments": [ + "clang", + "-c", + "-g", + "-fno-strict-aliasing", + "-fwrapv", + "-fms-extensions", + "-Iinclude", + "-o", + "build/libn/string.o", + "sys/libn/string.c" + ], + "directory": "/home/nolln/root", + "file": "sys/libn/string.c" } ]
\ No newline at end of file diff --git a/include/libn.h b/include/libn.h index 64e2e70..74e230e 100644 --- a/include/libn.h +++ b/include/libn.h @@ -48,6 +48,18 @@ void* bufgrow(void*, vlong, vlong); void _bufpop(void*, int, vlong); // ----------------------------------------------------------------------------- +// Memory allocation + +// TODO: Think about interface here. +typedef struct Allocator { + void *(*alloc)(ulong size); + void *(*realloc)(void *ptr, ulong size); + void (*free)(void *ptr); +} Allocator; + +static Allocator mem·sys = { .alloc = &malloc, .realloc = &realloc, .free = &free}; + +// ----------------------------------------------------------------------------- // Co-routines typedef struct Coro Coro; diff --git a/sys/rules.mk b/sys/rules.mk index 362edcd..d7ca408 100644 --- a/sys/rules.mk +++ b/sys/rules.mk @@ -4,14 +4,16 @@ DIRSTACK_$(SP) := $(d) d := $(DIR) # Iterate through subdirectory tree + DIR := $(d)/libc include $(DIR)/rules.mk DIR := $(d)/libn include $(DIR)/rules.mk -# ---- Pop off stack ---- --include $(DEPS_$(d)) +DIR := $(d)/libbio +include $(DIR)/rules.mk +# ---- Pop off stack ---- d := $(DIRSTACK_$(SP)) SP := $(basename $(SP)) |