blob: 6920212df6546336c7edf28aa38d1d4595ab0176 (
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
#!/bin/sh
# Copyright © Tavian Barnes <tavianator@tavianator.com>
# SPDX-License-Identifier: 0BSD
# bfs build configuration script
set -eu
help() {
cat <<EOF
Usage: $0 [-j<N>] [CC=...] [CFLAGS=...] [...]
Compiler configuration:
CC
The C compiler to use
CPPFLAGS
C preprocessor flags
CFLAGS
C compiler flags
LDFLAGS
Linker flags
LDLIBS
Dynamic libraries to link
EXTRA_CPPFLAGS
EXTRA_CFLAGS
EXTRA_LDFLAGS
EXTRA_LDLIBS
Adds to the default flags, instead of replacing them
Build profiles:
RELEASE=y
Enable optimizations, disable assertions
ASAN=y
LSAN=y
MSAN=y
TSAN=y
UBSAN=y
Enable sanitizers
GCOV=y
Enable code coverage instrumentation
External dependencies:
PKG_CONFIG
The pkg-config binary to use
USE_LIBACL=[y|n]
USE_LIBCAP=[y|n]
USE_LIBSELINUX=[y|n]
USE_LIBURIG=[y|n]
USE_ONIGURUMA=[y|n]
Enable or disable external dependencies
Packaging configuration:
PREFIX
Set the installation prefix (default: /usr)
MANDIR
Set the man page directory (default: \$PREFIX/share/man)
EOF
}
for arg; do
case "$arg" in
--help)
help
exit 0
;;
-*|*=*)
continue # make flag (-j2) or variable (CC=clang)
;;
*)
printf 'error: Unrecognized option "%s"\n\n' "$arg" >&2
help >&2
exit 1
;;
esac
done
# Get the relative path to the source tree based on how the script was run
DIR=$(dirname -- "$0")
# Set up symbolic links for out-of-tree builds
for f in Makefile build completions docs src tests; do
test -e "$f" || ln -s "$DIR/$f" "$f"
done
# Infer -jN unless MAKEFLAGS is set
j=
if ! [ "${MAKEFLAGS+y}" ]; then
j="-j$({ nproc || sysctl -n hw.ncpu || getconf _NPROCESSORS_ONLN || echo 1; } 2>/dev/null)"
fi
${MAKE:-make} $j -rsf build/config.mk "$@"
|