1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- MAKEFLAGS += -R -r
- dstdir := $(shell pwd)
- export dstdir
- ARDUINO = $(PERL) $(realpath arduino-wrapper)
- ZIP = zip
- PERL = perl
- SKETCH = max80
- TARGET = output/$(SKETCH).ino.bin
- GENFILES = $(SKETCH)/data/www.zip
- WWW = www
- PORT ?= /dev/ttyACM0
- all: $(TARGET)
- common := ../common
- output/%.ino.bin: $(GENFILES)
- cd $(SKETCH) && $(ARDUINO) compile
- -include $(SKETCH).deps
- %.deps:
- if ! test -L '$*/src/common'; then \
- rm -rf '$*/src/common' 2>/dev/null ; \
- cd '$*/src' && ln -sf ../../$(common) . ; \
- fi
- ( echo -n 'output/$*.ino.bin: ' && \
- find -L '$*' -type f '(' -path '$*/data/*' \
- $(patsubst %,-o -name '*.%',ino c h S cpp hpp tpp ipp) \
- ')' -printf '\\\n\t%p ' && \
- echo '' ) > '$@'
- .PHONY: zip
- zip: zipexclude
- mkdir -p zip
- if ! cmp -q ../version.mk www/version 2>/dev/null; then \
- cp -f ../version.mk www/version; \
- fi
- cd www && \
- TZ=GMT0 \
- $(ZIP) -9DrpX -UN=UTF8 -FS ../zip/www.zip . -x@../zipexclude
- # Ugly hack but needed to avoid unnecessary rebuilds
- $(SKETCH)/data/www.zip: zip
- if [ ! -f $@ ] || [ zip/$(@F) -nt $@ ]; then \
- mkdir -p $(@D) ; \
- cp -f zip/$(@F) $@; \
- rm -f build/sketch/www.c build/sketch/www.c.*; \
- fi
- upload: $(TARGET)
- cd $(SKETCH) && $(ARDUINO) upload -p $(PORT) $(SKETCH)
- clean:
- rm -rf build cache zip www.zip *.deps $(GENFILES) \
- $(SKETCH)/src/common
- spotless: clean
- rm -rf arduino output
|