SPIFFS: Improve SPIFFS image build

Rebuild SPIFFS image if files change.
Rebuild mkspiffs if SPIFFS_SIZE is changed in Makefile.
This commit is contained in:
sheinz 2016-07-15 01:21:32 +03:00
parent df796947bd
commit 66610c56cb

View file

@ -27,19 +27,22 @@ define make_spiffs_image
SPIFFS_IMAGE = $(addprefix $(FIRMWARE_DIR),spiffs.bin) SPIFFS_IMAGE = $(addprefix $(FIRMWARE_DIR),spiffs.bin)
MKSPIFFS_DIR = $(ROOT)/extras/spiffs/mkspiffs MKSPIFFS_DIR = $(ROOT)/extras/spiffs/mkspiffs
MKSPIFFS = $$(MKSPIFFS_DIR)/mkspiffs MKSPIFFS = $$(MKSPIFFS_DIR)/mkspiffs
SPIFFS_FILE_LIST = $(shell find $(1))
all: $$(SPIFFS_IMAGE) all: $$(SPIFFS_IMAGE)
clean: clean_spiffs_img clean_mkspiffs clean: clean_spiffs_img clean_mkspiffs
$$(SPIFFS_IMAGE): $$(MKSPIFFS) $(1) $$(SPIFFS_IMAGE): $$(MKSPIFFS) $$(SPIFFS_FILE_LIST)
$$< $(1) $$@ $$< $(1) $$@
$$(MKSPIFFS): # if SPIFFS_SIZE in Makefile is changed rebuild mkspiffs
$$(MKSPIFFS): Makefile
$$(MAKE) -C $$(MKSPIFFS_DIR) clean
$$(MAKE) -C $$(MKSPIFFS_DIR) SPIFFS_SIZE=$(SPIFFS_SIZE) $$(MAKE) -C $$(MKSPIFFS_DIR) SPIFFS_SIZE=$(SPIFFS_SIZE)
clean_spiffs_img: clean_spiffs_img:
$$(Q) rm -f spiffs.img $$(Q) rm -f $$(SPIFFS_IMAGE)
clean_mkspiffs: clean_mkspiffs:
$$(Q) $$(MAKE) -C $$(MKSPIFFS_DIR) clean $$(Q) $$(MAKE) -C $$(MKSPIFFS_DIR) clean