# # Handle generic compile to .mpy and upload to a Pico board # LOCAL_LIBS = lib/homeutil.mpy THIRD_PARTY = 3p/microdot.mpy 3p/ezt.mpy 3p/easydict/__init__.mpy ### what to do with this? PACKAGES = 3p/easydict MICRODOT = https://raw.githubusercontent.com/miguelgrinberg/microdot/main/src/microdot/microdot.py MIP = logging collections aiohttp time # Build all the local stuff. all: $(LOCAL_LIBS) config.rep # Install the libs onto the Pico. All apps use the same main.py, # which loads app.py (app.mpy) and calls into it. install: $(LOCAL_LIBS) config.repr install-local install-3p -mpremote mkdir :lib/ > /dev/null mpremote ls :lib | fgrep logging > /dev/null || mpremote mip install $(MIP) mpremote cp main.py :/ mpremote cp config.repr :/ install-3p: $(THIRD_PARTY) mpremote cp 3p/microdot.mpy :lib/ -mpremote mkdir :lib/easydict > /dev/null mpremote cp 3p/easydict/__init__.mpy :lib/easydict/ mpremote cp 3p/ezt.mpy :lib/ install-local: $(LOCAL_LIBS) mpremote cp lib/homeutil.mpy :lib/ DIR595 = 3p/micropython-74hc595/src install-595: $(DIR595)/__init__.mpy $(DIR595)/sr74hc595_spi.mpy $(DIR595)/sr74hc595_bitbang.mpy -mpremote mkdir :lib/sr74hc595 > /dev/null mpremote cp $^ :lib/sr74hc595/ fetch: wget -O 3p/microdot.py $(MICRODOT) pip3 install --target 3p ezt easydict config.repr: config.yaml python3 -c "import yaml ; print(repr(yaml.safe_load(open('$<'))))" > $@ lighting: lighting/app.mpy mpremote cp $< :/ relays: relays/app.mpy mpremote cp $< :/ switches: switches/app.mpy switches/alexa.mpy mpremote cp $^ :/ %.mpy : %.py mpy-cross $<