build: reorganize lib/ target to avoid nested make calls

This commit is contained in:
Laborratte5 2024-05-04 13:21:19 +02:00
parent 5048b578ff
commit 11216e9d25
Signed by: Laborratte5
GPG key ID: 3A30072E35202C02

View file

@ -24,16 +24,14 @@ requirements.txt: poetry.lock
lib/: requirements.txt lib/: requirements.txt
$(VENV) python -m pip install -r requirements.txt --target lib/ $(VENV) python -m pip install -r requirements.txt --target lib/
$(MAKE) compile_lib
$(MAKE) install_lib
compile_lib: compile_lib: lib/
@for f in $(shell find lib/ -type f -regex ".+\.py"); do \ @for f in $(shell find lib/ -type f -regex ".+\.py"); do \
echo Compile $$f; \ echo Compile $$f; \
$(MPYCROSS) $$f; \ $(MPYCROSS) $$f; \
done done
install_lib: lib_tree install_lib: compile_lib lib_tree
@for f in $(shell find lib/ -type f -regex ".+\.mpy"); do \ @for f in $(shell find lib/ -type f -regex ".+\.mpy"); do \
echo Uploading $$f; \ echo Uploading $$f; \
$(AMPY) put $$f $$f; \ $(AMPY) put $$f $$f; \
@ -55,9 +53,9 @@ erase_flash:
flash_esp: erase_flash flash_esp: erase_flash
$(ESP_TOOL) --baud 460800 write_flash --flash_size=detect 0 $(MICRO_PYTHON_FIRMWARE) $(ESP_TOOL) --baud 460800 write_flash --flash_size=detect 0 $(MICRO_PYTHON_FIRMWARE)
install: check lib/ $(JUPYTER_PYTHON_FILES) install: check install_lib $(JUPYTER_PYTHON_FILES)
$(AMPY) put src/main.py $(AMPY) put src/main.py
@for f in $(filter-out check lib/,$?); do \ @for f in $(filter-out check install_lib,$?); do \
echo Uploading $$f; \ echo Uploading $$f; \
$(AMPY) put $$f; \ $(AMPY) put $$f; \
done done