tls

tls.git
git clone git://git.lenczewski.org/tls.git
Log | Files | Refs

build.sh (711B)


      1 #!/bin/sh
      2 
      3 set -ex
      4 
      5 CC="${CC:-clang}"
      6 AS="${AS:-clang}"
      7 AR="${AR:-llvm-ar}"
      8 RANLIB="${RANLIBL:-llvm-ranlib}"
      9 
     10 TARGET="${TARGET:-$($CC -dumpmachine)}"
     11 ARCH="${TARGET%%-*}"
     12 
     13 CFLAGS="-std=c11 -O0 -g3 -Wall -Wextra -Wno-unused-parameter -Wno-format"
     14 ASFLAGS="-g3"
     15 
     16 mkdir -p bin obj
     17 
     18 # build tls library
     19 $CC -o obj/tls_common.o -c tls_common.c $CFLAGS
     20 $AS -o obj/tls_native.o -c tls_$ARCH.S $ASFLAGS
     21 $AR rcs bin/libtls.a obj/tls_common.o obj/tls_native.o
     22 $RANLIB bin/libtls.a
     23 
     24 # build tls tests
     25 for src in test/*.c; do
     26 	$CC -o bin/$(basename -s .c $src) $src bin/libtls.a $CFLAGS -I. -D_GNU_SOURCE=1
     27 done
     28 
     29 # build example program
     30 $CC -o bin/tls_client tls_client.c $CFLAGS
     31 $CC -o bin/tls_server tls_server.c $CFLAGS