Makefile variable magic

v0.9.0
Jindra Dolezy 10 years ago
parent 2ec0e15427
commit 4331360905
  1. 18
      Makefile
  2. 10
      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 ?= "no" 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 ?= "no" 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
@ -123,11 +123,11 @@ Q := @
vecho := @echo vecho := @echo
endif endif
ifeq ($(GZIP_COMPRESSION),"yes") ifeq ("$(GZIP_COMPRESSION)","yes")
CFLAGS += -DGZIP_COMPRESSION CFLAGS += -DGZIP_COMPRESSION
endif endif
ifeq ($(USE_HEATSHRINK),"yes") ifeq ("$(USE_HEATSHRINK)","yes")
CFLAGS += -DESPFS_HEATSHRINK CFLAGS += -DESPFS_HEATSHRINK
endif endif
@ -139,7 +139,7 @@ $1/%.o: %.c
$(Q) $(CC) $(INCDIR) $(MODULE_INCDIR) $(EXTRA_INCDIR) $(SDK_INCDIR) $(CFLAGS) -c $$< -o $$@ $(Q) $(CC) $(INCDIR) $(MODULE_INCDIR) $(EXTRA_INCDIR) $(SDK_INCDIR) $(CFLAGS) -c $$< -o $$@
endef endef
.PHONY: all checkdirs clean .PHONY: all checkdirs clean webpages.espfs
all: checkdirs $(TARGET_OUT) $(FW_BASE) all: checkdirs $(TARGET_OUT) $(FW_BASE)
@ -166,7 +166,7 @@ flash: $(TARGET_OUT) $(FW_BASE)
$(Q) $(ESPTOOL) --port $(ESPPORT) --baud $(ESPBAUD) write_flash 0x00000 $(FW_BASE)/0x00000.bin 0x40000 $(FW_BASE)/0x40000.bin $(Q) $(ESPTOOL) --port $(ESPPORT) --baud $(ESPBAUD) write_flash 0x00000 $(FW_BASE)/0x00000.bin 0x40000 $(FW_BASE)/0x40000.bin
webpages.espfs: html/ html/wifi/ espfs/mkespfsimage/mkespfsimage webpages.espfs: html/ html/wifi/ espfs/mkespfsimage/mkespfsimage
ifeq ($(COMPRESS_W_YUI),"yes") ifeq ("$(COMPRESS_W_YUI)","yes")
$(Q) rm -rf html_compressed; $(Q) rm -rf html_compressed;
$(Q) cp -r html html_compressed; $(Q) cp -r html html_compressed;
$(Q) echo "Compression assets with yui-compressor. This may take a while..." $(Q) echo "Compression assets with yui-compressor. This may take a while..."
@ -182,7 +182,7 @@ else
endif endif
espfs/mkespfsimage/mkespfsimage: espfs/mkespfsimage/ espfs/mkespfsimage/mkespfsimage: espfs/mkespfsimage/
make -C espfs/mkespfsimage USE_HEATSHRINK=$(USE_HEATSHRINK) GZIP_COMPRESSION=$(GZIP_COMPRESSION) $(Q) $(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
@ -195,7 +195,7 @@ clean:
$(Q) make -C espfs/mkespfsimage/ clean $(Q) make -C espfs/mkespfsimage/ clean
$(Q) rm -rf $(FW_BASE) $(Q) rm -rf $(FW_BASE)
$(Q) rm -f webpages.espfs $(Q) rm -f webpages.espfs
ifeq ($(COMPRESS_W_YUI),"yes") ifeq ("$(COMPRESS_W_YUI)","yes")
$(Q) rm -rf html_compressed $(Q) rm -rf html_compressed
endif endif

@ -1,12 +1,12 @@
GZIP_COMPRESSION ?= "no" GZIP_COMPRESSION ?= no
USE_HEATSHRINK ?= "yes" USE_HEATSHRINK ?= yes
CFLAGS=-I../../lib/heatshrink -I.. -std=gnu99 CFLAGS=-I../../lib/heatshrink -I.. -std=gnu99
ifeq ($(GZIP_COMPRESSION),"yes") ifeq ("$(GZIP_COMPRESSION)","yes")
CFLAGS += -DESPFS_GZIP CFLAGS += -DESPFS_GZIP
endif endif
ifeq ($(USE_HEATSHRINK),"yes") ifeq ("$(USE_HEATSHRINK)","yes")
CFLAGS += -DESPFS_HEATSHRINK CFLAGS += -DESPFS_HEATSHRINK
endif endif
@ -14,7 +14,7 @@ OBJS=main.o heatshrink_encoder.o
TARGET=mkespfsimage TARGET=mkespfsimage
$(TARGET): $(OBJS) $(TARGET): $(OBJS)
ifeq ($(GZIP_COMPRESSION),"yes") ifeq ("$(GZIP_COMPRESSION)","yes")
$(CC) -o $@ $^ -lz $(CC) -o $@ $^ -lz
else else
$(CC) -o $@ $^ $(CC) -o $@ $^

Loading…
Cancel
Save