From 975a4d65e287087404fe7fa4a03bdbe5de4969bc Mon Sep 17 00:00:00 2001 From: ame Date: Mon, 16 Jun 2025 16:21:46 -0500 Subject: added install target --- makefile | 16 +++++++++++++--- readme.md | 4 +++- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/makefile b/makefile index 30a261a..2f65509 100644 --- a/makefile +++ b/makefile @@ -1,14 +1,20 @@ CC := clang -GIT_COMMIT := "$(shell git describe --tags)-$(shell git describe --always --match 'NOT A TAG')" +GIT_COMMIT := "$(shell git -c safe.directory='*' describe --tags)-$(shell git -c safe.directory='*' describe --always --match 'NOT A TAG')" -version ?= lua5.4 +version ?= 5.4 +install_version = $(version) -CFLAGS := -fPIC -DGIT_COMMIT='$(GIT_COMMIT)' `pkg-config --cflags $(version)` +ifeq ($(version),jit) + install_version = 5.1 +endif + +CFLAGS := -fPIC -DGIT_COMMIT='$(GIT_COMMIT)' `pkg-config --cflags lua$(version)` LFLAGS := -lm -shared -lcrypto -lssl LINKER := $(CC) TARGET := lullaby.so +INSTALL_DIR := /usr/lib64/lua/ SRCS := $(wildcard src/*.c) $(wildcard src/*/*.c) OBJS := $(SRCS:.c=.o) @@ -26,6 +32,10 @@ all: $(TARGET) release: CFLAGS += -O3 release: all +install:: + mkdir $(INSTALL_DIR)$(install_version) -p + cp $(TARGET) $(INSTALL_DIR)$(install_version)/$(TARGET) + # ok so im pretty sure asan should be linked too, however dlclose needs to be masked anyways # and since libasan needs to be the first thing to load, you'll have to add it anyways # run with something like 'LD_PRELOAD="/usr/lib/gcc/x86_64-pc-linux-gnu/14/libasan.so ./fakedlclose.so" lua5.4 ...' diff --git a/readme.md b/readme.md index 554a14d..65791b7 100644 --- a/readme.md +++ b/readme.md @@ -41,7 +41,9 @@ build with `make`, output is `./lullaby.so` or (win)`./lullaby.dll` windows works through msys2, install `mingw-w64-x86_64-lua` then run `make CC=gcc` -lua version can be specified with `version=...`, similar to lua5.1, lua5.3, luajit, the default it lua5.4 +you can install with `doas make install` which will install lullaby.so into /usr/lib64/lua/5.X/ + +lua version can be specified with `version=...`, similar to 5.1, 5.3, jit, the default it 5.4 for working on the code base, i recommend using bear to generate compile_commands.json [(as outlined here)](https://clangd.llvm.org/installation#compile_commandsjson) which should probably let your ide find the headers -- cgit v1.2.3