1COMPONENT_DEPENDS := mbedtls openssl 2#COMPONENT_ADD_INCLUDEDIRS := ../../../../../../../../../../../../../../../../../../../../$(COMPONENT_BUILD_DIR)/include 3 4COMPONENT_OWNBUILDTARGET := 1 5 6CROSS_PATH1 := $(shell which xtensa-esp32-elf-gcc ) 7CROSS_PATH := $(shell dirname $(CROSS_PATH1) )/.. 8 9# detect MSYS2 environment and set generator flag if found 10# also set executable extension to .exe so that tools can be properly found 11# and disable bundled zlib 12MSYS_VERSION = $(if $(findstring Msys, $(shell uname -o)),$(word 1, $(subst ., ,$(shell uname -r))),0) 13ifneq ($(MSYS_VERSION),0) 14 MSYS_FLAGS = -DLWS_WITH_BUNDLED_ZLIB=0 -DEXECUTABLE_EXT=.exe -G'MSYS Makefiles' 15endif 16 17# -DNDEBUG=1 after cflags stops debug etc being built 18.PHONY: build 19build: 20 cd $(COMPONENT_BUILD_DIR) ; \ 21 echo "doing lws cmake" ; \ 22 cmake $(COMPONENT_PATH) -DLWS_C_FLAGS="$(CFLAGS) -DNDEBUG=1" \ 23 -DIDF_PATH=$(IDF_PATH) \ 24 -DCROSS_PATH=$(CROSS_PATH) \ 25 -DBUILD_DIR_BASE=$(BUILD_DIR_BASE) \ 26 -DCMAKE_TOOLCHAIN_FILE=$(COMPONENT_PATH)/contrib/cross-esp32.cmake \ 27 -DCMAKE_BUILD_TYPE=RELEASE \ 28 -DLWS_MBEDTLS_INCLUDE_DIRS="${IDF_PATH}/components/openssl/include;${IDF_PATH}/components/mbedtls/mbedtls/include;${IDF_PATH}/components/mbedtls/port/include" \ 29 -DLWS_WITH_STATS=0 \ 30 -DLWS_WITH_HTTP2=1 \ 31 -DLWS_WITH_RANGES=1 \ 32 -DLWS_WITH_ACME=1 \ 33 -DLWS_WITH_ZLIB=1 \ 34 -DLWS_WITH_ZIP_FOPS=1 \ 35 -DZLIB_LIBRARY=$(BUILD_DIR_BASE)/zlib/libzlib.a \ 36 -DZLIB_INCLUDE_DIR=$(COMPONENT_PATH)/../zlib \ 37 -DLWS_WITH_ESP32=1 \ 38 $(MSYS_FLAGS) ; \ 39 make && \ 40 cp ${COMPONENT_BUILD_DIR}/lib/libwebsockets.a ${COMPONENT_BUILD_DIR}/liblibwebsockets.a 41 42clean: myclean 43 44myclean: 45 rm -rf ./build 46