chore(build): add static library output and privilege-safe install
- debug and release targets now produce both shared and static libs - obj dirs split into shared/ and static/ to keep fPIC objects isolated - install no longer depends on release, guards with existence check instead - build.sh handles privilege escalation for install/uninstall via doas or sudo, falling back gracefully if already root - uninstall cleans up static lib alongside shared
This commit is contained in:
@@ -8,4 +8,32 @@ else
|
||||
MK_FILE="bmake.mk"
|
||||
fi
|
||||
|
||||
make -f "$MK_FILE" "$@"
|
||||
HAS_INSTALL=0
|
||||
HAS_UNINSTALL=0
|
||||
for arg in "$@"; do
|
||||
case "$arg" in
|
||||
install) HAS_INSTALL=1 ;;
|
||||
uninstall) HAS_UNINSTALL=1 ;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ "$HAS_INSTALL" = "1" ] || [ "$HAS_UNINSTALL" = "1" ]; then
|
||||
if [ "$HAS_INSTALL" = "1" ]; then
|
||||
make -f "$MK_FILE" release
|
||||
fi
|
||||
|
||||
if [ "$(id -u)" = "0" ]; then
|
||||
PRIV=""
|
||||
elif command -v doas > /dev/null 2>&1; then
|
||||
PRIV="doas"
|
||||
elif command -v sudo > /dev/null 2>&1; then
|
||||
PRIV="sudo"
|
||||
else
|
||||
echo "error: install requires root. neither doas nor sudo found." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
$PRIV make -f "$MK_FILE" "$@"
|
||||
else
|
||||
make -f "$MK_FILE" "$@"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user