Simplify conditional building

pull/934/head
Jesse Vincent 4 years ago
parent c98b513636
commit 34b428c4a9
No known key found for this signature in database
GPG Key ID: CC228463465E40BC

@ -171,7 +171,7 @@ prompt_before_flashing () {
}
flash () {
maybe_build "$@"
compile "$@"
# Check to see if we can see a keyboard bootloader port.
# If we -can-, then we should skip over the "reset to bootloader" thing
@ -277,14 +277,14 @@ flash_over_usb () {
}
flash_from_bootloader() {
maybe_build "$@"
compile "$@"
prompt_before_flashing
find_bootloader_ports
check_bootloader_port_and_flash
}
program() {
maybe_build "$@"
compile "$@"
prompt_before_flashing
flash_with_programmer
}
@ -307,9 +307,7 @@ find_bootloader_path() {
hex_with_bootloader () {
if [ ! -e "${HEX_FILE_PATH}" ]; then
compile
fi
compile
find_bootloader_path
@ -328,7 +326,17 @@ hex_with_bootloader () {
EOF
}
maybe_build () {
build () {
compile "$@"
size "$@"
}
prepare_ccache () {
build_paths
enable_ccache
}
compile () {
find_sketch
build_version
build_paths
@ -338,27 +346,14 @@ maybe_build () {
# But it's less broken for most user use cases
# TODO(anyone): Make this suck less
if [ "${HEX_FILE_PATH}" -ot "${SKETCH_FILE_PATH}" ]; then
build "$@"
do_compile "$@"
fi
}
build () {
compile "$@"
size "$@"
}
prepare_ccache () {
build_paths
enable_ccache
}
compile () {
find_sketch
build_version
do_compile () {
prepare_ccache
build_filenames
install -d "${OUTPUT_PATH}"
@ -492,9 +487,7 @@ compile_all () {
size () {
if [ ! -e "${HEX_FILE_PATH}" ]; then
compile
fi
compile
echo "- Size: ${ELF_FILE_PATH}"
# shellcheck disable=SC2086
@ -503,18 +496,13 @@ size () {
}
size_map () {
if [ ! -e "${HEX_FILE_PATH}" ]; then
compile
fi
compile
"${AVR_NM}" --size-sort -C -r -l -t decimal "${ELF_FILE_PATH}"
}
disassemble () {
if [ ! -e "${HEX_FILE_PATH}" ]; then
compile
fi
compile
"${AVR_OBJDUMP}" -C -d "${ELF_FILE_PATH}"
}

Loading…
Cancel
Save