switch to actual library structure

This commit is contained in:
sam 2024-05-05 02:19:59 +12:00
parent 6a1166bd2e
commit cd8e58bd3f
14 changed files with 32 additions and 12 deletions

3
.gitignore vendored
View file

@ -1,2 +1,3 @@
gearlib
libgearlib.a
obj/
test/*.exe

View file

@ -1,14 +1,15 @@
BINARY=gearlib
LIBRARY=libgearlib.a
CC=gcc
CC:=tcc
AR=$(CC) -ar
CFLAGS=-O3 -Iinclude -g
LDFLAGS=-lglfw -lm
CFILES=$(shell cd src && find -L * -type f -name '*.c')
OBJ=$(addprefix obj/, $(CFILES:.c=.o))
$(BINARY): objdir $(OBJ) Makefile
$(CC) $(OBJ) $(LDFLAGS) -o $@
$(LIBRARY): objdir $(OBJ) Makefile
$(CC) -ar rcs $(LIBRARY) $(OBJ)
obj/%.o: src/%.c
$(CC) $(CFLAGS) -c $< -o $@
@ -16,12 +17,10 @@ obj/%.o: src/%.c
objdir:
mkdir -p obj
run: $(BINARY)
./$(BINARY)
debug: $(BINARY)
gdb $(BINARY)
run: $(LIBRARY)
make -C test main
cd test && ./main
clean:
rm -rf $(OBJ) $(BINARY)
rm -rf $(OBJ) $(LIBRARY)
make -C test clean

Binary file not shown.

View file

@ -1,6 +1,10 @@
#define SL_IMPLEMENTATION
#include <slibs.h>
#define STBI_NO_SIMD
#define STBI_FAILURE_USERMSG
#define STB_IMAGE_IMPLEMENTATION
#include <stb_image.h>
#define RAYMATH_IMPLEMENTATION
#include <raymath.h>

16
test/Makefile Normal file
View file

@ -0,0 +1,16 @@
CC=tcc
CFLAGS=-O3 -I../include
LDFLAGS=-lglfw -L ../ -lgearlib -lm
CFILES=$(shell find -L * -type f -name '*.c')
BINARIES=$(CFILES:.c=)
all: $(BINARIES)
%: %.c
$(CC) $< -o $@ $(CFLAGS) $(LDFLAGS)
clean:
rm -rf $(BINARIES)

View file

Before

Width:  |  Height:  |  Size: 123 KiB

After

Width:  |  Height:  |  Size: 123 KiB

View file

Before

Width:  |  Height:  |  Size: 209 KiB

After

Width:  |  Height:  |  Size: 209 KiB

View file

Before

Width:  |  Height:  |  Size: 288 KiB

After

Width:  |  Height:  |  Size: 288 KiB

BIN
test/main Executable file

Binary file not shown.