Compile pakrd static library

This commit is contained in:
Abdelrahman Said 2023-11-02 00:13:00 +00:00
parent c5c447d5c5
commit c04e8bd4a3

19
compile
View File

@ -21,6 +21,7 @@ FG_BR_CYAN="\033[96"
FG_BR_WHITE="\033[97"
CC=clang
AR=ar
CFLAGS="-Wall -Werror -pedantic -Iinclude "
PCKR_SRC="\
@ -32,6 +33,13 @@ PCKR_SRC="\
src/pckr.c \
src/main.c"
PAKRD_SRC="\
src/path_utils.c \
src/io.c \
src/darr.c \
src/pak.c"
PAKRD_FLAGS="-c -fPIC"
PCKR_TEST_SRC="\
src/path_utils.c \
src/io.c \
@ -66,9 +74,13 @@ done
if [[ $BUILD_TYPE == "debug" ]]; then
CFLAGS+="-g "
PCKR_OUT="pckr"
PAKRD_OUT="pakrd.a"
else
mkdir dist
cp ./include/pak.h dist
CFLAGS+="-O3 "
PCKR_OUT="../proj/pckr"
PCKR_OUT="dist/pckr"
PAKRD_OUT="dist/pakrd.a"
fi
@ -76,6 +88,11 @@ 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 pckr_test executable
(set -x ; $CC $CFLAGS $PCKR_TEST_SRC -o $PCKR_TEST_OUT)