From 5cc3007176212d9efaf737acdd55c9b42fa7c400 Mon Sep 17 00:00:00 2001 From: Dendy Date: Sun, 7 Feb 2021 10:20:41 +0100 Subject: [PATCH] Reorganize and make compilable --- Makefile | 28 +++++++++++++++++++++++++++ examples/nodetree/Makefile | 19 ++++++++++++++++++ {testbed => examples/nodetree}/main.c | 4 ++-- {node => include}/node.h | 0 {node2d => include}/node2d.h | 4 ++-- types.h => include/types.h | 0 {node => src}/node.c | 0 {node2d => src}/node2d.c | 0 testbed/Makefile | 17 ---------------- 9 files changed, 51 insertions(+), 21 deletions(-) create mode 100644 Makefile create mode 100644 examples/nodetree/Makefile rename {testbed => examples/nodetree}/main.c (98%) rename {node => include}/node.h (100%) rename {node2d => include}/node2d.h (86%) rename types.h => include/types.h (100%) rename {node => src}/node.c (100%) rename {node2d => src}/node2d.c (100%) delete mode 100644 testbed/Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..a6ed1d8 --- /dev/null +++ b/Makefile @@ -0,0 +1,28 @@ +## +# Nodesystem +# +# @file +# @version 0.1 + +CC="tcc" +DIR=build +SRC=src + +OBJ_FLAGS=-c -Wall -Werror -I include/ + +all: $(DIR)/node.o $(DIR)/node2d.o + $(CC) -shared -o libnodesystem.so $^ + +build/node.o: $(SRC)/node.c $(DIR) + $(CC) $(OBJ_FLAGS) $(SRC)/node.c -o $@ +build/node2d.o: $(SRC)/node2d.c $(DIR) + $(CC) $(OBJ_FLAGS) $(SRC)/node2d.c -o $@ + +$(DIR): + mkdir $(DIR) + +clean: + rm -rf build + rm -f libnode.so + +# end diff --git a/examples/nodetree/Makefile b/examples/nodetree/Makefile new file mode 100644 index 0000000..c60dd16 --- /dev/null +++ b/examples/nodetree/Makefile @@ -0,0 +1,19 @@ +## +# Nodesystem +# +# @file +# @version 0.1 + +CC="tcc" +SRC=main.c + +main: $(SRC) + tcc -o $@ -I ../include $(SRC) -lnodesystem -L/strg/prgm/c/nodesystem + +run: main + LD_LIBRARY_PATH=..:$LD_LIBRARY_PATH ./main + +clean: + rm -rf main + +# end diff --git a/testbed/main.c b/examples/nodetree/main.c similarity index 98% rename from testbed/main.c rename to examples/nodetree/main.c index cae67b4..ad1f97d 100644 --- a/testbed/main.c +++ b/examples/nodetree/main.c @@ -1,7 +1,7 @@ #include -#include "node/node.h" -#include "node2d/node2d.h" +#include "node.h" +#include "node2d.h" int main(int argc, char* *argv){ NOD_Node *distros = NOD_CreateNode("Distros"); diff --git a/node/node.h b/include/node.h similarity index 100% rename from node/node.h rename to include/node.h diff --git a/node2d/node2d.h b/include/node2d.h similarity index 86% rename from node2d/node2d.h rename to include/node2d.h index bbbe3b2..c983bb7 100644 --- a/node2d/node2d.h +++ b/include/node2d.h @@ -1,5 +1,5 @@ -#include"../node/node.h" -#include"../types.h" +#include"node.h" +#include"types.h" #include #include diff --git a/types.h b/include/types.h similarity index 100% rename from types.h rename to include/types.h diff --git a/node/node.c b/src/node.c similarity index 100% rename from node/node.c rename to src/node.c diff --git a/node2d/node2d.c b/src/node2d.c similarity index 100% rename from node2d/node2d.c rename to src/node2d.c diff --git a/testbed/Makefile b/testbed/Makefile deleted file mode 100644 index 9d712dc..0000000 --- a/testbed/Makefile +++ /dev/null @@ -1,17 +0,0 @@ -## -# Nodesystem -# -# @file -# @version 0.1 - -CC="tcc" - -SRC=main.c ../node/node.c ../node2d/node2d.c - -main: $(SRC) - tcc -o $@ -I ../ $(SRC) - -clean: - rm -rf main - -# end