-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·26 lines (20 loc) · 883 Bytes
/
build.sh
File metadata and controls
executable file
·26 lines (20 loc) · 883 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/bin/sh
# XXX(Unavailable): I can't be bothered to create a Makefile.
CC=clang
CFLAGS='-Wall -Wextra -ggdb -Isrc -Ithirdparty'
LFLAGS=''
SRCS='src/owsc.c src/crypto.c thirdparty/mongoose/mongoose.c'
# XXX(Unavailable): CFLAGS='... -DMG_TLS=MG_TLS_OPENSSL'
# XXX(Unavailable): LFLAGS=$(pkg-config --libs openssl)
[ "$1" = 'clean' ] && rm -rf build && exit
mkdir -p build
echo "*" >build/.gitignore
# shellcheck disable=2086
Build() { $CC $CFLAGS $SRCS $LFLAGS "$@"; }
case "$1" in
'') Build -c && mv *.o build && (cd build && ar rcs libowsc.a *.o) &&
Build -shared -fPIC -o build/libowsc.so ;;
'run') Build "examples/$2.c" -o "build/$2" && "build/$2" ;;
'test') Build "tests/$2.c" -o "build/$2-tests" && "build/$2-tests" ;;
*) echo "unknown command: $2" && exit 1 ;;
esac