acr-cli: init at 0.14 (#359508)
[NixPkgs.git] / pkgs / by-name / bl / blackmagic / helper.sh
blob77f84ef890d41e2b4e90c3d2d3b25492f196ac70
1 ################################################################################
2 # Build all of the platforms manually since the `all_platforms' target
3 # doesn't preserve all of the build outputs and overrides CFLAGS.
4 set -e
5 set -u
7 ################################################################################
8 # Prevent a warning from shellcheck:
9 out=${out:-/tmp}
11 ################################################################################
12 export MAKEFLAGS="\
13 ${enableParallelBuilding:+-j${NIX_BUILD_CORES}}"
15 ################################################################################
16 PRODUCTS="blackmagic.bin blackmagic.hex blackmagic_dfu.bin blackmagic_dfu.hex"
18 ################################################################################
19 make_platform() {
20 echo "Building for hardware platform $1"
22 make clean
23 make PROBE_HOST="$1"
25 if [ "$1" = "hosted" ]; then
26 install -m 0555 blackmagic "$out/bin"
29 for f in $PRODUCTS; do
30 if [ -r "$f" ]; then
31 mkdir -p "$out/firmware/$1"
32 install -m 0444 "$f" "$out/firmware/$1"
34 done
38 ################################################################################
39 # Start by building libopencm3:
40 make -C libopencm3
42 ################################################################################
43 # And now all of the platforms:
44 cd src
46 mkdir -p "$out/bin"
48 for platform in platforms/*/Makefile.inc; do
49 probe=$(basename "$(dirname "$platform")")
50 make_platform "$probe"
51 done