From 391b6d014e36abf6357e0504b640866fb01634c9 Mon Sep 17 00:00:00 2001 From: Jindra Dolezy Date: Sat, 11 Apr 2015 16:20:41 +0200 Subject: [PATCH] Compression settings are passed to Makefile of mkespfsimage and can be set from command line --- Makefile | 9 +++++---- espfs/mkespfsimage/Makefile | 14 ++++++++++++++ 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index fcfc6ae..1b6fd96 100644 --- a/Makefile +++ b/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. #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 # This option works only when GZIP_COMPRESSION is set to "yes" # http://yui.github.io/yuicompressor/ #Disabled by default. -#COMPRESS_W_YUI = "yes" +COMPRESS_W_YUI ?= "no" YUI-COMPRESSOR ?= /usr/bin/yui-compressor #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 #any support in the browser. -USE_HEATSHRINK = "yes" +USE_HEATSHRINK ?= "yes" #Position and maximum length of espfs in flash memory ESPFS_POS = 0x12000 @@ -181,8 +181,9 @@ endif else $(Q) cd html; find | ../espfs/mkespfsimage/mkespfsimage > ../webpages.espfs; cd .. endif + espfs/mkespfsimage/mkespfsimage: espfs/mkespfsimage/ - make -C espfs/mkespfsimage + make -C espfs/mkespfsimage USE_HEATSHRINK=$(USE_HEATSHRINK) GZIP_COMPRESSION=$(GZIP_COMPRESSION) htmlflash: webpages.espfs $(Q) if [ $$(stat -c '%s' webpages.espfs) -gt $$(( $(ESPFS_SIZE) )) ]; then echo "webpages.espfs too big!"; false; fi diff --git a/espfs/mkespfsimage/Makefile b/espfs/mkespfsimage/Makefile index 542f5a6..22b4f80 100644 --- a/espfs/mkespfsimage/Makefile +++ b/espfs/mkespfsimage/Makefile @@ -1,10 +1,24 @@ +GZIP_COMPRESSION ?= "no" +USE_HEATSHRINK ?= "yes" 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 TARGET=mkespfsimage $(TARGET): $(OBJS) +ifeq ($(GZIP_COMPRESSION),"yes") + $(CC) -o $@ $^ -lz +else $(CC) -o $@ $^ +endif clean: rm -f $(TARGET) $(OBJS) \ No newline at end of file