-
Notifications
You must be signed in to change notification settings - Fork 0
/
component.mk
90 lines (71 loc) · 2.61 KB
/
component.mk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#
#
ifdef CONFIG_AHTTPD_ENABLE
COMPONENT_ADD_INCLUDEDIRS := .
COMPONENT_SRCDIRS := . http-parser espfs
COMPONENT_ADD_LDFLAGS := -lahttpd
ifdef CONFIG_AHTTPD_MAX_URL_SIZE
CFLAGS += -DAHTTPD_MAX_URL_SIZE=$(CONFIG_AHTTPD_MAX_URL_SIZE)
endif
ifdef CONFIG_AHTTPD_MAX_HEADER_NAME_SIZE
CFLAGS += -DAHTTPD_MAX_HEADER_NAME_SIZE=$(CONFIG_AHTTPD_MAX_HEADER_NAME_SIZE)
endif
ifdef CONFIG_AHTTPD_MAX_HEADER_VALUE_SIZE
CFLAGS += -DAHTTPD_MAX_HEADER_VALUE_SIZE=$(CONFIG_AHTTPD_MAX_HEADER_VALUE_SIZE)
endif
ifdef CONFIG_AHTTPD_ENABLE_ESPFS
COMPONENT_ADD_LDFLAGS += -lwebpages-espfs
CFLAGS += -DCONFIG_AHTTPD_ENABLE_ESPFS
CFLAGS += -DAHTTPD_ESPFS_CHUNK_SIZE=$(CONFIG_AHTTPD_ESPFS_CHUNK_SIZE)
COMPONENT_EXTRA_CLEAN := \
libwebpages-espfs.a \
webpages.espfs \
webpages.espfs.o \
webpages.espfs.o.tmp \
mkespfsimage/heatshrink_encoder.o \
mkespfsimage/main.o \
mkespfsimage/mkespfsimage
libahttpd.a: libwebpages-espfs.a
ifdef CONFIG_AHTTPD_HTML_GENERATE_CMD
HTML_CMD := $(shell echo $(CONFIG_AHTTPD_HTML_GENERATE_CMD) \
$(PROJECT_PATH)/$(CONFIG_AHTTPD_HTMLDIR))
COMPONENT_EXTRA_CLEAN += $(PROJECT_PATH)/$(CONFIG_AHTTPD_HTMLDIR)/*
$(PROJECT_PATH)/$(CONFIG_AHTTPD_HTMLDIR):
cd $(PROJECT_PATH) && $(HTML_CMD)
endif # CONFIG_AHTTPD_HTML_GENERATE_CMD
ifdef CONFIG_AHTTPD_ESPFS_GZIP
GZIP_FILES := $(shell echo "-g" $(CONFIG_AHTTPD_ESPFS_GZIP_EXTS))
GZIP_COMPRESSION := "yes"
else
GPIZ_FILES :=
GZIP_COMPRESSION := "no"
endif # CONFIG_AHTTPD_ESPFS_GZIP
ifdef CONFIG_AHTTPD_ESPFS_HEATSHRINK
USE_HEATSHRINK := "yes"
CFLAGS += -DESPFS_HEATSHRINK
COMPONENT_SRCDIRS += espfs/heatshrink
else
USE_HEATSHRINK := "no"
endif # CONFIG_AHTTPD_ESPFS_HEATSHRINK
libahttpd.a: libwebpages-espfs.a
webpages.espfs: $(PROJECT_PATH)/$(CONFIG_AHTTPD_HTMLDIR) mkespfsimage/mkespfsimage
cd $(PROJECT_PATH)/$(CONFIG_AHTTPD_HTMLDIR) && \
pwd && \
find . | $(COMPONENT_BUILD_DIR)/mkespfsimage/mkespfsimage \
$(GZIP_FILES) > $(COMPONENT_BUILD_DIR)/webpages.espfs
libwebpages-espfs.a: webpages.espfs
$(OBJCOPY) -I binary -O elf32-xtensa-le -B xtensa --rename-section \
.data=.rodata webpages.espfs webpages.espfs.o.tmp
$(CC) -nostdlib -Wl,-r webpages.espfs.o.tmp -o webpages.espfs.o \
-Wl,-T $(COMPONENT_PATH)/espfs/webpages.espfs.esp32.ld
$(AR) cru $@ webpages.espfs.o
mkespfsimage/mkespfsimage: $(COMPONENT_PATH)/espfs/mkespfsimage
mkdir -p $(COMPONENT_BUILD_DIR)/mkespfsimage
$(MAKE) -C $(COMPONENT_BUILD_DIR)/mkespfsimage \
-f $(COMPONENT_PATH)/espfs/mkespfsimage/Makefile \
USE_HEATSHRINK="$(USE_HEATSHRINK)" \
GZIP_COMPRESSION="$(GZIP_COMPRESSION)" \
BUILD_DIR=$(COMPONENT_BUILD_DIR)/mkespfsimage \
CC=$(HOSTCC)
endif # CONFIG_AHTTPD_ENABLE_ESPFS
endif