Ben Delarre | 3db1ce0 | 2017-11-11 17:18:59 -0800 | [diff] [blame] | 1 | COMPONENT_DEPENDS := mbedtls openssl |
| 2 | #COMPONENT_ADD_INCLUDEDIRS := ../../../../../../../../../../../../../../../../../../../../$(COMPONENT_BUILD_DIR)/include |
Andy Green | c7c4ae0 | 2017-02-18 17:26:40 +0800 | [diff] [blame] | 3 | |
Ben Delarre | 3db1ce0 | 2017-11-11 17:18:59 -0800 | [diff] [blame] | 4 | COMPONENT_OWNBUILDTARGET := 1 |
Andy Green | c7c4ae0 | 2017-02-18 17:26:40 +0800 | [diff] [blame] | 5 | |
Ben Delarre | 3db1ce0 | 2017-11-11 17:18:59 -0800 | [diff] [blame] | 6 | CROSS_PATH1 := $(shell which xtensa-esp32-elf-gcc ) |
| 7 | CROSS_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 |
| 12 | MSYS_VERSION = $(if $(findstring Msys, $(shell uname -o)),$(word 1, $(subst ., ,$(shell uname -r))),0) |
| 13 | ifneq ($(MSYS_VERSION),0) |
| 14 | MSYS_FLAGS = -DLWS_WITH_BUNDLED_ZLIB=0 -DEXECUTABLE_EXT=.exe -G'MSYS Makefiles' |
| 15 | endif |
Andy Green | c7c4ae0 | 2017-02-18 17:26:40 +0800 | [diff] [blame] | 16 | |
Andy Green | 79d2038 | 2017-11-05 14:28:57 +0800 | [diff] [blame] | 17 | # -DNDEBUG=1 after cflags stops debug etc being built |
Andy Green | c7c4ae0 | 2017-02-18 17:26:40 +0800 | [diff] [blame] | 18 | .PHONY: build |
| 19 | build: |
| 20 | cd $(COMPONENT_BUILD_DIR) ; \ |
| 21 | echo "doing lws cmake" ; \ |
Andy Green | d58d749 | 2017-11-26 09:22:42 +0800 | [diff] [blame] | 22 | cmake $(COMPONENT_PATH) -DLWS_C_FLAGS="$(CFLAGS) -DNDEBUG=1" \ |
Andy Green | 00ae909 | 2017-03-16 10:46:31 +0800 | [diff] [blame] | 23 | -DIDF_PATH=$(IDF_PATH) \ |
Andy Green | c7c4ae0 | 2017-02-18 17:26:40 +0800 | [diff] [blame] | 24 | -DCROSS_PATH=$(CROSS_PATH) \ |
Andy Green | e0572d3 | 2017-03-10 14:29:21 +0800 | [diff] [blame] | 25 | -DBUILD_DIR_BASE=$(BUILD_DIR_BASE) \ |
Andy Green | 4f267c5 | 2017-09-22 09:46:58 +0800 | [diff] [blame] | 26 | -DCMAKE_TOOLCHAIN_FILE=$(COMPONENT_PATH)/contrib/cross-esp32.cmake \ |
Andy Green | d58d749 | 2017-11-26 09:22:42 +0800 | [diff] [blame] | 27 | -DCMAKE_BUILD_TYPE=RELEASE \ |
negativekelvin | bd9c1b7 | 2018-06-16 08:53:48 -0700 | [diff] [blame] | 28 | -DLWS_MBEDTLS_INCLUDE_DIRS="${IDF_PATH}/components/openssl/include;${IDF_PATH}/components/mbedtls/mbedtls/include;${IDF_PATH}/components/mbedtls/port/include" \ |
Andy Green | 978605b | 2017-05-30 09:01:32 +0800 | [diff] [blame] | 29 | -DLWS_WITH_STATS=0 \ |
Andy Green | 904a9c0 | 2017-10-13 10:33:02 +0800 | [diff] [blame] | 30 | -DLWS_WITH_HTTP2=1 \ |
Andy Green | 5b74d71 | 2017-11-14 11:25:54 +0800 | [diff] [blame] | 31 | -DLWS_WITH_RANGES=1 \ |
Ben Delarre | 3db1ce0 | 2017-11-11 17:18:59 -0800 | [diff] [blame] | 32 | -DLWS_WITH_ACME=1 \ |
Andy Green | 5b74d71 | 2017-11-14 11:25:54 +0800 | [diff] [blame] | 33 | -DLWS_WITH_ZLIB=1 \ |
| 34 | -DLWS_WITH_ZIP_FOPS=1 \ |
Andy Green | 00ae909 | 2017-03-16 10:46:31 +0800 | [diff] [blame] | 35 | -DZLIB_LIBRARY=$(BUILD_DIR_BASE)/zlib/libzlib.a \ |
| 36 | -DZLIB_INCLUDE_DIR=$(COMPONENT_PATH)/../zlib \ |
Ben Delarre | 3db1ce0 | 2017-11-11 17:18:59 -0800 | [diff] [blame] | 37 | -DLWS_WITH_ESP32=1 \ |
| 38 | $(MSYS_FLAGS) ; \ |
Andy Green | 00ae909 | 2017-03-16 10:46:31 +0800 | [diff] [blame] | 39 | make && \ |
Andy Green | c7c4ae0 | 2017-02-18 17:26:40 +0800 | [diff] [blame] | 40 | cp ${COMPONENT_BUILD_DIR}/lib/libwebsockets.a ${COMPONENT_BUILD_DIR}/liblibwebsockets.a |
| 41 | |
| 42 | clean: myclean |
| 43 | |
| 44 | myclean: |
| 45 | rm -rf ./build |