From 4c23591a1fbc2ef493aa32ff9e52d339f9a55a28 Mon Sep 17 00:00:00 2001 From: Jesse Vincent Date: Mon, 16 Nov 2020 00:04:23 -0800 Subject: [PATCH] clean up some make targets --- bin/kaleidoscope-builder | 34 +--------------------------------- etc/sketch-arduino-cli.mk | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 33 deletions(-) diff --git a/bin/kaleidoscope-builder b/bin/kaleidoscope-builder index f32f81eb..a3b0703d 100755 --- a/bin/kaleidoscope-builder +++ b/bin/kaleidoscope-builder @@ -61,6 +61,7 @@ cmd_flash() { echo "When you're ready to proceed, press 'Enter'." # We do not want to permit line continuations here. We just want a newline. + # shellcheck disable=SC2162 read @@ -68,39 +69,6 @@ cmd_flash() { } -cmd_compile() { - install -d "${OUTPUT_PATH}" - - echo "Building ${SKETCH_FILE_PATH}" - - # This is defined in the (optional) user config. - # shellcheck disable=SC2154 - - # shellcheck disable=SC2086 - _run_arduino_cli compile \ - --fqbn "${FQBN}" \ - --libraries "${KALEIDOSCOPE_DIR}/.." \ - --build-path "${BUILD_PATH}" \ - --output-dir "${OUTPUT_PATH}" \ - --build-cache-path "${CORE_CACHE_PATH}" \ - --build-properties "compiler.cpp.extra_flags=${LOCAL_CFLAGS}" \ - --warnings all ${ARDUINO_VERBOSE} \ - "${SKETCH_FILE_PATH}" - - if [ -z "${LIBONLY}" ]; then - cp "${BUILD_PATH}/${SKETCH_FILE_NAME}.hex" "${HEX_FILE_PATH}" - cp "${BUILD_PATH}/${SKETCH_FILE_NAME}.elf" "${ELF_FILE_PATH}" - ln -sf "${OUTPUT_FILE_PREFIX}.hex" "${OUTPUT_PATH}/${SKETCH_BASE_NAME}-latest.hex" - ln -sf "${OUTPUT_FILE_PREFIX}.elf" "${OUTPUT_PATH}/${SKETCH_BASE_NAME}-latest.elf" - else - cp "${BUILD_PATH}/${SKETCH_FILE_NAME}.a" "${LIB_FILE_PATH}" - ln -sf "${OUTPUT_FILE_PREFIX}.a" "${OUTPUT_PATH}/${SKETCH_BASE_NAME}-latest.a" - fi - - if [ "${ARDUINO_VERBOSE}" == "--verbose" ]; then - echo "Build artifacts can be found in ${BUILD_PATH}" - fi -} cmd_help() { diff --git a/etc/sketch-arduino-cli.mk b/etc/sketch-arduino-cli.mk index 2f047c65..b4ca451f 100644 --- a/etc/sketch-arduino-cli.mk +++ b/etc/sketch-arduino-cli.mk @@ -194,6 +194,33 @@ clean: rm -rf -- "${OUTPUT_PATH}/*" +_do_compile: + +compile: + install -d "${OUTPUT_PATH}" + @echo "Building ${SKETCH_FILE_PATH}" + $(ARDUINO_CLI) compile \ + --fqbn "${FQBN}" \ + --libraries "${KALEIDOSCOPE_DIR}/.." \ + --build-path "${BUILD_PATH}" \ + --output-dir "${OUTPUT_PATH}" \ + --build-cache-path "${CORE_CACHE_PATH}" \ + --build-properties "compiler.cpp.extra_flags=${LOCAL_CFLAGS}" \ + --warnings all ${ARDUINO_VERBOSE} \ + "${SKETCH_FILE_PATH}" +ifeq ($(LIBONLY),) + cp "${BUILD_PATH}/${SKETCH_FILE_NAME}.hex" "${HEX_FILE_PATH}" + cp "${BUILD_PATH}/${SKETCH_FILE_NAME}.elf" "${ELF_FILE_PATH}" + ln -sf "${OUTPUT_FILE_PREFIX}.hex" "${OUTPUT_PATH}/${SKETCH_BASE_NAME}-latest.hex" + ln -sf "${OUTPUT_FILE_PREFIX}.elf" "${OUTPUT_PATH}/${SKETCH_BASE_NAME}-latest.elf" +else + cp "${BUILD_PATH}/${SKETCH_FILE_NAME}.a" "${LIB_FILE_PATH}" + ln -sf "${OUTPUT_FILE_PREFIX}.a" "${OUTPUT_PATH}/${SKETCH_BASE_NAME}-latest.a" +endif + @echo "Build artifacts can be found in ${BUILD_PATH}" + + + %: $(KALEIDOSCOPE_BIN_DIR)/kaleidoscope-builder $@