diff --git a/.gitignore b/.gitignore index 30562d0..386b203 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ -compile_commands.json **/*.o +**/*.exe test/log.txt +compile_commands.json diff --git a/Makefile b/Makefile index 61515ff..6623315 100644 --- a/Makefile +++ b/Makefile @@ -1,13 +1,25 @@ -all: +.PHONY: examples + +GEARLIB_SRC=src +GEARLIB_LIB=$(GEARLIB_SRC)/libgearlib.a +GEARLIB_HEADER=$(GEARLIB_SRC)/gearlib.h + +gearlib: $(MAKE) -C src - $(MAKE) -C test clean - $(MAKE) -C test simple.o - ./test/simple.o + +examples: + $(MAKE) -C examples all + +all: gearlib examples + +install: gearlib + cp $(GEARLIB_LIB) /usr/local/lib + cp $(GEARLIB_HEADER) /usr/local/include bear: clean - bear -- $(MAKE) + bear -- $(MAKE) all clean: $(MAKE) -C src clean - $(MAKE) -C test clean + $(MAKE) -C examples clean rm -rf compile_commands.txt diff --git a/test/Makefile b/examples/Makefile similarity index 86% rename from test/Makefile rename to examples/Makefile index 28be3c2..330a1ec 100644 --- a/test/Makefile +++ b/examples/Makefile @@ -2,9 +2,9 @@ CFLAGS=-O3 -I../src LDFLAGS=-L../src -lgearlib $(shell pkg-config --libs glfw3) CFILES=$(shell find -L * -type f -name '*.c') -OBJ=$(CFILES:.c=.o) +OBJ=$(CFILES:.c=.exe) -%.o: %.c +%.exe: %.c $(CC) $(CFLAGS) $(LDFLAGS) $< -o $@ all: $(OBJ) diff --git a/examples/log.txt b/examples/log.txt new file mode 100644 index 0000000..447772f --- /dev/null +++ b/examples/log.txt @@ -0,0 +1,5 @@ +2024-08-11 16:13:19 INFO log.c:12: Added file "log.txt" as logging file +2024-08-11 16:13:19 INFO window.c:23: Window was not initialized before calling create, defaulting to OpenGL 4.6 +2024-08-11 16:13:19 INFO window.c:15: Initialized for OpenGL 4.6 +2024-08-11 16:13:19 INFO window.c:31: GLFW initialized successfully +2024-08-11 16:13:19 FATAL window.c:41: Failed to create window diff --git a/test/simple-init.c b/examples/simple-init.c similarity index 100% rename from test/simple-init.c rename to examples/simple-init.c diff --git a/test/simple-log.c b/examples/simple-log.c similarity index 100% rename from test/simple-log.c rename to examples/simple-log.c diff --git a/test/simple.c b/examples/simple.c similarity index 100% rename from test/simple.c rename to examples/simple.c diff --git a/src/libgearlib.a b/src/libgearlib.a new file mode 100644 index 0000000..971d5c7 Binary files /dev/null and b/src/libgearlib.a differ