33 lines
1.0 KiB
Plaintext
33 lines
1.0 KiB
Plaintext
.SILENT:
|
|
|
|
.PHONY: \
|
|
clean-dist \
|
|
devdeps \
|
|
dist \
|
|
dockerbase \
|
|
lint
|
|
|
|
.DEFAULT: all
|
|
|
|
MPY_CROSS ?= $(shell which mpy-cross 2>/dev/null)
|
|
MPY_FLAGS ?= '-O2'
|
|
MPY_SOURCES ?= 'kmk/'
|
|
MPY_TARGET_DIR ?= compiled
|
|
PY_KMK_TREE = $(shell find $(MPY_SOURCES) -name "*.py")
|
|
DIST_DESCRIBE = $(shell $(DIST_DESCRIBE_CMD))
|
|
|
|
TIMESTAMP := $(shell date +%s)
|
|
|
|
compile: $(MPY_TARGET_DIR)/.mpy.compiled
|
|
$(MPY_TARGET_DIR)/.mpy.compiled: $(PY_KMK_TREE)
|
|
@mkdir -p $(MPY_TARGET_DIR)/8
|
|
@echo "KMK_RELEASE = '$(DIST_DESCRIBE)'" > $(MPY_SOURCES)/release_info.py
|
|
@find $(MPY_SOURCES) -name "*.py" -exec sh -c 'mkdir -p $(MPY_TARGET_DIR)/$$(dirname {}) && ./mpy-cross-8 $(MPY_FLAGS) {} -o $(MPY_TARGET_DIR)/8/$$(dirname {})/$$(basename -s .py {}).mpy' \;
|
|
@rm -rf $(MPY_SOURCES)/release_info.py
|
|
@touch $(MPY_TARGET_DIR)/.mpy.compileds
|
|
|
|
|
|
|
|
|
|
find ./kmk/ -name "*.py" -exec sh -c 'mkdir -p ./compile/8/$dirname {} &&\
|
|
./mpy-cross-8 -O2 {} -o ./compile/8/$$(dirname {})/$$(basename -s .py {}).mpy' \; |