parent
61f8fc5456
commit
6ef1570964
@ -1,51 +1,41 @@
|
|||||||
top_dir := $(dir $(lastword ${MAKEFILE_LIST}))../..
|
mkfile_dir := $(dir $(lastword ${MAKEFILE_LIST}))
|
||||||
build_dir := ${top_dir}/_build
|
top_dir := $(abspath $(mkfile_dir)../..)
|
||||||
|
|
||||||
ifndef BOARD_HARDWARE_PATH
|
include $(mkfile_dir)/shared.mk
|
||||||
bundle_path = ${top_dir}/..
|
|
||||||
else
|
|
||||||
bundle_path = ${BOARD_HARDWARE_PATH}/keyboardio/avr/libraries
|
build_dir := ${top_dir}/_build
|
||||||
endif
|
|
||||||
|
|
||||||
LIB_DIR := ${build_dir}/lib
|
LIB_DIR := ${build_dir}/lib
|
||||||
OBJ_DIR := ${build_dir}/obj
|
OBJ_DIR := ${build_dir}/obj
|
||||||
|
|
||||||
CXX_FILES := $(wildcard ${top_dir}/testing/*.cpp)
|
CXX_FILES := $(sort $(wildcard ${top_dir}/testing/*.cpp))
|
||||||
H_FILES := $(wildcard ${top_dir}/testing/*.h)
|
H_FILES := $(sort $(wildcard ${top_dir}/testing/*.h))
|
||||||
BARE_CXX_FILES := $(foreach path,${CXX_FILES},$(notdir ${path}))
|
BARE_CXX_FILES := $(foreach path,${CXX_FILES},$(notdir ${path}))
|
||||||
OBJ_FILES := $(patsubst %.cpp,${OBJ_DIR}/%.o,$(BARE_CXX_FILES))
|
OBJ_FILES := $(patsubst %.cpp,${OBJ_DIR}/%.o,$(BARE_CXX_FILES))
|
||||||
LIB_FILE := libcommon.a
|
LIB_FILE := libcommon.a
|
||||||
|
|
||||||
|
ifneq ($(KALEIDOSCOPE_CCACHE),)
|
||||||
|
COMPILER_WRAPPER := ccache
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
.PHONY: all
|
.PHONY: all
|
||||||
|
|
||||||
|
DEFAULT_GOAL: all
|
||||||
|
|
||||||
all: ${OBJ_FILES} ${LIB_DIR}/${LIB_FILE}
|
all: ${OBJ_FILES} ${LIB_DIR}/${LIB_FILE}
|
||||||
|
|
||||||
${LIB_DIR}/${LIB_FILE}: ${OBJ_FILES}
|
${LIB_DIR}/${LIB_FILE}: ${OBJ_FILES}
|
||||||
@install -d "${LIB_DIR}"
|
$(QUIET) install -d "${LIB_DIR}"
|
||||||
ar rcs "${LIB_DIR}/${LIB_FILE}" ${OBJ_FILES}
|
$(QUIET) $(call _arduino_prop,compiler.ar.cmd) $(call _arduino_prop,compiler.ar.flags) "${LIB_DIR}/${LIB_FILE}" ${OBJ_FILES}
|
||||||
|
|
||||||
${OBJ_DIR}/%.o: ${top_dir}/testing/%.cpp ${H_FILES}
|
${OBJ_DIR}/%.o: ${top_dir}/testing/%.cpp ${H_FILES}
|
||||||
@echo "compile $@"
|
$(info compile $@)
|
||||||
@install -d "${OBJ_DIR}"
|
$(QUIET) install -d "${OBJ_DIR}"
|
||||||
g++ -o "$@" -c \
|
$(QUIET) $(COMPILER_WRAPPER) $(call _arduino_prop,compiler.cpp.cmd) -o "$@" -c -std=c++14 ${shared_includes} ${shared_defines} $<
|
||||||
-std=c++14 \
|
|
||||||
-I${top_dir} \
|
|
||||||
-I${top_dir}/src \
|
|
||||||
-I${bundle_path}/../../virtual/cores/arduino \
|
|
||||||
-I${bundle_path}/Kaleidoscope-HIDAdaptor-KeyboardioHID/src \
|
|
||||||
-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"' \
|
|
||||||
$<
|
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf "${build_dir}"
|
$(QUIET) rm -rf -- "${build_dir}"
|
||||||
|
|
||||||
|
include $(top_dir)/etc/makefiles/arduino-cli.mk
|
||||||
|
@ -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 \
|
||||||
|
|
Loading…
Reference in new issue