From 2ec1dfa0837e0e07893e444b45a14471820e912f Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Wed, 21 Jan 2026 09:33:35 +0000 Subject: [PATCH] Move some stuff around for cleanliness --- build.sh | 14 ++++++++------ constructor.c => runtime/constructor.c | 2 +- stream.c => runtime/stream.c | 2 +- sv.c => runtime/sv.c | 2 +- symtable.c => runtime/symtable.c | 2 +- sys.c => runtime/sys.c | 2 +- tag.c => runtime/tag.c | 2 +- vec.c => runtime/vec.c | 2 +- test.c => test/test.c | 2 +- 9 files changed, 16 insertions(+), 14 deletions(-) rename constructor.c => runtime/constructor.c (98%) rename stream.c => runtime/stream.c (99%) rename sv.c => runtime/sv.c (97%) rename symtable.c => runtime/symtable.c (98%) rename sys.c => runtime/sys.c (98%) rename tag.c => runtime/tag.c (98%) rename vec.c => runtime/vec.c (99%) rename test.c => test/test.c (99%) diff --git a/build.sh b/build.sh index c8e8cec..d70dfd9 100644 --- a/build.sh +++ b/build.sh @@ -3,13 +3,15 @@ set -xe CFLAGS="-Wall -Wextra -std=c11 -ggdb -fsanitize=address -fsanitize=undefined -Wswitch -Wswitch-enum" -LINK="-I." -LIB=$(find "./" -name "*.c" -not -name "main.c" -not -name "test.c") -OUT="alisp.out" +LDFLAGS="-lc" + +LIB=$(find "./runtime" -type 'f') +OUT="build/alisp.out" build() { - cc $LINK $CFLAGS -o $OUT $LIB main.c; - cc $LINK $CFLAGS -o test.out $LIB test.c; + mkdir -p build; + cc $CFLAGS -o $OUT $LIB main.c $LDFLAGS; + cc $CFLAGS -o build/test.out $LIB test/test.c $LDFLAGS; } clean() { @@ -21,7 +23,7 @@ run() { } test() { - ./test.out + ./build/test.out } build diff --git a/constructor.c b/runtime/constructor.c similarity index 98% rename from constructor.c rename to runtime/constructor.c index e0fab52..8b0e669 100644 --- a/constructor.c +++ b/runtime/constructor.c @@ -14,7 +14,7 @@ #include -#include "./alisp.h" +#include "../alisp.h" lisp_t *make_int(i64 i) { diff --git a/stream.c b/runtime/stream.c similarity index 99% rename from stream.c rename to runtime/stream.c index 19fa726..065bee4 100644 --- a/stream.c +++ b/runtime/stream.c @@ -15,7 +15,7 @@ #include #include -#include "./alisp.h" +#include "../alisp.h" stream_err_t stream_init_string(stream_t *stream, char *name, sv_t contents) { diff --git a/sv.c b/runtime/sv.c similarity index 97% rename from sv.c rename to runtime/sv.c index 7debd30..bdc5353 100644 --- a/sv.c +++ b/runtime/sv.c @@ -16,7 +16,7 @@ #include #include -#include "./alisp.h" +#include "../alisp.h" sv_t sv_copy(sv_t old) { diff --git a/symtable.c b/runtime/symtable.c similarity index 98% rename from symtable.c rename to runtime/symtable.c index 39139eb..60462d5 100644 --- a/symtable.c +++ b/runtime/symtable.c @@ -12,7 +12,7 @@ * Description: Symbol Table implementation */ -#include "./alisp.h" +#include "../alisp.h" #include #include diff --git a/sys.c b/runtime/sys.c similarity index 98% rename from sys.c rename to runtime/sys.c index ac3cb6e..90d7b73 100644 --- a/sys.c +++ b/runtime/sys.c @@ -12,7 +12,7 @@ * Description: System management */ -#include "./alisp.h" +#include "../alisp.h" #include #include diff --git a/tag.c b/runtime/tag.c similarity index 98% rename from tag.c rename to runtime/tag.c index 8ca688a..3b3a3e7 100644 --- a/tag.c +++ b/runtime/tag.c @@ -15,7 +15,7 @@ #include #include -#include "./alisp.h" +#include "../alisp.h" lisp_t *tag_int(i64 i) { diff --git a/vec.c b/runtime/vec.c similarity index 99% rename from vec.c rename to runtime/vec.c index 66a9682..644d904 100644 --- a/vec.c +++ b/runtime/vec.c @@ -16,7 +16,7 @@ #include #include -#include "./alisp.h" +#include "../alisp.h" void vec_init(vec_t *vec, u64 size) { diff --git a/test.c b/test/test.c similarity index 99% rename from test.c rename to test/test.c index c4c1838..3c2c247 100644 --- a/test.c +++ b/test/test.c @@ -16,7 +16,7 @@ #include #include -#include "./alisp.h" +#include "../alisp.h" #define TEST_PASSED() printf("[%s]: Pass\n", __func__) #define TEST(NAME, COND) \