From 31bfaff9ddd20346cc878bee5f891e4f0da64b16 Mon Sep 17 00:00:00 2001 From: dzaima Date: Sun, 29 Oct 2023 21:34:59 +0200 Subject: [PATCH] make static-lib, do more things in make install/uninstall --- README.md | 1 + makefile | 19 +++++++++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 7d32423b..a9c0143d 100644 --- a/README.md +++ b/README.md @@ -70,6 +70,7 @@ Alternatively, `build/build` (aka build.bqn) can be invoked manually, though not - `make wasi-reactor-o3` - build producing a WASI Reactor - `make debug` - unoptimized build with extra assertion checks (also includes `-g`) - `make static-bin` - build a statically linked executable (for a fully standalone binary, try `make static-bin CC=musl-gcc REPLXX=0`) +- `make static-lib` - build a static library archive All of the above will go through build.bqn. If that causes problems, `make o3-makeonly` or `make c-makeonly` can be used. These still enable REPLXX by default, but do not support Singeli. Furthermore, these targets don't support some of the build flags that the others do. diff --git a/makefile b/makefile index 78b654b5..74a67e8d 100644 --- a/makefile +++ b/makefile @@ -80,6 +80,8 @@ shared-o3: @"${MAKE}" to-bqn-build REPLXX=0 i_SHARED=1 shared-c: @"${MAKE}" to-bqn-build REPLXX=0 i_SHARED=1 i_build_opts=c +static-lib: + @"${MAKE}" to-bqn-build REPLXX=0 i_build_opts="static-lib" static-bin: @"${MAKE}" to-bqn-build FFI=0 i_build_opts="static-bin" @@ -344,14 +346,27 @@ endif # replxx # dependency files -include $(bd)/*.d - DESTDIR = PREFIX = /usr/local -install: uninstall +install: + rm -f "$(DESTDIR)$(PREFIX)/bin/bqn" cp -f BQN "$(DESTDIR)$(PREFIX)/bin/bqn" + + cp -f include/bqnffi.h "$(DESTDIR)$(PREFIX)/include/bqnffi.h" + + @if [ -f libcbqn.so ]; then \ + rm -f "$(DESTDIR)$(PREFIX)/lib/libcbqn.so"; \ + cp -f libcbqn.so "$(DESTDIR)$(PREFIX)/lib/libcbqn.so"; \ + echo 'cp -f libcbqn.so "$(DESTDIR)$(PREFIX)/lib/libcbqn.so"'; \ + else \ + echo "Not installing libcbqn.so as it wasn't built"; \ + fi + uninstall: rm -f "$(DESTDIR)$(PREFIX)/bin/bqn" + rm -f "$(DESTDIR)$(PREFIX)/include/bqnffi.h" + rm -f "$(DESTDIR)$(PREFIX)/lib/libcbqn.so" clean-build: rm -f build/obj/*/*.o