Build pakrd as shared object instead of static

This commit is contained in:
Abdelrahman Said 2023-11-05 00:19:22 +00:00
parent 2f3d8106ea
commit fb1d1697f1
2 changed files with 7 additions and 9 deletions

2
.gitignore vendored
View File

@ -1,5 +1,5 @@
.cache .cache
compile_commands.json compile_commands.json
pckr pckr
libpakrd.a libpakrd.so
dist dist

14
compile
View File

@ -21,7 +21,6 @@ FG_BR_CYAN="\033[96"
FG_BR_WHITE="\033[97" FG_BR_WHITE="\033[97"
CC=gcc CC=gcc
AR=ar
CFLAGS="-Wall -Werror -pedantic -Iinclude -Iintern/c-cpp-aliases -Iintern/cpath/include " CFLAGS="-Wall -Werror -pedantic -Iinclude -Iintern/c-cpp-aliases -Iintern/cpath/include "
PCKR_SRC="\ PCKR_SRC="\
@ -38,7 +37,7 @@ PAKRD_SRC="\
src/io.c \ src/io.c \
src/darr.c \ src/darr.c \
src/pak.c" src/pak.c"
PAKRD_FLAGS="-c -fPIC" PAKRD_FLAGS="-fPIC -rdynamic -shared "
PCKR_TEST_SRC="\ PCKR_TEST_SRC="\
intern/cpath/src/cpath.c \ intern/cpath/src/cpath.c \
@ -74,13 +73,13 @@ done
if [[ $BUILD_TYPE == "debug" ]]; then if [[ $BUILD_TYPE == "debug" ]]; then
CFLAGS+="-g " CFLAGS+="-g "
PCKR_OUT="pckr" PCKR_OUT="pckr"
PAKRD_OUT="libpakrd.a" PAKRD_OUT="libpakrd.so"
else else
mkdir -p dist mkdir -p dist
cp ./include/pak.h dist cp ./include/pak.h dist
CFLAGS+="-O3 -g " CFLAGS+="-O3 "
PCKR_OUT="dist/pckr" PCKR_OUT="dist/pckr"
PAKRD_OUT="dist/libpakrd.a" PAKRD_OUT="dist/libpakrd.so"
fi fi
@ -88,9 +87,8 @@ fi
(set -x ; $CC $CFLAGS $PCKR_SRC -o $PCKR_OUT) (set -x ; $CC $CFLAGS $PCKR_SRC -o $PCKR_OUT)
# Build pakrd static library # Build pakrd shared library
(set -x ; $CC $CFLAGS $PAKRD_FLAGS $PAKRD_SRC ; $AR r $PAKRD_OUT *.o) (set -x ; $CC $CFLAGS $PAKRD_FLAGS $PAKRD_SRC -o $PAKRD_OUT)
rm *.o
# Build pckr_test executable # Build pckr_test executable