Ver Fonte

httpd: add favicon; fix build dependency problems

H. Peter Anvin há 2 anos atrás
pai
commit
6180ba1be6

+ 12 - 8
esp32/Makefile

@@ -5,7 +5,7 @@ ZIP         = zip
 
 SKETCH   = max80
 TARGET   = output/$(SKETCH).ino.bin
-GENFILES = $(SKETCH)/data/www.zip
+GENFILES = www.zip
 WWW      = www
 PORT	?= /dev/ttyACM2
 
@@ -16,21 +16,25 @@ all: $(TARGET)
 $(TARGET): $(shell find $(SKETCH) -type f) $(GENFILES)
 	mkdir -p build output
 	cd $(SKETCH) && \
-		$(ARDUINO_CLI) compile -b $(BOARD) \
+		$(ARDUINO_CLI) compile -b $(BOARD) --warnings all \
 			--build-path ../build --output-dir ../output
 
-wwwfiles := $(shell find www -type f -print)
+.PHONY: zip
+zip:
+	mkdir -p zip
+	cd www && \
+	$(ZIP) -9DrpX -FS ../zip/www.zip . \
+		-x '.*' -x '#*' -x '*~' -x '*.bak'
 
-$(SKETCH)/data/www.zip: $(wwwfiles)
-	rm -f $@
-	( cd www && $(ZIP) -9DrpX - . -x '.*' -x '#*' -x '*~' -x '*.bak' ) \
-		> $@
+# Ugly hack but needed to avoid unnecessary rebuilds
+www.zip: zip
+	if [ ! -f $@ ] || [ zip/$@ -nt $@ ]; then cp -f zip/$@ $@; fi
 
 upload: $(TARGET)
 	$(ARDUINO_CLI) upload -i $(TARGET) -p $(PORT) -b $(BOARD) $(SKETCH)
 
 clean:
-	rm -rf build $(SKETCH)/data/*.zip
+	rm -rf build zip $(GENFILES)
 
 spotless: clean
 	rm -rf output

+ 1 - 1
esp32/max80/httpd.c

@@ -140,7 +140,7 @@ esp_err_t httpd_firmware_upgrade_handler(httpd_req_t *req)
     return err;
 }
 
-INCBIN(wwwzip, "data/www.zip");
+INCBIN_EXTERN(wwwzip);
 
 struct mime_type {
     const char *ext;

+ 2 - 0
esp32/max80/www.c

@@ -0,0 +1,2 @@
+#include "incbin.h"
+INCBIN(wwwzip, "../www.zip");

BIN
esp32/output/max80.ino.bin


BIN
esp32/www/favicon.ico


BIN
fpga/output/v1.fw


BIN
fpga/output/v2.fw