Generic lib.mk makefile for building libraries
All checks were successful
Build documentation / build-and-deploy (push) Successful in 1m32s

This commit is contained in:
2026-02-13 16:34:02 +01:00
parent 72230e696f
commit ea6f13397e
7 changed files with 58 additions and 150 deletions

33
make/lib.mk Normal file
View File

@@ -0,0 +1,33 @@
cc := clang
o :=
c :=
cflags += -isystem .
buildtype ?= release
include src.mk
include ../generic/flags.mk
include ../$(platform)/flags.mk
all: build/$(libname).a
build/$(libname).a: $(o)
llvm-ar rcs $@ $^
%.o: %.c
$(cc) -c -o $@ $(cflags) $<
%.o: %.S
$(cc) -c -o $@ $(cflags) $<
clean:
rm -f $(o) build/$(libname).a
format:
clang-format -i $$(git ls-files '*.c' '*.h')
docs:
clang-doc --format=md --output docs -p . $$(git ls-files '*.h')
mkdir -p ../docs/libs/$(libname)
cp ./docs/GlobalNamespace/*.md ../docs/libs/$(libname)
.PHONY: all clean format

View File

@@ -2,3 +2,7 @@ define add_lib
ldflags += -L ../$(1)/build -l:$(1).a
cflags += -isystem ../$(1)
endef
define add_include
cflags += -isystem ../$(1)
endef