aboutsummaryrefslogtreecommitdiff
path: root/build.sh
blob: 423bf575160dcf00aa56d9a18aa33d22c8817833 (plain)
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
27
28
29
30
31
32
33
34
35
#!/bin/sh

cd ${0%/*} # go to project root

FLAGS="-g -Wall -Wextra -pedantic -lpthread -std=c99"
FGLFW="-lGL -lglfw"
FV4L2="-lv4l2"
FPASM="-lpulse -lpulse-simple"
SRC="src"
OBJ="obj"
BIN="bin"

function __clean__ {
    rm -rf $BIN
    rm -rf $OBJ
    kill $( ps -q $$ -o pgid= ) # exit
}

set -xe

if ! { [[ $# -eq 0 ]]; } 2> /dev/null
then
    __$1__
fi

mkdir -p $BIN
mkdir -p $OBJ

gcc -o $OBJ/socket.o  -c $SRC/socket.c
gcc -o $OBJ/display.o -c $SRC/display.c
gcc -o $OBJ/camera.o  -c $SRC/camera.c
gcc -o $OBJ/audio.o   -c $SRC/audio.c

gcc -o $BIN/listener     $SRC/listener.c $OBJ/socket.o $OBJ/display.o $OBJ/audio.o $FLAGS $FPASM $FGLFW
gcc -o $BIN/talker       $SRC/talker.c   $OBJ/socket.o $OBJ/camera.o  $OBJ/audio.o $FLAGS $FPASM $FV4L2