2021-02-15 11:48:11 +00:00
|
|
|
#!/usr/bin/env bash
|
2021-02-17 00:41:00 +00:00
|
|
|
#
|
|
|
|
# build_example
|
|
|
|
#
|
|
|
|
# Usage: build_example internal config-home config-folder
|
|
|
|
#
|
2021-02-15 11:48:11 +00:00
|
|
|
|
2024-01-23 05:31:04 +00:00
|
|
|
HERE=`dirname $0`
|
|
|
|
|
|
|
|
. "$HERE/mfutil"
|
2022-07-23 05:36:03 +00:00
|
|
|
|
2021-02-17 00:41:00 +00:00
|
|
|
# Require 'internal' as the first argument
|
|
|
|
[[ "$1" == "internal" ]] || { echo "Don't call this script directly, use build_all_examples instead." ; exit 1 ; }
|
2021-02-15 11:48:11 +00:00
|
|
|
|
|
|
|
echo "Testing $3:"
|
|
|
|
|
2021-02-17 00:41:00 +00:00
|
|
|
SUB=$2/config/examples/$3
|
|
|
|
[[ -d "$SUB" ]] || { echo "$SUB is not a good path" ; exit 1 ; }
|
2021-02-15 11:48:11 +00:00
|
|
|
|
2021-02-17 00:41:00 +00:00
|
|
|
compgen -G "${SUB}Con*.h" > /dev/null || { echo "No configuration files found in $SUB" ; exit 1 ; }
|
2021-02-15 11:48:11 +00:00
|
|
|
|
2021-02-17 00:41:00 +00:00
|
|
|
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
|
2021-02-15 11:48:11 +00:00
|
|
|
|
2022-07-23 00:30:29 +00:00
|
|
|
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
|
|
|
|
|
2023-06-06 01:39:14 +00:00
|
|
|
# Suppress fatal warnings
|
|
|
|
echo -e "\n#define NO_CONTROLLER_CUSTOM_WIRING_WARNING" >> Marlin/Configuration.h
|
|
|
|
|
2021-02-17 00:41:00 +00:00
|
|
|
echo "Building the firmware now..."
|
2024-01-23 05:31:04 +00:00
|
|
|
"$HERE/mftest" -s -a -n1 || { echo "Failed"; exit 1; }
|
2021-02-15 11:48:11 +00:00
|
|
|
|
|
|
|
echo "Success"
|