2018-10-09 01:16:05 +02:00
|
|
|
.SILENT:
|
|
|
|
|
2018-09-03 10:23:15 +02:00
|
|
|
.PHONY: \
|
|
|
|
devdeps \
|
|
|
|
lint
|
2018-09-03 05:06:53 +02:00
|
|
|
|
2018-10-15 11:49:12 +02:00
|
|
|
.DEFAULT: all
|
|
|
|
|
2018-10-12 02:44:02 +02:00
|
|
|
DOCKER_BASE_TAG ?= latest
|
|
|
|
DOCKER_TAG ?= latest
|
|
|
|
|
2018-09-16 09:15:16 +02:00
|
|
|
AMPY_PORT ?= /dev/ttyUSB0
|
|
|
|
AMPY_BAUD ?= 115200
|
|
|
|
AMPY_DELAY ?= 1.5
|
2018-10-06 00:31:00 +02:00
|
|
|
PIPENV ?= $(shell which pipenv)
|
2018-09-03 12:22:11 +02:00
|
|
|
|
2018-12-29 15:03:31 +01:00
|
|
|
all: copy-kmk copy-bootpy copy-keymap
|
2018-10-15 11:49:12 +02:00
|
|
|
|
2018-10-12 02:44:02 +02:00
|
|
|
.docker_base: Dockerfile_base
|
|
|
|
@echo "===> Building Docker base image kmkfw/base:${DOCKER_BASE_TAG}"
|
|
|
|
@docker build -f Dockerfile_base -t kmkfw/base:${DOCKER_BASE_TAG} .
|
|
|
|
@touch .docker_base
|
|
|
|
|
|
|
|
docker-base: .docker_base
|
|
|
|
|
|
|
|
docker-base-deploy: docker-base
|
|
|
|
@echo "===> Pushing Docker base image kmkfw/base:${DOCKER_BASE_TAG} to Docker Hub"
|
|
|
|
@docker push kmkfw/base:${DOCKER_BASE_TAG}
|
|
|
|
|
2018-10-06 10:32:17 +02:00
|
|
|
.devdeps: Pipfile.lock
|
2018-10-08 16:06:34 +02:00
|
|
|
@echo "===> Installing dependencies with pipenv"
|
2018-10-07 09:51:37 +02:00
|
|
|
@$(PIPENV) install --dev --ignore-pipfile
|
2018-10-06 10:32:17 +02:00
|
|
|
@touch .devdeps
|
|
|
|
|
|
|
|
devdeps: .devdeps
|
2018-09-03 05:06:53 +02:00
|
|
|
|
|
|
|
lint: devdeps
|
2018-10-06 00:31:00 +02:00
|
|
|
@$(PIPENV) run flake8
|
2018-09-03 05:06:53 +02:00
|
|
|
|
2018-09-22 08:44:03 +02:00
|
|
|
fix-isort: devdeps
|
2018-10-12 03:02:13 +02:00
|
|
|
@find kmk/ tests/ user_keymaps/ -name "*.py" | xargs $(PIPENV) run isort
|
2018-10-06 00:31:00 +02:00
|
|
|
|
2018-10-08 16:06:34 +02:00
|
|
|
clean: clean-build-log
|
|
|
|
@echo "===> Cleaning build artifacts"
|
2018-11-06 06:59:42 +01:00
|
|
|
@rm -rf .devdeps build
|
2018-10-08 16:06:34 +02:00
|
|
|
|
|
|
|
clean-build-log:
|
|
|
|
@echo "===> Clearing previous .build.log"
|
|
|
|
@rm -rf .build.log
|
2018-10-06 00:31:00 +02:00
|
|
|
|
2019-07-21 00:01:17 +02:00
|
|
|
# This is mostly a leftover from the days we vendored stuff from
|
|
|
|
# micropython-lib via submodules. Leaving this here mostly in case someone goes
|
|
|
|
# exploring through the history of KMK's repo and manages to screw up their
|
|
|
|
# repo state (those were glitchy times...)
|
2018-10-06 00:31:00 +02:00
|
|
|
powerwash: clean
|
2018-10-08 16:06:34 +02:00
|
|
|
@echo "===> Removing vendor/ to force a re-pull"
|
|
|
|
@rm -rf vendor
|
|
|
|
@echo "===> Removing pipenv-managed virtual environment"
|
|
|
|
@$(PIPENV) --rm || true
|
2018-09-22 08:44:03 +02:00
|
|
|
|
2018-10-17 08:11:23 +02:00
|
|
|
test: lint
|
2018-09-23 11:38:28 +02:00
|
|
|
|
2018-09-27 08:19:11 +02:00
|
|
|
reset-bootloader:
|
2018-10-15 11:49:12 +02:00
|
|
|
@echo "===> Rebooting your board to bootloader (safe to ignore file not found errors)"
|
2018-10-06 00:31:00 +02:00
|
|
|
@-timeout -k 5s 10s $(PIPENV) run ampy -p /dev/ttyACM0 -d ${AMPY_DELAY} -b ${AMPY_BAUD} run util/bootloader.py
|
2018-09-27 08:19:11 +02:00
|
|
|
|
|
|
|
reset-board:
|
2018-10-15 11:49:12 +02:00
|
|
|
@echo "===> Rebooting your board (safe to ignore file not found errors)"
|
2018-10-06 00:31:00 +02:00
|
|
|
@-timeout -k 5s 10s $(PIPENV) run ampy -p /dev/ttyACM0 -d ${AMPY_DELAY} -b ${AMPY_BAUD} run util/reset.py
|
2018-10-15 11:49:12 +02:00
|
|
|
|
|
|
|
ifdef MOUNTPOINT
|
|
|
|
$(MOUNTPOINT)/kmk/.copied: $(shell find kmk/ -name "*.py" | xargs -0)
|
|
|
|
@echo "===> Copying KMK source folder"
|
|
|
|
@rsync -rh kmk $(MOUNTPOINT)/
|
|
|
|
@touch $(MOUNTPOINT)/kmk/.copied
|
|
|
|
@sync
|
|
|
|
|
|
|
|
copy-kmk: $(MOUNTPOINT)/kmk/.copied
|
|
|
|
else
|
|
|
|
copy-kmk:
|
|
|
|
echo "**** MOUNTPOINT must be defined (wherever your CIRCUITPY drive is mounted) ****" && exit 1
|
|
|
|
endif
|
|
|
|
|
2018-12-29 15:03:31 +01:00
|
|
|
ifdef MOUNTPOINT
|
|
|
|
$(MOUNTPOINT)/kmk/boot.py: boot.py
|
|
|
|
@echo "===> Copying required boot.py"
|
|
|
|
@rsync -rh boot.py $(MOUNTPOINT)/
|
|
|
|
@sync
|
|
|
|
|
|
|
|
copy-bootpy: $(MOUNTPOINT)/kmk/boot.py
|
|
|
|
else
|
|
|
|
copy-bootpy:
|
|
|
|
echo "**** MOUNTPOINT must be defined (wherever your CIRCUITPY drive is mounted) ****" && exit 1
|
|
|
|
endif
|
|
|
|
|
2018-10-15 11:49:12 +02:00
|
|
|
ifdef MOUNTPOINT
|
|
|
|
ifndef USER_KEYMAP
|
2018-10-16 13:04:39 +02:00
|
|
|
$(MOUNTPOINT)/main.py:
|
2018-10-15 11:49:12 +02:00
|
|
|
@echo "**** USER_KEYMAP must be defined (ex. USER_KEYMAP=user_keymaps/noop.py) ****" && exit 1
|
|
|
|
else
|
2018-10-16 13:04:39 +02:00
|
|
|
$(MOUNTPOINT)/main.py: $(USER_KEYMAP)
|
|
|
|
@echo "===> Copying your keymap to main.py"
|
2018-10-15 11:49:12 +02:00
|
|
|
@rsync -rh $(USER_KEYMAP) $@
|
|
|
|
@sync
|
|
|
|
endif # USER_KEYMAP
|
|
|
|
|
2018-10-16 13:04:39 +02:00
|
|
|
copy-keymap: $(MOUNTPOINT)/main.py
|
2018-10-15 11:49:12 +02:00
|
|
|
else
|
|
|
|
copy-keymap:
|
|
|
|
echo "**** MOUNTPOINT must be defined (wherever your CIRCUITPY drive is mounted) ****" && exit 1
|
|
|
|
endif # MOUNTPOINT
|