add library compilation to makefile

This commit is contained in:
2025-08-11 12:20:59 +02:00
parent 7c0bd34301
commit 114ee2b31b

View File

@@ -11,9 +11,7 @@ LD ?= ld
# compilation flags # compilation flags
CFLAGS = -c -std=gnu99 -Wall -Wextra -Wpedantic -MMD -MP CFLAGS = -c -std=gnu99 -Wall -Wextra -Wpedantic -MMD -MP
CFLAGS += -Ilib/glad/include -Ilib/glfw/include -Ilib/libarchive/include LDFLAGS = -flto
LDFLAGS = -flto -lm
LDFLAGS += lib/glfw/src/libglfw3.a
# architecture/OS detection # architecture/OS detection
ifeq ($(KERNEL),) ifeq ($(KERNEL),)
@@ -49,8 +47,11 @@ PROF = rel
CFLAGS += -DNDEBUG -O2 CFLAGS += -DNDEBUG -O2
endif endif
CFLAGS += -Ilib/glad/include -Ilib/glfw/include -Ilib/libarchive/include
LDFLAGS += -lc -lm lib/glad/gl.o lib/glfw/src/libglfw3.a
# get source files # get source files
SRC := $(wildcard src/**/*.c) SRC := $(wildcard src/*.c) $(wildcard src/**/*.c)
RES := $(wildcard res/*.glsl) RES := $(wildcard res/*.glsl)
ifeq ($(DEBUG),test) ifeq ($(DEBUG),test)
SRC := $(filter-out src/main.c, $(SRC)) $(wildcard test/**/*.c) SRC := $(filter-out src/main.c, $(SRC)) $(wildcard test/**/*.c)
@@ -74,6 +75,8 @@ compile: $(BIN)
.PHONY: .PHONY:
libs: libs:
@cd lib/glfw && cmake . && $(MAKE)
@cd lib/glad && $(CC) -c -Iinclude src/gl.c
.PHONY .NOTPARALLEL: .PHONY .NOTPARALLEL:
clean: clean: