Make installable
This commit is contained in:
		
							parent
							
								
									fb296822ec
								
							
						
					
					
						commit
						24179b12ca
					
				
							
								
								
									
										14
									
								
								Makefile
								
								
								
								
							
							
						
						
									
										14
									
								
								Makefile
								
								
								
								
							| 
						 | 
				
			
			@ -7,17 +7,29 @@
 | 
			
		|||
CC="tcc"
 | 
			
		||||
DIR=build
 | 
			
		||||
SRC=src
 | 
			
		||||
OUT=libnodesystem.so
 | 
			
		||||
 | 
			
		||||
OBJ_FLAGS=-c -Wall -Werror -I include/
 | 
			
		||||
 | 
			
		||||
all: $(DIR)/node.o $(DIR)/node2d.o
 | 
			
		||||
	$(CC) -shared -o libnodesystem.so $^
 | 
			
		||||
	$(CC) -shared -o $(OUT) $^
 | 
			
		||||
 | 
			
		||||
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 $@
 | 
			
		||||
 | 
			
		||||
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):
 | 
			
		||||
	mkdir $(DIR)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										13
									
								
								README.md
								
								
								
								
							
							
						
						
									
										13
									
								
								README.md
								
								
								
								
							| 
						 | 
				
			
			@ -1,8 +1,15 @@
 | 
			
		|||
# 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.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -7,18 +7,11 @@
 | 
			
		|||
CC="tcc"
 | 
			
		||||
SRC=main.c
 | 
			
		||||
 | 
			
		||||
main: $(SRC) ../../libnodesystem.so
 | 
			
		||||
	tcc -o $@ -I ../../include $(SRC) -lnodesystem -L../../
 | 
			
		||||
main: $(SRC)
 | 
			
		||||
	tcc -o $@ $(SRC) -lnodesystem
 | 
			
		||||
 | 
			
		||||
run: main
 | 
			
		||||
	LD_LIBRARY_PATH=../..:$LD_LIBRARY_PATH ./main
 | 
			
		||||
 | 
			
		||||
full: $(SRC)
 | 
			
		||||
	make -C ../../
 | 
			
		||||
	tcc -o main -I ../../include $(SRC) -lnodesystem -L../../
 | 
			
		||||
 | 
			
		||||
../../libnodesystem.so:
 | 
			
		||||
	make -C ../../
 | 
			
		||||
	./main
 | 
			
		||||
 | 
			
		||||
clean:
 | 
			
		||||
	rm -rf main
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,7 +1,7 @@
 | 
			
		|||
#include<stdio.h>
 | 
			
		||||
 | 
			
		||||
#include "node.h"
 | 
			
		||||
#include "node2d.h"
 | 
			
		||||
#include "NODESYS/node.h"
 | 
			
		||||
#include "NODESYS/node2d.h"
 | 
			
		||||
 | 
			
		||||
int main(int argc, char* *argv){
 | 
			
		||||
    NOD_Node *distros = NOD_CreateNode("Distros");
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue