Compression settings are passed to Makefile of mkespfsimage and can be set from command line

pull/30/head
Jindra Dolezy 10 years ago
parent 2ae9c904d4
commit 391b6d014e
  1. 9
      Makefile
  2. 14
      espfs/mkespfsimage/Makefile

@ -13,19 +13,19 @@
# Adding JPG or PNG files (and any other compressed formats) is not recommended, because GZIP compression does not works effectively on compressed files. # Adding JPG or PNG files (and any other compressed formats) is not recommended, because GZIP compression does not works effectively on compressed files.
#Static gzipping is disabled by default. #Static gzipping is disabled by default.
#GZIP_COMPRESSION = "yes" GZIP_COMPRESSION ?= "no"
# If COMPRESS_W_YUI is set to "yes" then the static css and js files will be compressed with yui-compressor # If COMPRESS_W_YUI is set to "yes" then the static css and js files will be compressed with yui-compressor
# This option works only when GZIP_COMPRESSION is set to "yes" # This option works only when GZIP_COMPRESSION is set to "yes"
# http://yui.github.io/yuicompressor/ # http://yui.github.io/yuicompressor/
#Disabled by default. #Disabled by default.
#COMPRESS_W_YUI = "yes" COMPRESS_W_YUI ?= "no"
YUI-COMPRESSOR ?= /usr/bin/yui-compressor YUI-COMPRESSOR ?= /usr/bin/yui-compressor
#If USE_HEATSHRINK is set to "yes" then the espfs files will be compressed with Heatshrink and decompressed #If USE_HEATSHRINK is set to "yes" then the espfs files will be compressed with Heatshrink and decompressed
#on the fly while reading the file. Because the decompression is done in the esp8266, it does not require #on the fly while reading the file. Because the decompression is done in the esp8266, it does not require
#any support in the browser. #any support in the browser.
USE_HEATSHRINK = "yes" USE_HEATSHRINK ?= "yes"
#Position and maximum length of espfs in flash memory #Position and maximum length of espfs in flash memory
ESPFS_POS = 0x12000 ESPFS_POS = 0x12000
@ -181,8 +181,9 @@ endif
else else
$(Q) cd html; find | ../espfs/mkespfsimage/mkespfsimage > ../webpages.espfs; cd .. $(Q) cd html; find | ../espfs/mkespfsimage/mkespfsimage > ../webpages.espfs; cd ..
endif endif
espfs/mkespfsimage/mkespfsimage: espfs/mkespfsimage/ espfs/mkespfsimage/mkespfsimage: espfs/mkespfsimage/
make -C espfs/mkespfsimage make -C espfs/mkespfsimage USE_HEATSHRINK=$(USE_HEATSHRINK) GZIP_COMPRESSION=$(GZIP_COMPRESSION)
htmlflash: webpages.espfs htmlflash: webpages.espfs
$(Q) if [ $$(stat -c '%s' webpages.espfs) -gt $$(( $(ESPFS_SIZE) )) ]; then echo "webpages.espfs too big!"; false; fi $(Q) if [ $$(stat -c '%s' webpages.espfs) -gt $$(( $(ESPFS_SIZE) )) ]; then echo "webpages.espfs too big!"; false; fi

@ -1,10 +1,24 @@
GZIP_COMPRESSION ?= "no"
USE_HEATSHRINK ?= "yes"
CFLAGS=-I../../lib/heatshrink -I.. -std=gnu99 CFLAGS=-I../../lib/heatshrink -I.. -std=gnu99
ifeq ($(GZIP_COMPRESSION),"yes")
CFLAGS += -DESPFS_GZIP
endif
ifeq ($(USE_HEATSHRINK),"yes")
CFLAGS += -DESPFS_HEATSHRINK
endif
OBJS=main.o heatshrink_encoder.o OBJS=main.o heatshrink_encoder.o
TARGET=mkespfsimage TARGET=mkespfsimage
$(TARGET): $(OBJS) $(TARGET): $(OBJS)
ifeq ($(GZIP_COMPRESSION),"yes")
$(CC) -o $@ $^ -lz
else
$(CC) -o $@ $^ $(CC) -o $@ $^
endif
clean: clean:
rm -f $(TARGET) $(OBJS) rm -f $(TARGET) $(OBJS)
Loading…
Cancel
Save