You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Kaleidoscope/tests/Makefile

92 lines
2.4 KiB

# Reset a bunch of historical GNU make implicit rules that we never
# use, but which have a disastrous impact on performance
#
# --no-builtin-rules in MAKEFLAGS apparently came in with GNU Make 4,
# which is newer than what Apple ships
MAKEFLAGS += --no-builtin-rules
# These lines reset the implicit rules we really care about
%:: %,v
%:: RCS/%,v
%:: RCS/%
%:: s.%
%:: SCCS/s.%
.SUFFIXES:
tests_dir := $(abspath $(dir $(lastword ${MAKEFILE_LIST})))
top_dir := $(abspath $(tests_dir)/..)
build_dir := ${top_dir}/_build
LIB_DIR := ${build_dir}/lib
libcommon_a := ${top_dir}/_build/lib/libcommon.a
TEST_PATH ?= ./
export FQBN ?= keyboardio:virtual:model01
TESTS := $(shell cd $(tests_dir); find ${TEST_PATH} -name '*.ino' -exec dirname {} \;)
KALEIDOSCOPE_CCACHE = 1
include $(top_dir)/etc/makefiles/arduino-cli.mk
# If we start off in tests to run make all, the sketch makefiles guess the wrong location for
# Kaliedoscope's makefiles
KALEIDOSCOPE_ETC_DIR ?= $(top_dir)/etc
.PHONY: clean cmake-clean all googletest generate-testcases
generate-testcases:
@for test in ${TESTS}; do \
${MAKE} -s -f ${top_dir}/testing/makefiles/testcase.mk -C $${test} testcase=$${test} generate-testcase; \
done
all: ${TESTS} run-all
run-all: ${TESTS}
@for test in ${TESTS}; do \
${MAKE} -s -f ${top_dir}/testing/makefiles/testcase.mk -C $${test} testcase=$${test} run || ERROR=$$?; \
done; \
if [ -n $${ERROR} ]; then exit $${ERROR}; fi
cmake-clean:
rm -rf "${top_dir}"/testing/googletest/build/*
clean: cmake-clean
@for test in ${TESTS}; do \
${MAKE} -s -f ${top_dir}/testing/makefiles/testcase.mk -C $${test} testcase=$${test} clean; \
done
rm -rf "${build_dir}"/*
googletest: ${top_dir}/testing/googletest/build/Makefile
cd ${top_dir}/testing/googletest/build && $(MAKE)
${top_dir}/testing/googletest/build/Makefile:
$(info googletest Makefile is being remade)
install -d ${top_dir}/testing/googletest/build && cd ${top_dir}/testing/googletest/build && cmake -DCMAKE_C_COMPILER=$(call _arduino_prop,compiler.path)$(call _arduino_prop,compiler.c.cmd) -DCMAKE_CXX_COMPILER=$(call _arduino_prop,compiler.path)$(call _arduino_prop,compiler.cpp.cmd) ..
${libcommon_a}:
${MAKE} -f ${top_dir}/testing/makefiles/libcommon.mk -C ${top_dir}/testing
Makefile:
@:
${TESTS}: ${libcommon_a} googletest
${MAKE} -f ${top_dir}/testing/makefiles/testcase.mk -C $@ testcase=$@ build
%+run:
${MAKE} -s -f ${top_dir}/testing/makefiles/testcase.mk -C $* testcase=$* run