~rcr/rirc

ref: 6e6e6a1d5d1227438c080cf97aa76cc69fd1d79c rirc/scripts/build.sh -rwxr-xr-x 491 bytes
6e6e6a1d — Richard Robbins fix build script linker flags 2 months ago
                                                                                
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
#!/bin/bash

# Development build script.
#
#  Usage:
#
#   $ ./scripts/build.sh [make targets]

set -e

export CC=clang
export LDFLAGS="-flto -fuse-ld=lld"
export LDFLAGS_DEBUG="-fuse-ld=lld"

if [ -x "$(command -v entr)" ]; then
	ENTR="entr -c"
fi

if [ -x "$(command -v bear)" ]; then
	BEAR="bear --append --output ./build/compile_commands.json --"
fi

make clean
make build

find -name '*.c' \
  -o -name '*.h' \
  -o -name Makefile | grep -v './lib/' | $ENTR $BEAR make -j $(nproc) "$@"