Skip to content

Commit 0beaa32

Browse files
authored
Merge pull request #842 from liamcottle/feature/custom-build-flags
Build Script Improvements
2 parents 95e533d + e49eef5 commit 0beaa32

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

build.sh

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ build_firmware() {
4747
# e.g: RAK_4631_Repeater-v1.0.0-SHA
4848
FIRMWARE_FILENAME="$1-${FIRMWARE_VERSION_STRING}"
4949

50-
# export build flags for pio so we can inject firmware version info
51-
export PLATFORMIO_BUILD_FLAGS="-DFIRMWARE_BUILD_DATE='\"${FIRMWARE_BUILD_DATE}\"' -DFIRMWARE_VERSION='\"${FIRMWARE_VERSION_STRING}\"'"
50+
# add firmware version info to end of existing platformio build flags in environment vars
51+
export PLATFORMIO_BUILD_FLAGS="${PLATFORMIO_BUILD_FLAGS} -DFIRMWARE_BUILD_DATE='\"${FIRMWARE_BUILD_DATE}\"' -DFIRMWARE_VERSION='\"${FIRMWARE_VERSION_STRING}\"'"
5252

5353
# build firmware target
5454
pio run -e $1
@@ -143,8 +143,11 @@ mkdir -p out
143143

144144
# handle script args
145145
if [[ $1 == "build-firmware" ]]; then
146-
if [ "$2" ]; then
147-
build_firmware $2
146+
TARGETS=${@:2}
147+
if [ "$TARGETS" ]; then
148+
for env in $TARGETS; do
149+
build_firmware $env
150+
done
148151
else
149152
echo "usage: $0 build-firmware <target>"
150153
exit 1

0 commit comments

Comments
 (0)