I hate the way functions are defined in posix sh

This commit is contained in:
Sasha Koshka 2024-01-18 02:28:43 +00:00
parent 2aff2ff45a
commit b1f13bdcac
2 changed files with 8 additions and 5 deletions

View File

@ -5,23 +5,26 @@ BUILDFLAGS="$CFLAGS -Iinclude"
LINTCHECKS="-checks=-*,clang-analyzer-*,bugprone-*,portability-*,cert-*" LINTCHECKS="-checks=-*,clang-analyzer-*,bugprone-*,portability-*,cert-*"
SOURCE="src/*.c" SOURCE="src/*.c"
function build() { build() {
mkdir -p lib
cc $SOURCE -o "lib/libXmd.so" -shared $BUILDFLAGS || \ cc $SOURCE -o "lib/libXmd.so" -shared $BUILDFLAGS || \
echo "XXX FAIL!" echo "XXX FAIL!"
} }
function lint() { lint() {
clang-tidy $SOURCE $LINTCHECKS -- $BUILDFLAGS || \ clang-tidy $SOURCE $LINTCHECKS -- $BUILDFLAGS || \
echo "XXX FAIL!" echo "XXX FAIL!"
} }
function clean() { clean() {
rm -f lib/* rm -f lib/*
} }
case "$1" in case "$1" in
install) install)
clean; build clean; build
mkdir -p "$PREFIX/lib"
mkdir -p "$PREFIX/include/Xmd"
cp lib/*.so "$PREFIX/lib" cp lib/*.so "$PREFIX/lib"
cp include/Xmd/*.h "$PREFIX/include/Xmd" cp include/Xmd/*.h "$PREFIX/include/Xmd"
clean clean

View File

@ -2,7 +2,7 @@
. `dirname $0`/flags.sh . `dirname $0`/flags.sh
function build() { build() {
if if
mkdir -p lib && \ mkdir -p lib && \
cc src/*.c -o "lib/$1.so" -shared $CFLAGS cc src/*.c -o "lib/$1.so" -shared $CFLAGS
@ -15,7 +15,7 @@ function build() {
fi fi
} }
function clean() { clean() {
rm -f bin/* rm -f bin/*
} }