From 5e1ae8b33873661b669eda509fcd000f8a964126 Mon Sep 17 00:00:00 2001 From: kartofen Date: Thu, 26 Jan 2023 14:58:09 +0200 Subject: very simple work withs html based on file path --- build.sh | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100755 build.sh (limited to 'build.sh') diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..370c378 --- /dev/null +++ b/build.sh @@ -0,0 +1,47 @@ +#!/bin/sh + +cd ${0%/*} # go to project root + +NAME="web-server" +FLAGS="-std=c99 -Wall -Wextra -g -pedantic -D_POSIX_C_SOURCE=200112L" +SRCD="src" +ODIR="obj" +BIN="bin" +FILES="files" +RUN=0 + +function __run__ { + RUN=1 +} + +function __leak__ { + VALGRND="valgrind --leak-check=full --show-leak-kinds=all -s" + RUN=1 +} + +function __clean__ { + rm -rf $BIN + rm -rf $ODIR + exit 0 +} + +set -xe + +mkdir -p $BIN +mkdir -p $ODIR +mkdir -p $FILES + +if ! { [[ $# -eq 0 ]]; } 2> /dev/null +then + __$1__ +fi + +gcc -c $SRCD/server.c -o $ODIR/server.o $FLAGS +gcc -c $SRCD/main.c -o $ODIR/main.o $FLAGS -DFILES=\"$FILES\" + +gcc -o $BIN/$NAME $ODIR/main.o $ODIR/server.o $FLAGS + +if ! { [[ $RUN -eq 0 ]]; } 2> /dev/null +then + $VALGRND $BIN/$NAME +fi -- cgit v1.2.3