Make installable

This commit is contained in:
Dendy 2021-02-07 10:59:00 +01:00
parent fb296822ec
commit 24179b12ca
Signed by: dendy
GPG Key ID: 0168B35FFD7F608F
4 changed files with 28 additions and 16 deletions

View File

@ -7,17 +7,29 @@
CC="tcc" CC="tcc"
DIR=build DIR=build
SRC=src SRC=src
OUT=libnodesystem.so
OBJ_FLAGS=-c -Wall -Werror -I include/ OBJ_FLAGS=-c -Wall -Werror -I include/
all: $(DIR)/node.o $(DIR)/node2d.o all: $(DIR)/node.o $(DIR)/node2d.o
$(CC) -shared -o libnodesystem.so $^ $(CC) -shared -o $(OUT) $^
build/node.o: $(SRC)/node.c $(DIR) build/node.o: $(SRC)/node.c $(DIR)
$(CC) $(OBJ_FLAGS) $(SRC)/node.c -o $@ $(CC) $(OBJ_FLAGS) $(SRC)/node.c -o $@
build/node2d.o: $(SRC)/node2d.c $(DIR) build/node2d.o: $(SRC)/node2d.c $(DIR)
$(CC) $(OBJ_FLAGS) $(SRC)/node2d.c -o $@ $(CC) $(OBJ_FLAGS) $(SRC)/node2d.c -o $@
install:
cp $(OUT) /usr/lib/
chmod 0755 /usr/lib/$(OUT)
ldconfig
[ -d /usr/include/NODESYS ] || mkdir /usr/include/NODESYS
cp -r include/* /usr/include/NODESYS
remove:
rm -f /usr/lib/$(OUT)
rm -rf /usr/include/NODESYS
$(DIR): $(DIR):
mkdir $(DIR) mkdir $(DIR)

View File

@ -1,8 +1,15 @@
# NodeSystem # NodeSystem
Just a library for handling node logic inside C, inspired by Godot, mainly focused for the creation of games. Just a library for handling node logic inside C, inspired
by Godot, mainly focused for the creation of games.
For now there's a basic Node struct and a Node2D that "inherits" from it. For now there's a basic Node struct and a Node2D that
"inherits" from it.
To compile and run the examples just do "make run" on their folders To compile run "make" and to compile and install run
"make install" as superuser. You can uninstall by running
"make remove"
To compile and run the examples you have to have the library
installed. To compile and run them just do "make run" on
their folders.

View File

@ -7,18 +7,11 @@
CC="tcc" CC="tcc"
SRC=main.c SRC=main.c
main: $(SRC) ../../libnodesystem.so main: $(SRC)
tcc -o $@ -I ../../include $(SRC) -lnodesystem -L../../ tcc -o $@ $(SRC) -lnodesystem
run: main run: main
LD_LIBRARY_PATH=../..:$LD_LIBRARY_PATH ./main ./main
full: $(SRC)
make -C ../../
tcc -o main -I ../../include $(SRC) -lnodesystem -L../../
../../libnodesystem.so:
make -C ../../
clean: clean:
rm -rf main rm -rf main

View File

@ -1,7 +1,7 @@
#include<stdio.h> #include<stdio.h>
#include "node.h" #include "NODESYS/node.h"
#include "node2d.h" #include "NODESYS/node2d.h"
int main(int argc, char* *argv){ int main(int argc, char* *argv){
NOD_Node *distros = NOD_CreateNode("Distros"); NOD_Node *distros = NOD_CreateNode("Distros");