File: make_unix.sh

package info (click to toggle)
bam 0.5.1-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 1,508 kB
  • sloc: ansic: 21,261; python: 729; makefile: 43; sh: 35; cpp: 30
file content (31 lines) | stat: -rwxr-xr-x 927 bytes parent folder | download | duplicates (3)
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
#!/bin/sh

set -e

case "$(uname)" in
	*BSD) ccorder='clang gcc'; ldl=       ;;
	   *) ccorder='gcc clang'; ldl='-ldl' ;;
esac

# auto detection of compiler
if [ -z "$CC" ]; then
	for cctry in $ccorder; do
		if $cctry --version > /dev/null 2>&1; then
			CC=$cctry
			break;
		fi
	done

	if [ -z "$CC" ]; then
		echo "No compiler found. Specify compiler by setting the CC environment variable." >&2
		echo "Example: CC=gcc ./$0" >&2
		exit 1
	fi
fi

# the actual compile
echo "compiling using $CC..." >&2
$CC -Wall -pedantic $CFLAGS $CPPFLAGS $LDFLAGS src/tools/txt2c.c `pkg-config --cflags lua5.3` -o src/tools/txt2c
src/tools/txt2c src/base.lua src/tools.lua src/driver_gcc.lua src/driver_clang.lua src/driver_cl.lua src/driver_solstudio.lua src/driver_xlc.lua > src/internal_base.h
$CC -Wall -pedantic $CFLAGS $CPPFLAGS $LDFLAGS src/*.c src/lua/*.c -o bam `pkg-config --cflags --libs lua5.3` -lm -lpthread -ldl -rdynamic $*