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:
parent
df796947bd
commit
66610c56cb
1 changed files with 7 additions and 4 deletions
|
@ -20,26 +20,29 @@ spiffs_CFLAGS += -DSPIFFS_SIZE=$(SPIFFS_SIZE)
|
||||||
#
|
#
|
||||||
# Argumens:
|
# Argumens:
|
||||||
# $(1) - directory with files which go into spiffs image
|
# $(1) - directory with files which go into spiffs image
|
||||||
#
|
#
|
||||||
# Example:
|
# Example:
|
||||||
# $(eval $(call make_spiffs_image,files))
|
# $(eval $(call make_spiffs_image,files))
|
||||||
define make_spiffs_image
|
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
|
||||||
|
|
Loading…
Reference in a new issue