extract out some common code in the testing makefiles

tmp/arduino-cli-pre-rebase
Jesse Vincent 4 years ago
parent c66ceeea67
commit 43c0e12ce1
No known key found for this signature in database
GPG Key ID: CC228463465E40BC

@ -1,8 +1,9 @@
top_dir := $(abspath $(dir $(lastword ${MAKEFILE_LIST}))../..)
build_dir := ${top_dir}/_build
mkfile_dir := $(dir $(lastword ${MAKEFILE_LIST}))
top_dir := $(abspath $(mkfile_dir)../..)
include $(mkfile_dir)/shared.mk
bundle_path = ${ARDUINO_DIRECTORIES_USER}/hardware/keyboardio/avr/libraries
build_dir := ${top_dir}/_build
LIB_DIR := ${build_dir}/lib
OBJ_DIR := ${build_dir}/obj
@ -31,24 +32,7 @@ ${LIB_DIR}/${LIB_FILE}: ${OBJ_FILES}
${OBJ_DIR}/%.o: ${top_dir}/testing/%.cpp ${H_FILES}
$(info compile $@)
@install -d "${OBJ_DIR}"
$(COMPILER_WRAPPER) g++ -o "$@" -c \
-std=c++14 \
-I${top_dir} \
-I${top_dir}/src \
-I${bundle_path}/../../virtual/cores/arduino \
-I${bundle_path}/KeyboardioHID/src \
-I${top_dir}/testing/googletest/googlemock/include \
-I${top_dir}/testing/googletest/googletest/include \
-DARDUINO=10607 \
-DARDUINO_ARCH_VIRTUAL \
-DARDUINO_AVR_MODEL01 \
'-DKALEIDOSCOPE_HARDWARE_H="Kaleidoscope-Hardware-Model01.h"' \
-DKALEIDOSCOPE_VIRTUAL_BUILD=1 \
-DKEYBOARDIOHID_BUILD_WITHOUT_HID=1 \
-DUSBCON=dummy \
-DARDUINO_ARCH_AVR=1 \
'-DUSB_PRODUCT="Model 01"' \
$<
$(COMPILER_WRAPPER) g++ -o "$@" -c -std=c++14 ${shared_includes} ${shared_defines} $<
clean:
rm -rf -- "${build_dir}"

@ -0,0 +1,21 @@
arduino_platform_path := ${ARDUINO_DIRECTORIES_USER}/hardware/keyboardio/virtual/
shared_defines := \
-DARDUINO=10607 \
-DARDUINO_ARCH_VIRTUAL \
-DKALEIDOSCOPE_VIRTUAL_BUILD=1 \
-DKEYBOARDIOHID_BUILD_WITHOUT_HID=1 \
-DUSBCON=dummy \
-DARDUINO_ARCH_AVR=1 \
-DARDUINO_AVR_MODEL01 \
'-DKALEIDOSCOPE_HARDWARE_H="Kaleidoscope-Hardware-Model01.h"' \
'-DUSB_PRODUCT="Model 01"'
shared_includes := \
-I${top_dir} \
-I${top_dir}/src \
-I${arduino_platform_path}/cores/arduino \
-I${arduino_platform_path}/libraries/KeyboardioHID/src \
-I${top_dir}/testing/googletest/googlemock/include \
-I${top_dir}/testing/googletest/googletest/include \

@ -1,9 +1,10 @@
top_dir := $(abspath $(dir $(lastword ${MAKEFILE_LIST}))../..)
mkfile_dir := $(dir $(lastword ${MAKEFILE_LIST}))
top_dir := $(abspath $(mkfile_dir)../..)
include $(mkfile_dir)/shared.mk
build_dir := ${top_dir}/_build/${testcase}
LIB_DIR := ${build_dir}/lib
OBJ_DIR := ${build_dir}/obj
BIN_DIR := ${build_dir}/bin
@ -40,8 +41,6 @@ endif
TEST_OBJS=$(patsubst $(SRC_DIR)/%.cpp,${OBJ_DIR}/%.o,$(TEST_FILES))
bundle_path = ${ARDUINO_DIRECTORIES_USER}/hardware/keyboardio/avr/libraries
build: ${BIN_DIR}/${BIN_FILE} compile-sketch
all: run
@ -93,24 +92,8 @@ endif
${OBJ_DIR}/%.o: ${SRC_DIR}/%.cpp
@echo "compile $@"
install -d "${OBJ_DIR}"
$(COMPILER_WRAPPER) $(call _arduino_prop,compiler.cpp.cmd) -o "$@" -c \
-std=c++14 \
-I${top_dir} \
-I${top_dir}/src \
-I${bundle_path}/../../virtual/cores/arduino \
-I${bundle_path}/KeyboardioHID/src \
-I${top_dir}/testing/googletest/googlemock/include \
-I${top_dir}/testing/googletest/googletest/include \
-DARDUINO=10607 \
-DARDUINO_ARCH_VIRTUAL \
-DARDUINO_AVR_MODEL01 \
'-DKALEIDOSCOPE_HARDWARE_H="Kaleidoscope-Hardware-Model01.h"' \
-DKALEIDOSCOPE_VIRTUAL_BUILD=1 \
-DKEYBOARDIOHID_BUILD_WITHOUT_HID=1 \
-DUSBCON=dummy \
-DARDUINO_ARCH_AVR=1 \
'-DUSB_PRODUCT="Model 01"' \
$<
$(COMPILER_WRAPPER) $(call _arduino_prop,compiler.cpp.cmd) \
-o "$@" -c -std=c++14 ${shared_includes} ${shared_defines} $<
clean:
rm -f -- "${SRC_DIR}/generated-testcase.cpp"

Loading…
Cancel
Save