12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- MAKEFLAGS += -R -r
- PROJECT := max80
- SUBDIRS := esp32 tools rv32 fpga
- REVISIONS := v1 v2 bypass
- GIT_DIR ?= .git
- all clean spotless :
- $(MAKE) local.$@ $(SUBDIRS) goal=$@
- prefpga:
- $(MAKE) local.all $(filter-out fpga,$(SUBDIRS)) goal=all
- $(REVISIONS): prefpga
- $(MAKE) -C fpga $@
- .PHONY: $(SUBDIRS)
- $(SUBDIRS):
- $(MAKE) -C $@ $(goal)
- .PHONY: version.mk
- version.mk:
- if [ -d '$(GIT_DIR)' ]; then \
- TZ=UTC0 git log -n 1 --date=local --abbrev=8 \
- --pretty='format:COMMIT_VERSION=$(PROJECT)-%(describe:abbrev=6)%nCOMMIT_ID=%H%nCOMMIT_MAGIC=%h%nCOMMIT_DATE=%cd UTC%n' > $@.tmp ; \
- if cmp -q '$@' '$@.tmp' 2>/dev/null; then \
- rm -f $@.tmp; else mv -f $@.tmp $@; fi \
- fi
- version.%: version.mk version.%.sed
- sed -f $@.sed $< > $@
- $(SUBDIRS): version.mk
- esp32: version.h
- rv32: version.h | tools
- fpga: version.vh | rv32 esp32
- local.all:
- local.clean:
- rm -f *~ ./\#* \# *.bak *.tmp
- local.spotless: local.clean
- rm -f version.h version.vh
- if [ -d .git ]; then rm -f version.mk; fi
- # Obsolete target, need version
- program flash:
- @echo 'Please specify one of: $(foreach rev,$(REVISIONS),$@-$(rev))' 1>&2
- @false
- # FPGA-specific targets
- program-% flash-%: prefpga
- $(MAKE) -C fpga $@
- # ESP update by USB or serial port
- upload-esp:
- $(MAKE) -C esp32 upload
- # Update via HTTP
- ip=max80
- upload-%:
- curl -v --data-binary @fpga/output/$*.fw http://$(ip)/sys/fwupdate
|