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) \