Fix for x86_64 build fail
[platform/upstream/connectedhomeip.git] / examples / all-clusters-app / esp32 / Makefile
1 #
2 #    Copyright (c) 2020 Project CHIP Authors
3 #    All rights reserved.
4 #
5 #    Licensed under the Apache License, Version 2.0 (the "License");
6 #    you may not use this file except in compliance with the License.
7 #    You may obtain a copy of the License at
8 #
9 #        http://www.apache.org/licenses/LICENSE-2.0
10 #
11 #    Unless required by applicable law or agreed to in writing, software
12 #    distributed under the License is distributed on an "AS IS" BASIS,
13 #    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 #    See the License for the specific language governing permissions and
15 #    limitations under the License.
16
17 #
18 # This is a project Makefile. It is assumed the directory this Makefile resides in is a
19 # project subdirectory.
20 #
21
22 PROJECT_NAME := chip-all-clusters-app
23
24 # The list of extra component dirs must be in sync with that in all-clusters-app/esp32/CMakeLists.txt
25 EXTRA_COMPONENT_DIRS += $(PROJECT_PATH)/third_party/connectedhomeip/config/esp32/components \
26                         $(PROJECT_PATH)/../../common/m5stack-tft/repo/components \
27                         $(PROJECT_PATH)/../../common/QRCode \
28                         $(PROJECT_PATH)/../../common/screen-framework \
29
30 CXXFLAGS += -std=c++14 -Os -DLWIP_IPV6_SCOPES=0
31 CPPFLAGS += -Os -DLWIP_IPV6_SCOPES=0 -DCHIP_HAVE_CONFIG_H
32 CFLAGS += -Os -DLWIP_IPV6_SCOPES=0
33
34 top: all flashing_script
35
36 include $(IDF_PATH)/make/project.mk
37
38 FLASHING_SCRIPT=$(BUILD_DIR_BASE)/$(PROJECT_NAME).flash.py
39
40 # Describes what files are required to be bundled in a package for self-contained
41 # flashing support
42 #
43 # NOTE: ESP32 still depends on $IDF_PATH being set
44 FLASHING_BUNDLE=$(BUILD_DIR_BASE)/$(PROJECT_NAME).flashbundle.txt
45
46 $(FLASHING_SCRIPT): $(APP_BIN) $(BOOTLOADER_BIN) $(PARTITION_TABLE_BIN) $(PROJECT_PATH)/sdkconfig
47         @third_party/connectedhomeip/scripts/flashing/gen_flashing_script.py esp32 \
48           --output $(BUILD_DIR_BASE)/$(PROJECT_NAME).flash.py \
49           --port $(ESPPORT) --baud $(ESPBAUD) --before $(CONFIG_ESPTOOLPY_BEFORE) --after $(CONFIG_ESPTOOLPY_AFTER) \
50           --application $(subst $(BUILD_DIR_BASE)/,,$(APP_BIN)) \
51           --bootloader $(subst $(BUILD_DIR_BASE)/,,$(BOOTLOADER_BIN)) \
52           --partition $(subst $(BUILD_DIR_BASE)/,,$(PARTITION_TABLE_BIN)) \
53           --use-partition-file $(PARTITION_TABLE_BIN) \
54           --use-parttool $(IDF_PATH)/components/partition_table/parttool.py \
55           --use-sdkconfig $(PROJECT_PATH)/sdkconfig
56
57 $(FLASHING_BUNDLE):
58         echo "$(subst $(BUILD_DIR_BASE)/,,$(FLASHING_SCRIPT))" >$@
59         echo "esp32_firmware_utils.py" >> $@
60         echo "firmware_utils.py" >>$@
61         echo "$(subst $(BUILD_DIR_BASE)/,,$(APP_BIN))" >>$@
62         echo "$(subst $(BUILD_DIR_BASE)/,,$(BOOTLOADER_BIN))" >>$@
63         echo "$(subst $(BUILD_DIR_BASE)/,,$(PARTITION_TABLE_BIN))" >>$@
64
65 flashing_script: $(FLASHING_SCRIPT) $(BUILD_DIR_BASE)/esp32_firmware_utils.py $(BUILD_DIR_BASE)/firmware_utils.py  $(FLASHING_BUNDLE)
66         @echo To flash $(subst $(CURDIR)/,,$(APP_BIN)), run $(subst $(CURDIR)/,,$(FLASHING_SCRIPT))
67
68 $(BUILD_DIR_BASE)/esp32_firmware_utils.py: third_party/connectedhomeip/scripts/flashing/esp32_firmware_utils.py
69         @cp $< $@
70
71 $(BUILD_DIR_BASE)/firmware_utils.py: third_party/connectedhomeip/scripts/flashing/firmware_utils.py
72         @cp $< $@
73
74 .PHONY: flashing_script