1
0
mirror of https://github.com/MarlinFirmware/Marlin.git synced 2024-12-04 18:07:38 +00:00
MarlinFirmware/buildroot/bin/build_example
2023-06-05 20:39:20 -05:00

42 lines
1.1 KiB
Bash
Executable File

#!/usr/bin/env bash
#
# build_example
#
# Usage: build_example internal config-home config-folder
#
. mfutil
# Require 'internal' as the first argument
[[ "$1" == "internal" ]] || { echo "Don't call this script directly, use build_all_examples instead." ; exit 1 ; }
echo "Testing $3:"
SUB=$2/config/examples/$3
[[ -d "$SUB" ]] || { echo "$SUB is not a good path" ; exit 1 ; }
compgen -G "${SUB}Con*.h" > /dev/null || { echo "No configuration files found in $SUB" ; exit 1 ; }
echo "Getting configuration files from $SUB"
cp "$2/config/default"/*.h Marlin/
cp "$SUB"/Configuration.h Marlin/ 2>/dev/null
cp "$SUB"/Configuration_adv.h Marlin/ 2>/dev/null
cp "$SUB"/_Bootscreen.h Marlin/ 2>/dev/null
cp "$SUB"/_Statusscreen.h Marlin/ 2>/dev/null
set -e
# Strip #error lines from Configuration.h
IFS=$'\n'; set -f
$SED -i~ -e "20,30{/#error/d}" Marlin/Configuration.h
rm Marlin/Configuration.h~
unset IFS; set +f
# Suppress fatal warnings
echo -e "\n#define NO_CONTROLLER_CUSTOM_WIRING_WARNING" >> Marlin/Configuration.h
echo "Building the firmware now..."
$HERE/mftest -s -a -n1 || { echo "Failed"; exit 1; }
echo "Success"