From 1570a1f59bc89e8b4de167ae804737d94d356b8a Mon Sep 17 00:00:00 2001 From: Dong Heng Date: Sun, 8 Apr 2018 17:42:40 +0800 Subject: [PATCH] feat(example): Modify mqtt example for new make --- components/mqtt/Makefile.projbuild | 1 + examples/mqtt_demo/Makefile | 122 +---------- examples/mqtt_demo/gen_misc.sh | 191 ------------------ examples/mqtt_demo/{user => main}/MQTTEcho.c | 0 examples/mqtt_demo/main/component.mk | 5 + .../mqtt_demo/{include => main}/user_config.h | 0 examples/mqtt_demo/{user => main}/user_main.c | 0 examples/mqtt_demo/user/Makefile | 44 ---- 8 files changed, 10 insertions(+), 353 deletions(-) create mode 100644 components/mqtt/Makefile.projbuild delete mode 100755 examples/mqtt_demo/gen_misc.sh rename examples/mqtt_demo/{user => main}/MQTTEcho.c (100%) create mode 100644 examples/mqtt_demo/main/component.mk rename examples/mqtt_demo/{include => main}/user_config.h (100%) rename examples/mqtt_demo/{user => main}/user_main.c (100%) delete mode 100644 examples/mqtt_demo/user/Makefile diff --git a/components/mqtt/Makefile.projbuild b/components/mqtt/Makefile.projbuild new file mode 100644 index 00000000..f18d5785 --- /dev/null +++ b/components/mqtt/Makefile.projbuild @@ -0,0 +1 @@ +CPPFLAGS += -DMQTT_TASK diff --git a/examples/mqtt_demo/Makefile b/examples/mqtt_demo/Makefile index a1dd8f1a..1f8b23b5 100644 --- a/examples/mqtt_demo/Makefile +++ b/examples/mqtt_demo/Makefile @@ -1,123 +1,9 @@ -############################################################# -# Required variables for each makefile -# Discard this section from all parent makefiles -# Expected variables (with automatic defaults): -# CSRCS (all "C" files in the dir) -# SUBDIRS (all subdirs with a Makefile) -# GEN_LIBS - list of libs to be generated () -# GEN_IMAGES - list of object file images to be generated () -# GEN_BINS - list of binaries to be generated () -# COMPONENTS_xxx - a list of libs/objs in the form -# subdir/lib to be extracted and rolled up into -# a generated lib/image xxx.a () # -TARGET = eagle -#FLAVOR = release -FLAVOR = debug - -#EXTRA_CCFLAGS += -u - -ifndef PDIR # { -GEN_IMAGES= eagle.app.v6.out -GEN_BINS= eagle.app.v6.bin -SPECIAL_MKTARGETS=$(APP_MKTARGETS) -SUBDIRS= \ - user - -endif # } PDIR - -LDDIR = $(SDK_PATH)/ld - -CCFLAGS += -Os - -TARGET_LDFLAGS = \ - -nostdlib \ - -Wl,-EL \ - --longcalls \ - --text-section-literals - -ifeq ($(FLAVOR),debug) - TARGET_LDFLAGS += -g -O2 -endif - -ifeq ($(FLAVOR),release) - TARGET_LDFLAGS += -g -O0 -endif - -COMPONENTS_eagle.app.v6 = \ - user/libuser.a - -LINKFLAGS_eagle.app.v6 = \ - -L$(SDK_PATH)/lib \ - -Wl,--gc-sections \ - -nostdlib \ - -T$(LD_FILE) \ - -Wl,--no-check-sections \ - -u call_user_start \ - -Wl,-static \ - -Wl,--start-group \ - -lcirom \ - -lgcc \ - -lhal \ - -lcrypto \ - -lfreertos \ - -llwip \ - -lmain \ - -lnet80211 \ - -lphy \ - -lpp \ - -lmbedtls \ - -lopenssl \ - -lmqtt \ - -lwpa \ - $(DEP_LIBS_eagle.app.v6)\ - -Wl,--end-group - -DEPENDS_eagle.app.v6 = \ - $(LD_FILE) \ - $(LDDIR)/eagle.rom.addr.v6.ld - -############################################################# -# Configuration i.e. compile options etc. -# Target specific stuff (defines etc.) goes in here! -# Generally values applying to a tree are captured in the -# makefile at its root level - these are then overridden -# for a subtree within the makefile rooted therein +# This is a project Makefile. It is assumed the directory this Makefile resides in is a +# project subdirectory. # -#UNIVERSAL_TARGET_DEFINES = \ +PROJECT_NAME := mqtt_demo -# Other potential configuration flags include: -# -DTXRX_TXBUF_DEBUG -# -DTXRX_RXBUF_DEBUG -# -DWLAN_CONFIG_CCX -# -DMQTT_TASK: Define MQTT_TASK to enable MQTT start background -# thread for a client. -CONFIGURATION_DEFINES = -DICACHE_FLASH -DMQTT_TASK - -DEFINES += \ - $(UNIVERSAL_TARGET_DEFINES) \ - $(CONFIGURATION_DEFINES) - -DDEFINES += \ - $(UNIVERSAL_TARGET_DEFINES) \ - $(CONFIGURATION_DEFINES) - - -############################################################# -# Recursion Magic - Don't touch this!! -# -# Each subtree potentially has an include directory -# corresponding to the common APIs applicable to modules -# rooted at that subtree. Accordingly, the INCLUDE PATH -# of a module can only contain the include directories up -# its parent path, and not its siblings -# -# Required for each makefile to inherit from the parent -# -INCLUDES := $(INCLUDES) -I $(PDIR)include -sinclude $(SDK_PATH)/Makefile - -.PHONY: FORCE -FORCE: +include $(IDF_PATH)/make/project.mk diff --git a/examples/mqtt_demo/gen_misc.sh b/examples/mqtt_demo/gen_misc.sh deleted file mode 100755 index 11bd9d0c..00000000 --- a/examples/mqtt_demo/gen_misc.sh +++ /dev/null @@ -1,191 +0,0 @@ -#!/bin/bash - -:<