From fb1d1697f1b4bf93ba8143daba0408b582a616e2 Mon Sep 17 00:00:00 2001 From: Abdelrahman Date: Sun, 5 Nov 2023 00:19:22 +0000 Subject: [PATCH] Build pakrd as shared object instead of static --- .gitignore | 2 +- compile | 14 ++++++-------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index f698498..8c36498 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ .cache compile_commands.json pckr -libpakrd.a +libpakrd.so dist diff --git a/compile b/compile index fb051dc..ae32635 100755 --- a/compile +++ b/compile @@ -21,7 +21,6 @@ FG_BR_CYAN="\033[96" FG_BR_WHITE="\033[97" CC=gcc -AR=ar CFLAGS="-Wall -Werror -pedantic -Iinclude -Iintern/c-cpp-aliases -Iintern/cpath/include " PCKR_SRC="\ @@ -38,7 +37,7 @@ PAKRD_SRC="\ src/io.c \ src/darr.c \ src/pak.c" -PAKRD_FLAGS="-c -fPIC" +PAKRD_FLAGS="-fPIC -rdynamic -shared " PCKR_TEST_SRC="\ intern/cpath/src/cpath.c \ @@ -74,13 +73,13 @@ done if [[ $BUILD_TYPE == "debug" ]]; then CFLAGS+="-g " PCKR_OUT="pckr" - PAKRD_OUT="libpakrd.a" + PAKRD_OUT="libpakrd.so" else mkdir -p dist cp ./include/pak.h dist - CFLAGS+="-O3 -g " + CFLAGS+="-O3 " PCKR_OUT="dist/pckr" - PAKRD_OUT="dist/libpakrd.a" + PAKRD_OUT="dist/libpakrd.so" fi @@ -88,9 +87,8 @@ fi (set -x ; $CC $CFLAGS $PCKR_SRC -o $PCKR_OUT) -# Build pakrd static library -(set -x ; $CC $CFLAGS $PAKRD_FLAGS $PAKRD_SRC ; $AR r $PAKRD_OUT *.o) -rm *.o +# Build pakrd shared library +(set -x ; $CC $CFLAGS $PAKRD_FLAGS $PAKRD_SRC -o $PAKRD_OUT) # Build pckr_test executable