diff --git a/arch/Makefile b/arch/Makefile new file mode 100644 index 00000000..e447b0ac --- /dev/null +++ b/arch/Makefile @@ -0,0 +1,47 @@ +################################################################### +#automatic detection QTOP and LOCALDIR +CUR_DIR := $(patsubst %/,%,$(dir $(realpath $(firstword $(MAKEFILE_LIST))))) +TRYQTOP := $(shell if [ -n "$$QTOP" ] ; then\ + echo $$QTOP;\ + else\ + cd $(CUR_DIR); while /usr/bin/test ! -d qmk ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find QTOP in $(firstword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) +QTOP ?= $(realpath ${TRYQTOP}) + +ifeq ($(QTOP),) +$(error Please run this in a tree) +endif +LOCALDIR = $(patsubst %/,%,$(subst $(realpath $(QTOP))/,,$(CUR_DIR))) + +#################################################################### + + +TREE_LIB_ENABLE=0 +lib= +subdirs= +ifneq (help,$(findstring help,$(MAKECMDGOALS))) + +ifeq (, $(strip ${BP})) +$(error when compile arch/, must specify BP and ARCH_LSRCS obviously , see `make help`) +endif + +include ${QTOP}/qmk/board-pack/bp.${BP} + +ifeq (,$(strip ${ARCH_LSCRS})) +$(error when compile arch/, must specify BP and ARCH_LSRCS obviously , see `make help`) +endif +endif + +# arch src should be specify by bp +LSRCS:=$(subst $(QTOP)/$(LOCALDIR)/,, ${ARCH_LSCRS}) +include ${QTOP}/qmk/generic/Make.tpl + + diff --git a/board/Linux_Posix/hello_world/Makefile b/board/Linux_Posix/hello_world/Makefile new file mode 100644 index 00000000..14ee3ad2 --- /dev/null +++ b/board/Linux_Posix/hello_world/Makefile @@ -0,0 +1,49 @@ +################################################################### +#automatic detection QTOP and LOCALDIR +CUR_DIR := $(patsubst %/,%,$(dir $(realpath $(firstword $(MAKEFILE_LIST))))) +TRYQTOP := $(shell if [ -n "$$QTOP" ] ; then\ + echo $$QTOP;\ + else\ + cd $(CUR_DIR); while /usr/bin/test ! -e qmk ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find QTOP in $(firstword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) +QTOP ?= $(realpath ${TRYQTOP}) + +ifeq ($(QTOP),) +$(error Please run this in a tree) +endif +LOCALDIR = $(patsubst %/,%,$(subst $(realpath $(QTOP))/,,$(CUR_DIR))) + +#################################################################### + + +export BP=Linux_Posix + +TREE_LIB_ENABLE=1 +lib= +subdirs = + +include ${QTOP}/qmk/generic/Make.tpl + +all:: + make -C ${QTOP}/arch + make -C ${QTOP}/kernel + make -C ${QTOP}/osal + make -C ${QTOP}/net + make -C ${QTOP}/devices +exec = +LD_A_FILES += $(LIBDIR)/libarch.a +LD_A_FILES += $(LIBDIR)/libkernel.a +LD_A_FILES += $(LIBDIR)/libhello_world.a +LD_A_FILES += $(LIBDIR)/libcmsis_os.a +LDFLAGS += -lpthread +include ${QTOP}/qmk/generic/Make.exec + + diff --git a/components/Makefile b/components/Makefile new file mode 100644 index 00000000..821b1c51 --- /dev/null +++ b/components/Makefile @@ -0,0 +1,33 @@ +################################################################### +#automatic detection QTOP and LOCALDIR +CUR_DIR := $(patsubst %/,%,$(dir $(realpath $(firstword $(MAKEFILE_LIST))))) +TRYQTOP := $(shell if [ -n "$$QTOP" ] ; then\ + echo $$QTOP;\ + else\ + cd $(CUR_DIR); while /usr/bin/test ! -d qmk ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find QTOP in $(firstword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) +QTOP ?= $(realpath ${TRYQTOP}) + +ifeq ($(QTOP),) +$(error Please run this in a tree) +endif +LOCALDIR = $(patsubst %/,%,$(subst $(realpath $(QTOP))/,,$(CUR_DIR))) + +#################################################################### + + +TREE_LIB_ENABLE=0 +lib= +subdirs= + +include ${QTOP}/qmk/generic/Make.tpl + + diff --git a/components/connectivity/Bluetooth_5.0/Makefile b/components/connectivity/Bluetooth_5.0/Makefile new file mode 100644 index 00000000..e9635436 --- /dev/null +++ b/components/connectivity/Bluetooth_5.0/Makefile @@ -0,0 +1,50 @@ +################################################################### +#automatic detection QTOP and LOCALDIR +CUR_DIR := $(patsubst %/,%,$(dir $(realpath $(firstword $(MAKEFILE_LIST))))) +TRYQTOP := $(shell if [ -n "$$QTOP" ] ; then\ + echo $$QTOP;\ + else\ + cd $(CUR_DIR); while /usr/bin/test ! -d qmk ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find QTOP in $(firstword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) +QTOP ?= $(realpath ${TRYQTOP}) + +ifeq ($(QTOP),) +$(error Please run this in a tree) +endif +LOCALDIR = $(patsubst %/,%,$(subst $(realpath $(QTOP))/,,$(CUR_DIR))) + +#################################################################### + + +TREE_LIB_ENABLE=y +lib= +subdirs= + +CFGFLAGS += -std=c99 +CFGFLAGS += -I$(CUR_DIR)/3rdparty/NimBLE_1_2_0/nimble/include +CFGFLAGS += -I$(CUR_DIR)/3rdparty/NimBLE_1_2_0/nimble/controller/include +CFGFLAGS += -I$(CUR_DIR)/3rdparty/NimBLE_1_2_0/nimble/drivers/native/include +CFGFLAGS += -I$(CUR_DIR)/3rdparty/NimBLE_1_2_0/nimble/controller/include +CFGFLAGS += -I$(CUR_DIR)/3rdparty/NimBLE_1_2_0/ext/tinycrypt/include +CFGFLAGS += -I$(CUR_DIR)/3rdparty/NimBLE_1_2_0/porting/nimble/include +CFGFLAGS += -I$(CUR_DIR)/porting/TencentOS_tiny/include +CFGFLAGS += -I$(CUR_DIR)/porting/TencentOS_tiny/include/nrf52832 + +LSRCS_DIRS += 3rdparty/NimBLE_1_2_0/ext +LSRCS_DIRS += 3rdparty/NimBLE_1_2_0/nimble + +LSRCS_EXCLUDE_FILES = $(wildcard 3rdparty/NimBLE_1_2_0/nimble/controller/test/src/*.c) +LSRCS_EXCLUDE_FILES += $(wildcard 3rdparty/NimBLE_1_2_0/nimble/drivers/nrf52/*) +LSRCS_EXCLUDE_FILES += $(wildcard 3rdparty/NimBLE_1_2_0/nimble/drivers/nrf51/*) + +include ${QTOP}/qmk/generic/Make.tpl + + diff --git a/components/connectivity/Modbus/Makefile b/components/connectivity/Modbus/Makefile new file mode 100644 index 00000000..b524bbde --- /dev/null +++ b/components/connectivity/Modbus/Makefile @@ -0,0 +1,42 @@ +################################################################### +#automatic detection QTOP and LOCALDIR +CUR_DIR := $(patsubst %/,%,$(dir $(realpath $(firstword $(MAKEFILE_LIST))))) +TRYQTOP := $(shell if [ -n "$$QTOP" ] ; then\ + echo $$QTOP;\ + else\ + cd $(CUR_DIR); while /usr/bin/test ! -d qmk ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find QTOP in $(firstword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) +QTOP ?= $(realpath ${TRYQTOP}) + +ifeq ($(QTOP),) +$(error Please run this in a tree) +endif +LOCALDIR = $(patsubst %/,%,$(subst $(realpath $(QTOP))/,,$(CUR_DIR))) + +#################################################################### + + +TREE_LIB_ENABLE=y +lib= +subdirs= + +CFGFLAGS += -std=c99 +CFGFLAGS += -I$(CUR_DIR)/porting/TencentOS_Tiny +CFGFLAGS += -I$(CUR_DIR)/3rdparty/freemodbus-v1.6/modbus/include +CFGFLAGS += -I$(CUR_DIR)/3rdparty/freemodbus-v1.6/modbus/rtu +CFGFLAGS += -I$(CUR_DIR)/3rdparty/freemodbus-v1.6/modbus/ascii + +LSRCS_DIRS += 3rdparty/freemodbus-v1.6/modbus + + +include ${QTOP}/qmk/generic/Make.tpl + + diff --git a/components/connectivity/iotkit-embedded-3.0.1/Makefile b/components/connectivity/iotkit-embedded-3.0.1/Makefile new file mode 100644 index 00000000..d77f237a --- /dev/null +++ b/components/connectivity/iotkit-embedded-3.0.1/Makefile @@ -0,0 +1,42 @@ +################################################################### +#automatic detection QTOP and LOCALDIR +CUR_DIR := $(patsubst %/,%,$(dir $(realpath $(firstword $(MAKEFILE_LIST))))) +TRYQTOP := $(shell if [ -n "$$QTOP" ] ; then\ + echo $$QTOP;\ + else\ + cd $(CUR_DIR); while /usr/bin/test ! -d qmk ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find QTOP in $(firstword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) +QTOP ?= $(realpath ${TRYQTOP}) + +ifeq ($(QTOP),) +$(error Please run this in a tree) +endif +LOCALDIR = $(patsubst %/,%,$(subst $(realpath $(QTOP))/,,$(CUR_DIR))) + +#################################################################### + + +TREE_LIB_ENABLE=y +lib= +subdirs= + +#CFGFLAGS += -std=c99 + +#LSRCS_DIRS += 3rdparty/NimBLE_1_2_0/ext +#LSRCS_DIRS += 3rdparty/NimBLE_1_2_0/nimble + +#LSRCS_EXCLUDE_FILES = $(wildcard 3rdparty/NimBLE_1_2_0/nimble/controller/test/src/*.c) +#LSRCS_EXCLUDE_FILES += $(wildcard 3rdparty/NimBLE_1_2_0/nimble/drivers/nrf52/*) +#LSRCS_EXCLUDE_FILES += $(wildcard 3rdparty/NimBLE_1_2_0/nimble/drivers/nrf51/*) + +include ${QTOP}/qmk/generic/Make.tpl + + diff --git a/components/connectivity/mqttclient/Makefile b/components/connectivity/mqttclient/Makefile new file mode 100644 index 00000000..63ba849e --- /dev/null +++ b/components/connectivity/mqttclient/Makefile @@ -0,0 +1,39 @@ +################################################################### +#automatic detection QTOP and LOCALDIR +CUR_DIR := $(patsubst %/,%,$(dir $(realpath $(firstword $(MAKEFILE_LIST))))) +TRYQTOP := $(shell if [ -n "$$QTOP" ] ; then\ + echo $$QTOP;\ + else\ + cd $(CUR_DIR); while /usr/bin/test ! -d qmk ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find QTOP in $(firstword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) +QTOP ?= $(realpath ${TRYQTOP}) + +ifeq ($(QTOP),) +$(error Please run this in a tree) +endif +LOCALDIR = $(patsubst %/,%,$(subst $(realpath $(QTOP))/,,$(CUR_DIR))) + +#################################################################### + + +TREE_LIB_ENABLE=y +lib= +subdirs= + +SUBDIRS_FIND=$(patsubst ./%,%,$(shell find . -type d)) +CFGFLAGS += -std=c99 +CFGFLAGS += -DSALOF_USING_TENCENTOS +CFGFLAGS += $(addprefix -I$(CUR_DIR)/, $(SUBDIRS_FIND)) + + +include ${QTOP}/qmk/generic/Make.tpl + + diff --git a/components/connectivity/qcloud-iot-hub-sdk/3rdparty/tools/build_scripts/parse_make_settings.mk b/components/connectivity/qcloud-iot-hub-sdk/3rdparty/tools/build_scripts/parse_make_settings.mk index b1d20107..df487b7e 100644 --- a/components/connectivity/qcloud-iot-hub-sdk/3rdparty/tools/build_scripts/parse_make_settings.mk +++ b/components/connectivity/qcloud-iot-hub-sdk/3rdparty/tools/build_scripts/parse_make_settings.mk @@ -1,4 +1,4 @@ -include $(SCRIPT_DIR)/internal_make_funcs.mk +-include $(SCRIPT_DIR)/internal_make_funcs.mk SETTING_VARS := \ BUILD_TYPE \ diff --git a/components/connectivity/qcloud-iot-hub-sdk/Makefile b/components/connectivity/qcloud-iot-hub-sdk/Makefile new file mode 100644 index 00000000..ec00b1d1 --- /dev/null +++ b/components/connectivity/qcloud-iot-hub-sdk/Makefile @@ -0,0 +1,50 @@ +################################################################### +#automatic detection QTOP and LOCALDIR +CUR_DIR := $(realpath $(dir $(realpath $(firstword $(MAKEFILE_LIST))))) +TRYQTOP := $(shell if [ -n "$$QTOP" ] ; then\ + echo $$QTOP;\ + else\ + cd $(CUR_DIR); while /usr/bin/test ! -d qmk ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find QTOP in $(firstword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) +QTOP ?= $(realpath ${TRYQTOP}) + +ifeq ($(QTOP),) +$(error Please run this in a tree) +endif +LOCALDIR = $(patsubst %/,%,$(subst $(realpath $(QTOP))/,,$(CUR_DIR))) + +#################################################################### + + +TREE_LIB_ENABLE=1 +lib= +subdirs= + +CFGFLAGS += -I$(CUR_DIR)/3rdparty/include +CFGFLAGS += -I$(CUR_DIR)/3rdparty/include/exports +CFGFLAGS += -I$(CUR_DIR)/3rdparty/platform/at_device/esp8266 +CFGFLAGS += -I$(CUR_DIR)/3rdparty/sdk_src/internal_inc +CFGFLAGS += -I$(CUR_DIR)/3rdparty/external_libs/mbedtls/include +#CFGFLAGS += -Werror +CFGFLAGS += -Wall -Wno-error=sign-compare -Wno-error=format -Os -pthread -DFORCE_SSL_VERIFY + +#包含需要排除plaform/os的.c源码文件, 故自定义LSRC +LSRCS_EXCLUDE := $(sort $(shell find 3rdparty/platform/os -name "*.c" -o -name "*.cpp" -o -name "*.s" -o -name "*.cc" -o -name "*.C")) +LSRCS_EXCLUDE += $(sort $(shell find 3rdparty/samples -name "*.c" -o -name "*.cpp" -o -name "*.s" -o -name "*.cc" -o -name "*.C")) + +#SCRIPT_DIR=$(CUR_DIR)/3rdparty/tools/build_scripts/ +#include $(CUR_DIR)/3rdparty/make.settings +#include $(CUR_DIR)/3rdparty/tools/build_scripts/parse_make_settings.mk + + +include ${QTOP}/qmk/generic/Make.tpl + + diff --git a/components/elfloader/Makefile b/components/elfloader/Makefile new file mode 100644 index 00000000..0b79cebc --- /dev/null +++ b/components/elfloader/Makefile @@ -0,0 +1,36 @@ +################################################################### +#automatic detection QTOP and LOCALDIR +CUR_DIR := $(patsubst %/,%,$(dir $(realpath $(firstword $(MAKEFILE_LIST))))) +TRYQTOP := $(shell if [ -n "$$QTOP" ] ; then\ + echo $$QTOP;\ + else\ + cd $(CUR_DIR); while /usr/bin/test ! -d qmk ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find QTOP in $(firstword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) +QTOP ?= $(realpath ${TRYQTOP}) + +ifeq ($(QTOP),) +$(error Please run this in a tree) +endif +LOCALDIR = $(patsubst %/,%,$(subst $(realpath $(QTOP))/,,$(CUR_DIR))) + +#################################################################### + + +TREE_LIB_ENABLE=y +lib= +subdirs= + +CFGFLAGS += -I$(QTOP)/components/fs/vfs/include +CFGFLAGS += -I$(CUR_DIR)/common/include + +include ${QTOP}/qmk/generic/Make.tpl + + diff --git a/components/encoding/Makefile b/components/encoding/Makefile new file mode 100644 index 00000000..32b57aa0 --- /dev/null +++ b/components/encoding/Makefile @@ -0,0 +1,35 @@ +################################################################### +#automatic detection QTOP and LOCALDIR +CUR_DIR := $(patsubst %/,%,$(dir $(realpath $(firstword $(MAKEFILE_LIST))))) +TRYQTOP := $(shell if [ -n "$$QTOP" ] ; then\ + echo $$QTOP;\ + else\ + cd $(CUR_DIR); while /usr/bin/test ! -d qmk ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find QTOP in $(firstword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) +QTOP ?= $(realpath ${TRYQTOP}) + +ifeq ($(QTOP),) +$(error Please run this in a tree) +endif +LOCALDIR = $(patsubst %/,%,$(subst $(realpath $(QTOP))/,,$(CUR_DIR))) + +#################################################################### + + +TREE_LIB_ENABLE=y +lib= +subdirs= + +CFGFLAGS += -I$(CUR_DIR)/base64/include + +include ${QTOP}/qmk/generic/Make.tpl + + diff --git a/components/fs/Makefile b/components/fs/Makefile new file mode 100644 index 00000000..13187206 --- /dev/null +++ b/components/fs/Makefile @@ -0,0 +1,37 @@ +################################################################### +#automatic detection QTOP and LOCALDIR +CUR_DIR := $(patsubst %/,%,$(dir $(realpath $(firstword $(MAKEFILE_LIST))))) +TRYQTOP := $(shell if [ -n "$$QTOP" ] ; then\ + echo $$QTOP;\ + else\ + cd $(CUR_DIR); while /usr/bin/test ! -d qmk ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find QTOP in $(firstword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) +QTOP ?= $(realpath ${TRYQTOP}) + +ifeq ($(QTOP),) +$(error Please run this in a tree) +endif +LOCALDIR = $(patsubst %/,%,$(subst $(realpath $(QTOP))/,,$(CUR_DIR))) + +#################################################################### + + +TREE_LIB_ENABLE=y +lib= +subdirs= + +CFGFLAGS += -I$(QTOP)/components/fs/fatfs/wrapper/include +CFGFLAGS += -I$(QTOP)/components/fs/vfs/include +CFGFLAGS += -I$(QTOP)/components/fs/kv/include + +include ${QTOP}/qmk/generic/Make.tpl + + diff --git a/components/gui/Makefile b/components/gui/Makefile new file mode 100644 index 00000000..41d59def --- /dev/null +++ b/components/gui/Makefile @@ -0,0 +1,35 @@ +################################################################### +#automatic detection QTOP and LOCALDIR +CUR_DIR := $(patsubst %/,%,$(dir $(realpath $(firstword $(MAKEFILE_LIST))))) +TRYQTOP := $(shell if [ -n "$$QTOP" ] ; then\ + echo $$QTOP;\ + else\ + cd $(CUR_DIR); while /usr/bin/test ! -d qmk ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find QTOP in $(firstword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) +QTOP ?= $(realpath ${TRYQTOP}) + +ifeq ($(QTOP),) +$(error Please run this in a tree) +endif +LOCALDIR = $(patsubst %/,%,$(subst $(realpath $(QTOP))/,,$(CUR_DIR))) + +#################################################################### + + +TREE_LIB_ENABLE=y +lib= +subdirs= + +CFGFLAGS += -I$(CUR_DIR)/LittlevGL/3rdparty + +include ${QTOP}/qmk/generic/Make.tpl + + diff --git a/components/ota/Makefile b/components/ota/Makefile new file mode 100644 index 00000000..49553cd6 --- /dev/null +++ b/components/ota/Makefile @@ -0,0 +1,47 @@ +################################################################### +#automatic detection QTOP and LOCALDIR +CUR_DIR := $(patsubst %/,%,$(dir $(realpath $(firstword $(MAKEFILE_LIST))))) +TRYQTOP := $(shell if [ -n "$$QTOP" ] ; then\ + echo $$QTOP;\ + else\ + cd $(CUR_DIR); while /usr/bin/test ! -d qmk ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find QTOP in $(firstword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) +QTOP ?= $(realpath ${TRYQTOP}) + +ifeq ($(QTOP),) +$(error Please run this in a tree) +endif +LOCALDIR = $(patsubst %/,%,$(subst $(realpath $(QTOP))/,,$(CUR_DIR))) + +#################################################################### + + +TREE_LIB_ENABLE=y +lib= +subdirs= + +CFGFLAGS += -I$(CUR_DIR)/common/lzma/wrapper +CFGFLAGS += -I$(CUR_DIR)/common/lzma/3rdparty +CFGFLAGS += -I$(CUR_DIR)/common/flash +CFGFLAGS += -I$(CUR_DIR)/common/partition +CFGFLAGS += -I$(CUR_DIR)/common/crc +CFGFLAGS += -I$(CUR_DIR)/common/image +CFGFLAGS += -I$(CUR_DIR)/common/env +CFGFLAGS += -I$(CUR_DIR)/common/info +CFGFLAGS += -I$(CUR_DIR)/common/diff +CFGFLAGS += -I$(CUR_DIR)/recovery/include +CFGFLAGS += -I$(CUR_DIR)/download/include +CFGFLAGS += -I$(QTOP)/components/fs/kv/include +CFGFLAGS += -I$(QTOP)/net/sal_module_wrapper + +include ${QTOP}/qmk/generic/Make.tpl + + diff --git a/components/security/Makefile b/components/security/Makefile new file mode 100644 index 00000000..00d8023f --- /dev/null +++ b/components/security/Makefile @@ -0,0 +1,36 @@ +################################################################### +#automatic detection QTOP and LOCALDIR +CUR_DIR := $(patsubst %/,%,$(dir $(realpath $(firstword $(MAKEFILE_LIST))))) +TRYQTOP := $(shell if [ -n "$$QTOP" ] ; then\ + echo $$QTOP;\ + else\ + cd $(CUR_DIR); while /usr/bin/test ! -d qmk ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find QTOP in $(firstword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) +QTOP ?= $(realpath ${TRYQTOP}) + +ifeq ($(QTOP),) +$(error Please run this in a tree) +endif +LOCALDIR = $(patsubst %/,%,$(subst $(realpath $(QTOP))/,,$(CUR_DIR))) + +#################################################################### + + +TREE_LIB_ENABLE=y +lib= +subdirs= + +CFGFLAGS += -I$(CUR_DIR)/mbedtls/3rdparty/include +CFGFLAGS += -I$(CUR_DIR)/mbedtls/3rdparty/include/mbedtls +CFGFLAGS += -I$(CUR_DIR)/mbedtls/wrapper/include +include ${QTOP}/qmk/generic/Make.tpl + + diff --git a/components/shell/Makefile b/components/shell/Makefile new file mode 100644 index 00000000..65811f3b --- /dev/null +++ b/components/shell/Makefile @@ -0,0 +1,33 @@ +################################################################### +#automatic detection QTOP and LOCALDIR +CUR_DIR := $(patsubst %/,%,$(dir $(realpath $(firstword $(MAKEFILE_LIST))))) +TRYQTOP := $(shell if [ -n "$$QTOP" ] ; then\ + echo $$QTOP;\ + else\ + cd $(CUR_DIR); while /usr/bin/test ! -d qmk ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find QTOP in $(firstword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) +QTOP ?= $(realpath ${TRYQTOP}) + +ifeq ($(QTOP),) +$(error Please run this in a tree) +endif +LOCALDIR = $(patsubst %/,%,$(subst $(realpath $(QTOP))/,,$(CUR_DIR))) + +#################################################################### + + +TREE_LIB_ENABLE=y +lib= +subdirs= + +include ${QTOP}/qmk/generic/Make.tpl + + diff --git a/components/utils/JSON/Makefile b/components/utils/JSON/Makefile new file mode 100644 index 00000000..69305393 --- /dev/null +++ b/components/utils/JSON/Makefile @@ -0,0 +1,35 @@ +################################################################### +#automatic detection QTOP and LOCALDIR +CUR_DIR := $(patsubst %/,%,$(dir $(realpath $(firstword $(MAKEFILE_LIST))))) +TRYQTOP := $(shell if [ -n "$$QTOP" ] ; then\ + echo $$QTOP;\ + else\ + cd $(CUR_DIR); while /usr/bin/test ! -d qmk ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find QTOP in $(firstword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) +QTOP ?= $(realpath ${TRYQTOP}) + +ifeq ($(QTOP),) +$(error Please run this in a tree) +endif +LOCALDIR = $(patsubst %/,%,$(subst $(realpath $(QTOP))/,,$(CUR_DIR))) + +#################################################################### + + +TREE_LIB_ENABLE=y +lib= +subdirs= + +CFGFLAGS += -I$(CUR_DIR)/include + +include ${QTOP}/qmk/generic/Make.tpl + + diff --git a/components/utils/Makefile b/components/utils/Makefile new file mode 100644 index 00000000..821b1c51 --- /dev/null +++ b/components/utils/Makefile @@ -0,0 +1,33 @@ +################################################################### +#automatic detection QTOP and LOCALDIR +CUR_DIR := $(patsubst %/,%,$(dir $(realpath $(firstword $(MAKEFILE_LIST))))) +TRYQTOP := $(shell if [ -n "$$QTOP" ] ; then\ + echo $$QTOP;\ + else\ + cd $(CUR_DIR); while /usr/bin/test ! -d qmk ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find QTOP in $(firstword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) +QTOP ?= $(realpath ${TRYQTOP}) + +ifeq ($(QTOP),) +$(error Please run this in a tree) +endif +LOCALDIR = $(patsubst %/,%,$(subst $(realpath $(QTOP))/,,$(CUR_DIR))) + +#################################################################### + + +TREE_LIB_ENABLE=0 +lib= +subdirs= + +include ${QTOP}/qmk/generic/Make.tpl + + diff --git a/devices/Makefile b/devices/Makefile new file mode 100644 index 00000000..dab511e5 --- /dev/null +++ b/devices/Makefile @@ -0,0 +1,32 @@ +################################################################### +#automatic detection QTOP and LOCALDIR +CUR_DIR := $(patsubst %/,%,$(dir $(realpath $(firstword $(MAKEFILE_LIST))))) +TRYQTOP := $(shell if [ -n "$$QTOP" ] ; then\ + echo $$QTOP;\ + else\ + cd $(CUR_DIR); while /usr/bin/test ! -e qmk ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find QTOP in $(firstword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) +QTOP ?= $(realpath ${TRYQTOP}) + +ifeq ($(QTOP),) +$(error Please run this in a tree) +endif +LOCALDIR = $(patsubst %/,%,$(subst $(realpath $(QTOP))/,,$(CUR_DIR))) +#################################################################### + + +TREE_LIB_ENABLE=0 +lib= +subdirs= + + +include ${QTOP}/qmk/generic/Make.tpl + diff --git a/devices/air724/Makefile b/devices/air724/Makefile new file mode 100644 index 00000000..0ae50fff --- /dev/null +++ b/devices/air724/Makefile @@ -0,0 +1,36 @@ +################################################################### +#automatic detection QTOP and LOCALDIR +CUR_DIR := $(patsubst %/,%,$(dir $(realpath $(firstword $(MAKEFILE_LIST))))) +TRYQTOP := $(shell if [ -n "$$QTOP" ] ; then\ + echo $$QTOP;\ + else\ + cd $(CUR_DIR); while /usr/bin/test ! -d qmk ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find QTOP in $(firstword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) +QTOP ?= $(realpath ${TRYQTOP}) + +ifeq ($(QTOP),) +$(error Please run this in a tree) +endif +LOCALDIR = $(patsubst %/,%,$(subst $(realpath $(QTOP))/,,$(CUR_DIR))) + +#################################################################### + + +TREE_LIB_ENABLE=0 +lib= +subdirs= + +CFGFLAGS += -I$(QTOP)/net/at/include +CFGFLAGS += -I$(QTOP)/net/sal_module_wrapper + +include ${QTOP}/qmk/generic/Make.tpl + + diff --git a/devices/bc26/Makefile b/devices/bc26/Makefile new file mode 100644 index 00000000..0ae50fff --- /dev/null +++ b/devices/bc26/Makefile @@ -0,0 +1,36 @@ +################################################################### +#automatic detection QTOP and LOCALDIR +CUR_DIR := $(patsubst %/,%,$(dir $(realpath $(firstword $(MAKEFILE_LIST))))) +TRYQTOP := $(shell if [ -n "$$QTOP" ] ; then\ + echo $$QTOP;\ + else\ + cd $(CUR_DIR); while /usr/bin/test ! -d qmk ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find QTOP in $(firstword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) +QTOP ?= $(realpath ${TRYQTOP}) + +ifeq ($(QTOP),) +$(error Please run this in a tree) +endif +LOCALDIR = $(patsubst %/,%,$(subst $(realpath $(QTOP))/,,$(CUR_DIR))) + +#################################################################### + + +TREE_LIB_ENABLE=0 +lib= +subdirs= + +CFGFLAGS += -I$(QTOP)/net/at/include +CFGFLAGS += -I$(QTOP)/net/sal_module_wrapper + +include ${QTOP}/qmk/generic/Make.tpl + + diff --git a/devices/bc35_28_95/Makefile b/devices/bc35_28_95/Makefile new file mode 100644 index 00000000..0ae50fff --- /dev/null +++ b/devices/bc35_28_95/Makefile @@ -0,0 +1,36 @@ +################################################################### +#automatic detection QTOP and LOCALDIR +CUR_DIR := $(patsubst %/,%,$(dir $(realpath $(firstword $(MAKEFILE_LIST))))) +TRYQTOP := $(shell if [ -n "$$QTOP" ] ; then\ + echo $$QTOP;\ + else\ + cd $(CUR_DIR); while /usr/bin/test ! -d qmk ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find QTOP in $(firstword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) +QTOP ?= $(realpath ${TRYQTOP}) + +ifeq ($(QTOP),) +$(error Please run this in a tree) +endif +LOCALDIR = $(patsubst %/,%,$(subst $(realpath $(QTOP))/,,$(CUR_DIR))) + +#################################################################### + + +TREE_LIB_ENABLE=0 +lib= +subdirs= + +CFGFLAGS += -I$(QTOP)/net/at/include +CFGFLAGS += -I$(QTOP)/net/sal_module_wrapper + +include ${QTOP}/qmk/generic/Make.tpl + + diff --git a/devices/bc35_28_95_lwm2m/Makefile b/devices/bc35_28_95_lwm2m/Makefile new file mode 100644 index 00000000..0ae50fff --- /dev/null +++ b/devices/bc35_28_95_lwm2m/Makefile @@ -0,0 +1,36 @@ +################################################################### +#automatic detection QTOP and LOCALDIR +CUR_DIR := $(patsubst %/,%,$(dir $(realpath $(firstword $(MAKEFILE_LIST))))) +TRYQTOP := $(shell if [ -n "$$QTOP" ] ; then\ + echo $$QTOP;\ + else\ + cd $(CUR_DIR); while /usr/bin/test ! -d qmk ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find QTOP in $(firstword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) +QTOP ?= $(realpath ${TRYQTOP}) + +ifeq ($(QTOP),) +$(error Please run this in a tree) +endif +LOCALDIR = $(patsubst %/,%,$(subst $(realpath $(QTOP))/,,$(CUR_DIR))) + +#################################################################### + + +TREE_LIB_ENABLE=0 +lib= +subdirs= + +CFGFLAGS += -I$(QTOP)/net/at/include +CFGFLAGS += -I$(QTOP)/net/sal_module_wrapper + +include ${QTOP}/qmk/generic/Make.tpl + + diff --git a/devices/ec20/Makefile b/devices/ec20/Makefile new file mode 100644 index 00000000..0ae50fff --- /dev/null +++ b/devices/ec20/Makefile @@ -0,0 +1,36 @@ +################################################################### +#automatic detection QTOP and LOCALDIR +CUR_DIR := $(patsubst %/,%,$(dir $(realpath $(firstword $(MAKEFILE_LIST))))) +TRYQTOP := $(shell if [ -n "$$QTOP" ] ; then\ + echo $$QTOP;\ + else\ + cd $(CUR_DIR); while /usr/bin/test ! -d qmk ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find QTOP in $(firstword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) +QTOP ?= $(realpath ${TRYQTOP}) + +ifeq ($(QTOP),) +$(error Please run this in a tree) +endif +LOCALDIR = $(patsubst %/,%,$(subst $(realpath $(QTOP))/,,$(CUR_DIR))) + +#################################################################### + + +TREE_LIB_ENABLE=0 +lib= +subdirs= + +CFGFLAGS += -I$(QTOP)/net/at/include +CFGFLAGS += -I$(QTOP)/net/sal_module_wrapper + +include ${QTOP}/qmk/generic/Make.tpl + + diff --git a/devices/esp8266/Makefile b/devices/esp8266/Makefile new file mode 100644 index 00000000..0ae50fff --- /dev/null +++ b/devices/esp8266/Makefile @@ -0,0 +1,36 @@ +################################################################### +#automatic detection QTOP and LOCALDIR +CUR_DIR := $(patsubst %/,%,$(dir $(realpath $(firstword $(MAKEFILE_LIST))))) +TRYQTOP := $(shell if [ -n "$$QTOP" ] ; then\ + echo $$QTOP;\ + else\ + cd $(CUR_DIR); while /usr/bin/test ! -d qmk ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find QTOP in $(firstword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) +QTOP ?= $(realpath ${TRYQTOP}) + +ifeq ($(QTOP),) +$(error Please run this in a tree) +endif +LOCALDIR = $(patsubst %/,%,$(subst $(realpath $(QTOP))/,,$(CUR_DIR))) + +#################################################################### + + +TREE_LIB_ENABLE=0 +lib= +subdirs= + +CFGFLAGS += -I$(QTOP)/net/at/include +CFGFLAGS += -I$(QTOP)/net/sal_module_wrapper + +include ${QTOP}/qmk/generic/Make.tpl + + diff --git a/devices/esp8266_tencent_firmware/Makefile b/devices/esp8266_tencent_firmware/Makefile new file mode 100644 index 00000000..23f9c5de --- /dev/null +++ b/devices/esp8266_tencent_firmware/Makefile @@ -0,0 +1,38 @@ +################################################################### +#automatic detection QTOP and LOCALDIR +CUR_DIR := $(patsubst %/,%,$(dir $(realpath $(firstword $(MAKEFILE_LIST))))) +TRYQTOP := $(shell if [ -n "$$QTOP" ] ; then\ + echo $$QTOP;\ + else\ + cd $(CUR_DIR); while /usr/bin/test ! -d qmk ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find QTOP in $(firstword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) +QTOP ?= $(realpath ${TRYQTOP}) + +ifeq ($(QTOP),) +$(error Please run this in a tree) +endif +LOCALDIR = $(patsubst %/,%,$(subst $(realpath $(QTOP))/,,$(CUR_DIR))) + +#################################################################### + + +TREE_LIB_ENABLE=0 +lib= +subdirs= + +CFGFLAGS += -I$(QTOP)/net/at/include +CFGFLAGS += -I$(QTOP)/net/sal_module_wrapper +CFGFLAGS += -I$(QTOP)/net/tencent_firmware_module_wrapper +CFGFLAGS += -std=c99 + +include ${QTOP}/qmk/generic/Make.tpl + + diff --git a/devices/m26/Makefile b/devices/m26/Makefile new file mode 100644 index 00000000..0ae50fff --- /dev/null +++ b/devices/m26/Makefile @@ -0,0 +1,36 @@ +################################################################### +#automatic detection QTOP and LOCALDIR +CUR_DIR := $(patsubst %/,%,$(dir $(realpath $(firstword $(MAKEFILE_LIST))))) +TRYQTOP := $(shell if [ -n "$$QTOP" ] ; then\ + echo $$QTOP;\ + else\ + cd $(CUR_DIR); while /usr/bin/test ! -d qmk ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find QTOP in $(firstword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) +QTOP ?= $(realpath ${TRYQTOP}) + +ifeq ($(QTOP),) +$(error Please run this in a tree) +endif +LOCALDIR = $(patsubst %/,%,$(subst $(realpath $(QTOP))/,,$(CUR_DIR))) + +#################################################################### + + +TREE_LIB_ENABLE=0 +lib= +subdirs= + +CFGFLAGS += -I$(QTOP)/net/at/include +CFGFLAGS += -I$(QTOP)/net/sal_module_wrapper + +include ${QTOP}/qmk/generic/Make.tpl + + diff --git a/devices/m5310a/Makefile b/devices/m5310a/Makefile new file mode 100644 index 00000000..365baa81 --- /dev/null +++ b/devices/m5310a/Makefile @@ -0,0 +1,37 @@ +################################################################### +#automatic detection QTOP and LOCALDIR +CUR_DIR := $(patsubst %/,%,$(dir $(realpath $(firstword $(MAKEFILE_LIST))))) +TRYQTOP := $(shell if [ -n "$$QTOP" ] ; then\ + echo $$QTOP;\ + else\ + cd $(CUR_DIR); while /usr/bin/test ! -d qmk ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find QTOP in $(firstword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) +QTOP ?= $(realpath ${TRYQTOP}) + +ifeq ($(QTOP),) +$(error Please run this in a tree) +endif +LOCALDIR = $(patsubst %/,%,$(subst $(realpath $(QTOP))/,,$(CUR_DIR))) + +#################################################################### + + +TREE_LIB_ENABLE=0 +lib= +subdirs= + +CFGFLAGS += -I$(QTOP)/net/at/include +CFGFLAGS += -I$(QTOP)/net/sal_module_wrapper +CFGFLAGS += -std=c99 + +include ${QTOP}/qmk/generic/Make.tpl + + diff --git a/devices/m6312/Makefile b/devices/m6312/Makefile new file mode 100644 index 00000000..0ae50fff --- /dev/null +++ b/devices/m6312/Makefile @@ -0,0 +1,36 @@ +################################################################### +#automatic detection QTOP and LOCALDIR +CUR_DIR := $(patsubst %/,%,$(dir $(realpath $(firstword $(MAKEFILE_LIST))))) +TRYQTOP := $(shell if [ -n "$$QTOP" ] ; then\ + echo $$QTOP;\ + else\ + cd $(CUR_DIR); while /usr/bin/test ! -d qmk ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find QTOP in $(firstword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) +QTOP ?= $(realpath ${TRYQTOP}) + +ifeq ($(QTOP),) +$(error Please run this in a tree) +endif +LOCALDIR = $(patsubst %/,%,$(subst $(realpath $(QTOP))/,,$(CUR_DIR))) + +#################################################################### + + +TREE_LIB_ENABLE=0 +lib= +subdirs= + +CFGFLAGS += -I$(QTOP)/net/at/include +CFGFLAGS += -I$(QTOP)/net/sal_module_wrapper + +include ${QTOP}/qmk/generic/Make.tpl + + diff --git a/devices/nrf24l01/Makefile b/devices/nrf24l01/Makefile new file mode 100644 index 00000000..c5126dc4 --- /dev/null +++ b/devices/nrf24l01/Makefile @@ -0,0 +1,34 @@ +################################################################### +#automatic detection QTOP and LOCALDIR +CUR_DIR := $(patsubst %/,%,$(dir $(realpath $(firstword $(MAKEFILE_LIST))))) +TRYQTOP := $(shell if [ -n "$$QTOP" ] ; then\ + echo $$QTOP;\ + else\ + cd $(CUR_DIR); while /usr/bin/test ! -d qmk ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find QTOP in $(firstword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) +QTOP ?= $(realpath ${TRYQTOP}) + +ifeq ($(QTOP),) +$(error Please run this in a tree) +endif +LOCALDIR = $(patsubst %/,%,$(subst $(realpath $(QTOP))/,,$(CUR_DIR))) + +#################################################################### + + +TREE_LIB_ENABLE=0 +lib= +subdirs= + + +include ${QTOP}/qmk/generic/Make.tpl + + diff --git a/devices/sim7600ce/Makefile b/devices/sim7600ce/Makefile new file mode 100644 index 00000000..0ae50fff --- /dev/null +++ b/devices/sim7600ce/Makefile @@ -0,0 +1,36 @@ +################################################################### +#automatic detection QTOP and LOCALDIR +CUR_DIR := $(patsubst %/,%,$(dir $(realpath $(firstword $(MAKEFILE_LIST))))) +TRYQTOP := $(shell if [ -n "$$QTOP" ] ; then\ + echo $$QTOP;\ + else\ + cd $(CUR_DIR); while /usr/bin/test ! -d qmk ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find QTOP in $(firstword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) +QTOP ?= $(realpath ${TRYQTOP}) + +ifeq ($(QTOP),) +$(error Please run this in a tree) +endif +LOCALDIR = $(patsubst %/,%,$(subst $(realpath $(QTOP))/,,$(CUR_DIR))) + +#################################################################### + + +TREE_LIB_ENABLE=0 +lib= +subdirs= + +CFGFLAGS += -I$(QTOP)/net/at/include +CFGFLAGS += -I$(QTOP)/net/sal_module_wrapper + +include ${QTOP}/qmk/generic/Make.tpl + + diff --git a/devices/sim800a/Makefile b/devices/sim800a/Makefile new file mode 100644 index 00000000..0ae50fff --- /dev/null +++ b/devices/sim800a/Makefile @@ -0,0 +1,36 @@ +################################################################### +#automatic detection QTOP and LOCALDIR +CUR_DIR := $(patsubst %/,%,$(dir $(realpath $(firstword $(MAKEFILE_LIST))))) +TRYQTOP := $(shell if [ -n "$$QTOP" ] ; then\ + echo $$QTOP;\ + else\ + cd $(CUR_DIR); while /usr/bin/test ! -d qmk ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find QTOP in $(firstword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) +QTOP ?= $(realpath ${TRYQTOP}) + +ifeq ($(QTOP),) +$(error Please run this in a tree) +endif +LOCALDIR = $(patsubst %/,%,$(subst $(realpath $(QTOP))/,,$(CUR_DIR))) + +#################################################################### + + +TREE_LIB_ENABLE=0 +lib= +subdirs= + +CFGFLAGS += -I$(QTOP)/net/at/include +CFGFLAGS += -I$(QTOP)/net/sal_module_wrapper + +include ${QTOP}/qmk/generic/Make.tpl + + diff --git a/doc/qmk/01. Intro_Qmk_A_Makefile_Framework_For_TencentOS.md b/doc/qmk/01. Intro_Qmk_A_Makefile_Framework_For_TencentOS.md new file mode 100644 index 00000000..2f57f6b8 --- /dev/null +++ b/doc/qmk/01. Intro_Qmk_A_Makefile_Framework_For_TencentOS.md @@ -0,0 +1,285 @@ +# Qmk(Quick Makefile) + +## 1. 介绍 + +### Qmk 是什么 + +qmk, 是TecentOS的一个Makefile编译框架。 + +### Qmk 的特点 +- 多架构支持,支持多种 MCU ARCH、多种CC工具链; +- 使用简单,任意目录均可make; +- 入门简单,新源码目录 Makefile 拷贝即可使用; +- 扩展性,简单的修改即可支持新MCU、新的board、新CC工具链的支持; +- 模板化,多种场景的Makefile拷贝即用; +- 耦合低,跟源码目录结构的耦合低; +- 子目录单独make支持,支持子目录编译.a静态库; + +## TencentOS的make编译 +### TencentOS的整体make +```shell +# 进入board目录支持qmk的board +cd board/TencentOS_tiny_EVB_MX_Plus + +# 本目录编译 +make + +# 查看帮助 +make help +``` +TencentOS的整体编译过程是: +3. 从`board/`下的顶级Makefile开始,该Makefile 确定BP 。 +3. make访问 `arch/`, 生成`libarch.a` 。 +3. make递归访问其他源码目录节点,各Makefile,生成`libxxx.a` 。 +3. 各个源码目录节点,依次生成`.a`静态库文件,均位于 `build/`目录下 。 +3. make 回到 `board/`的顶级Makefile,使用`.a`静态库文件以及链接参数,进行链接。 +3. 整体构建完成。 + +### TecentOS的子目录make +```shell +# 进入某包含Makefile的目录 +cd kernel/core + +# 本目录编译 +make BP=Linux_Posix + +# 查看帮助 +make help +``` +单目录的编译过程是: +3. make访问本目录,读取本目录Makefile,根据命令行`make BP=xxx`的BP,选择`mk/board-pack`。 +3. 根据BP选择的构建参数,以及`TREE_LIB_ENABLE`、`lib`进行编译。 +3. 使用ar进行打包,.a 文件放在`build/`目录。 +3. 构建完成。 + +## Qmk 的概念 +### generic-Makefile(mk/generic) + +又称全局通用型Makefile模板。位于 `mk/generic)`。 + +要求对所有board、所有mcu arch适用。 + + +### board-Makefile(mk/board-pack) + +又称板级Makefile模板。位于mk/board-pack 的 bp.${BP},属于board配置型Makefile。 + +一般只对某一个board适用。 +是一个硬件产品工程开发过程中,在编译时,工具链,arch、board等参数的抽象。 +嵌入式应用开发工程师主要修改这部分Makefile。 + +### arch-Makefile(mk/arch-pack) + +又称 mcu arch 级别Makefile模板。位于mk/arch-pack 的 ap.xx,属于arch配置型Makefile。 + +要求对同一类arch 的所有board适用。 + +### src-Makefile节点 +又称节点Makefile,位于各个源码目录的 Makefile。 + +所有board都适用,属于源码节点配置型Makefile。 + +不能包含arch,board级别的编译参数。 + + + + +## Qmk 的使用 + +### 当前目录所有.c,编译成一个.a库 +复制粘贴 以下 Makefile 内容到源码目录 Makefile。 +无需修改。 +有特别的CFLAG请根据情况配置 `CFGFLAGS`。 +> +>3. 注意`TREE_LIB_ENABLE=0`,,cc和ar时,只搜索当前目录源码,不包含子目录; +> +>3. 注意`lib=`,表示链接后的库名使用目录名; +>3. 注意板级的编译参数请配置到pack-Makefile,否则会导致其他pack编译报错. + +```Makefile +################################################################### +#automatic detection QTOP and LOCALDIR +CUR_DIR := $(dir $(realpath $(firstword $(MAKEFILE_LIST)))) +TRYQTOP := $(shell if [ -n "$$QTOP" ] ; then\ + echo $$QTOP;\ + else\ + cd $(CUR_DIR); while /usr/bin/test ! -d mk ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find QTOP in $(firstword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) +QTOP ?= $(realpath ${TRYQTOP}) + +ifeq ($(QTOP),) +$(error Please run this in a tree) +endif +LOCALDIR = $(patsubst %/,%,$(subst $(realpath $(QTOP))/,,$(CUR_DIR))) + +#################################################################### + + +TREE_LIB_ENABLE=0 +lib= +subdirs= + +CFGFLAGS += -I${QTOP}/kernel/core/include +CFGFLAGS += -I${QTOP}/kernel/evtdrv/include +CFGFLAGS += -I${QTOP}/kernel/hal/include +CFGFLAGS += -I${QTOP}/kernel/pm/include + +include ${QTOP}/mk/generic/Make.tpl + +``` + +### 某目录及其子目录的所有.c,编译成一个.a库 + +复制粘贴 以下 Makefile 内容到源码目录 Makefile。 +无需修改。 +有特别的CFLAG请根据情况配置 `CFGFLAGS`。 +> +>3. 注意`TREE_LIB_ENABLE=1`,cc和ar时,会递归搜索源码,包含当前目录及其子目录。 +> +>3. 注意`lib=`,表示链接后的库名使用目录名; +>3. 注意板级的编译参数请配置到pack-Makefile,否则会导致其他pack编译报错. +> + +```Makefile +################################################################### +#automatic detection QTOP and LOCALDIR +CUR_DIR := $(dir $(realpath $(firstword $(MAKEFILE_LIST)))) +TRYQTOP := $(shell if [ -n "$$QTOP" ] ; then\ + echo $$QTOP;\ + else\ + cd $(CUR_DIR); while /usr/bin/test ! -d mk ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find QTOP in $(firstword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) +QTOP ?= $(realpath ${TRYQTOP}) + +ifeq ($(QTOP),) +$(error Please run this in a tree) +endif +LOCALDIR = $(patsubst %/,%,$(subst $(realpath $(QTOP))/,,$(CUR_DIR))) + +#################################################################### + + +TREE_LIB_ENABLE=1 +lib= +subdirs= + +CFGFLAGS += -I${QTOP}/kernel/core/include +CFGFLAGS += -I${QTOP}/kernel/evtdrv/include + +include ${QTOP}/mk/generic/Make.tpl +``` + + +### 当前目录进入所有子目录、进入指定目录编译 + +复制粘贴 以下 Makefile 内容到源码目录 Makefile。 +无需修改。 +有特别的CFLAG请根据情况配置 `CFGFLAGS`。 +>注意` subdirs=`为空,默认会进入所有子目录。 +> 如果需要指定子目录请给`subdirs`赋值。 +> + + +```Makefile +################################################################### +#automatic detection QTOP and LOCALDIR +CUR_DIR := $(dir $(realpath $(firstword $(MAKEFILE_LIST)))) +TRYQTOP := $(shell if [ -n "$$QTOP" ] ; then\ + echo $$QTOP;\ + else\ + cd $(CUR_DIR); while /usr/bin/test ! -d mk ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find QTOP in $(firstword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) +QTOP ?= $(realpath ${TRYQTOP}) + +ifeq ($(QTOP),) +$(error Please run this in a tree) +endif +LOCALDIR = $(patsubst %/,%,$(subst $(realpath $(QTOP))/,,$(CUR_DIR))) + +#################################################################### + + +TREE_LIB_ENABLE=0 +lib= +subdirs= +subdirs= subdir-a subdir-b + +include ${QTOP}/mk/generic/Make.tpl +``` + +### 新增一个 board-pack +参考 `mk/board-pack/`下的各个文件。 + +board-pack 是对 board 在编译时的一个抽象。 +一个board 确定了 MCU arch、工具链、app(main入口),把这些编译时参数写成一个bp.xxx。 + +可以对同一个board 编写多个不同的board-pack,以满足同一个board下, +选用不通的工具链,编译参数不通,等需求。 + +## Qmk 的变量 +### QTOP 全局变量 +标识TencentOS 源码Toplevel目录绝对路径。 + +命令`git rev-parse --show-toplevel`可以显示。 + +所有的Makefile都需要QTOP去寻找mk/下的Makefile模板。 + +### BP 全局变量 +选取board-pack,`make BP=Linux_Posix`会选取`mk/board-pack/bp.Linux_Posix` +board-pack 确定CC工具链、确定MCU的arch,确定,board的app源码目录。 + +### V 调试变量 +VERBOSE 输出。编译时,`make V=1` 会打印命令行,用于调试编译过程。 + +### EEEE 调试变量 +CC 编译 .o 文件前,保存预处理文件.i。用于调试宏、头文件包含问题。 + +## Makefile 节点的关键变量 + +### TREE_LIB_ENABLE +控制编译时源码的范围。 + +`TREE_LIB_ENABLE=1`会处理当前目录及其所有子目录的源码。 +`TREE_LIB_ENABLE=`只处理当前目录源码。 + +可以参考`kernel/Makefile`,把整个`kernel/`编译成`libkernel.a` + + +### CFGFLAGS +给当前目录编译时补充CFLAGS。 +会变成CFLAGS的一部分,传递给编译器。 + +### subdirs +`subdirs`控制make 递归进入哪些子目录。 +默认值为本目录下所有存在Makefile的子目录集合。 +需要进入指定子目录,请给`subdirs`赋值。 + +### lib +控制.a静态库的名称。默认值为本目录的名称。 + +## Qmk 后续 +3. Kbuild 方向,参考Linux-Kernel的Kbuild以及busybox的`Kbuild` diff --git a/kernel/Makefile b/kernel/Makefile new file mode 100644 index 00000000..db366f9c --- /dev/null +++ b/kernel/Makefile @@ -0,0 +1,38 @@ +################################################################### +#automatic detection QTOP and LOCALDIR +CUR_DIR := $(patsubst %/,%,$(dir $(realpath $(firstword $(MAKEFILE_LIST))))) +TRYQTOP := $(shell if [ -n "$$QTOP" ] ; then\ + echo $$QTOP;\ + else\ + cd $(CUR_DIR); while /usr/bin/test ! -d qmk ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find QTOP in $(firstword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) +QTOP ?= $(realpath ${TRYQTOP}) + +ifeq ($(QTOP),) +$(error Please run this in a tree) +endif +LOCALDIR = $(patsubst %/,%,$(subst $(realpath $(QTOP))/,,$(CUR_DIR))) + +#################################################################### + + +TREE_LIB_ENABLE=1 +lib= +subdirs= + +CFGFLAGS += -I${QTOP}/kernel/core/include +CFGFLAGS += -I${QTOP}/kernel/evtdrv/include +CFGFLAGS += -I${QTOP}/kernel/hal/include +CFGFLAGS += -I${QTOP}/kernel/pm/include + +include ${QTOP}/qmk/generic/Make.tpl + + diff --git a/net/Makefile b/net/Makefile new file mode 100644 index 00000000..49c966c6 --- /dev/null +++ b/net/Makefile @@ -0,0 +1,35 @@ +################################################################### +#automatic detection QTOP and LOCALDIR +CUR_DIR := $(patsubst %/,%,$(dir $(realpath $(firstword $(MAKEFILE_LIST))))) +TRYQTOP := $(shell if [ -n "$$QTOP" ] ; then\ + echo $$QTOP;\ + else\ + cd $(CUR_DIR); while /usr/bin/test ! -e qmk ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find QTOP in $(firstword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) +QTOP ?= $(realpath ${TRYQTOP}) + +ifeq ($(QTOP),) +$(error Please run this in a tree) +endif +LOCALDIR = $(patsubst %/,%,$(subst $(realpath $(QTOP))/,,$(CUR_DIR))) +#################################################################### + + +TREE_LIB_ENABLE=n +lib= +subdirs= + + +include ${QTOP}/qmk/generic/Make.tpl + + +include ${QTOP}/qmk/generic/Make.subdirs + diff --git a/net/at/Makefile b/net/at/Makefile new file mode 100644 index 00000000..c5126dc4 --- /dev/null +++ b/net/at/Makefile @@ -0,0 +1,34 @@ +################################################################### +#automatic detection QTOP and LOCALDIR +CUR_DIR := $(patsubst %/,%,$(dir $(realpath $(firstword $(MAKEFILE_LIST))))) +TRYQTOP := $(shell if [ -n "$$QTOP" ] ; then\ + echo $$QTOP;\ + else\ + cd $(CUR_DIR); while /usr/bin/test ! -d qmk ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find QTOP in $(firstword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) +QTOP ?= $(realpath ${TRYQTOP}) + +ifeq ($(QTOP),) +$(error Please run this in a tree) +endif +LOCALDIR = $(patsubst %/,%,$(subst $(realpath $(QTOP))/,,$(CUR_DIR))) + +#################################################################### + + +TREE_LIB_ENABLE=0 +lib= +subdirs= + + +include ${QTOP}/qmk/generic/Make.tpl + + diff --git a/net/lora_module_wrapper/Makefile b/net/lora_module_wrapper/Makefile new file mode 100644 index 00000000..c5126dc4 --- /dev/null +++ b/net/lora_module_wrapper/Makefile @@ -0,0 +1,34 @@ +################################################################### +#automatic detection QTOP and LOCALDIR +CUR_DIR := $(patsubst %/,%,$(dir $(realpath $(firstword $(MAKEFILE_LIST))))) +TRYQTOP := $(shell if [ -n "$$QTOP" ] ; then\ + echo $$QTOP;\ + else\ + cd $(CUR_DIR); while /usr/bin/test ! -d qmk ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find QTOP in $(firstword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) +QTOP ?= $(realpath ${TRYQTOP}) + +ifeq ($(QTOP),) +$(error Please run this in a tree) +endif +LOCALDIR = $(patsubst %/,%,$(subst $(realpath $(QTOP))/,,$(CUR_DIR))) + +#################################################################### + + +TREE_LIB_ENABLE=0 +lib= +subdirs= + + +include ${QTOP}/qmk/generic/Make.tpl + + diff --git a/net/lwip/Makefile b/net/lwip/Makefile new file mode 100644 index 00000000..0664dcae --- /dev/null +++ b/net/lwip/Makefile @@ -0,0 +1,38 @@ +################################################################### +#automatic detection QTOP and LOCALDIR +CUR_DIR := $(patsubst %/,%,$(dir $(realpath $(firstword $(MAKEFILE_LIST))))) +TRYQTOP := $(shell if [ -n "$$QTOP" ] ; then\ + echo $$QTOP;\ + else\ + cd $(CUR_DIR); while /usr/bin/test ! -d qmk ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find QTOP in $(firstword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) +QTOP ?= $(realpath ${TRYQTOP}) + +ifeq ($(QTOP),) +$(error Please run this in a tree) +endif +LOCALDIR = $(patsubst %/,%,$(subst $(realpath $(QTOP))/,,$(CUR_DIR))) + +#################################################################### + + +TREE_LIB_ENABLE=y +lib= +subdirs= + +CFGFLAGS += -I${CUR_DIR}/3rdparty/src/include +CFGFLAGS += -I${CUR_DIR}/port/include + + + +include ${QTOP}/qmk/generic/Make.tpl + + diff --git a/net/sal_module_wrapper/Makefile b/net/sal_module_wrapper/Makefile new file mode 100644 index 00000000..c5126dc4 --- /dev/null +++ b/net/sal_module_wrapper/Makefile @@ -0,0 +1,34 @@ +################################################################### +#automatic detection QTOP and LOCALDIR +CUR_DIR := $(patsubst %/,%,$(dir $(realpath $(firstword $(MAKEFILE_LIST))))) +TRYQTOP := $(shell if [ -n "$$QTOP" ] ; then\ + echo $$QTOP;\ + else\ + cd $(CUR_DIR); while /usr/bin/test ! -d qmk ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find QTOP in $(firstword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) +QTOP ?= $(realpath ${TRYQTOP}) + +ifeq ($(QTOP),) +$(error Please run this in a tree) +endif +LOCALDIR = $(patsubst %/,%,$(subst $(realpath $(QTOP))/,,$(CUR_DIR))) + +#################################################################### + + +TREE_LIB_ENABLE=0 +lib= +subdirs= + + +include ${QTOP}/qmk/generic/Make.tpl + + diff --git a/net/socket_wrapper/Makefile b/net/socket_wrapper/Makefile new file mode 100644 index 00000000..9dac0911 --- /dev/null +++ b/net/socket_wrapper/Makefile @@ -0,0 +1,35 @@ +################################################################### +#automatic detection QTOP and LOCALDIR +CUR_DIR := $(patsubst %/,%,$(dir $(realpath $(firstword $(MAKEFILE_LIST))))) +TRYQTOP := $(shell if [ -n "$$QTOP" ] ; then\ + echo $$QTOP;\ + else\ + cd $(CUR_DIR); while /usr/bin/test ! -d qmk ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find QTOP in $(firstword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) +QTOP ?= $(realpath ${TRYQTOP}) + +ifeq ($(QTOP),) +$(error Please run this in a tree) +endif +LOCALDIR = $(patsubst %/,%,$(subst $(realpath $(QTOP))/,,$(CUR_DIR))) + +#################################################################### + + +TREE_LIB_ENABLE=0 +lib= +subdirs= + +CFGFLAGS += -I${QTOP}/net/sal_module_wrapper + +include ${QTOP}/qmk/generic/Make.tpl + + diff --git a/net/tencent_firmware_module_wrapper/Makefile b/net/tencent_firmware_module_wrapper/Makefile new file mode 100644 index 00000000..c5126dc4 --- /dev/null +++ b/net/tencent_firmware_module_wrapper/Makefile @@ -0,0 +1,34 @@ +################################################################### +#automatic detection QTOP and LOCALDIR +CUR_DIR := $(patsubst %/,%,$(dir $(realpath $(firstword $(MAKEFILE_LIST))))) +TRYQTOP := $(shell if [ -n "$$QTOP" ] ; then\ + echo $$QTOP;\ + else\ + cd $(CUR_DIR); while /usr/bin/test ! -d qmk ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find QTOP in $(firstword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) +QTOP ?= $(realpath ${TRYQTOP}) + +ifeq ($(QTOP),) +$(error Please run this in a tree) +endif +LOCALDIR = $(patsubst %/,%,$(subst $(realpath $(QTOP))/,,$(CUR_DIR))) + +#################################################################### + + +TREE_LIB_ENABLE=0 +lib= +subdirs= + + +include ${QTOP}/qmk/generic/Make.tpl + + diff --git a/osal/Makefile b/osal/Makefile new file mode 100644 index 00000000..6ae3b415 --- /dev/null +++ b/osal/Makefile @@ -0,0 +1,31 @@ +################################################################### +#automatic detection QTOP and LOCALDIR +$(patsubst %/,%,$(dir $(realpath $(firstword $(MAKEFILE_LIST))))) +TRYQTOP := $(shell if [ -n "$$QTOP" ] ; then\ + echo $$QTOP;\ + else\ + cd $(CUR_DIR); while /usr/bin/test ! -e qmk ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find QTOP in $(firstword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) +QTOP ?= $(realpath ${TRYQTOP}) + +ifeq ($(QTOP),) +$(error Please run this in a tree) +endif +LOCALDIR = $(patsubst %/,%,$(subst $(realpath $(QTOP))/,,$(CUR_DIR))) +#################################################################### + + +TREE_LIB_ENABLE=0 +lib= +subdirs = cmsis_os + + +include ${QTOP}/qmk/generic/Make.tpl diff --git a/osal/cmsis_os/Makefile b/osal/cmsis_os/Makefile new file mode 100644 index 00000000..1f283b2c --- /dev/null +++ b/osal/cmsis_os/Makefile @@ -0,0 +1,34 @@ +################################################################### +#automatic detection QTOP and LOCALDIR +$(patsubst %/,%,$(dir $(realpath $(firstword $(MAKEFILE_LIST))))) +TRYQTOP := $(shell if [ -n "$$QTOP" ] ; then\ + echo $$QTOP;\ + else\ + cd $(CUR_DIR); while /usr/bin/test ! -d qmk ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find QTOP in $(firstword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) +QTOP ?= $(realpath ${TRYQTOP}) + +ifeq ($(QTOP),) +$(error Please run this in a tree) +endif +LOCALDIR = $(patsubst %/,%,$(subst $(realpath $(QTOP))/,,$(CUR_DIR))) + +#################################################################### + + +TREE_LIB_ENABLE=0 +lib= +subdirs= + + +include ${QTOP}/qmk/generic/Make.tpl + + diff --git a/osal/posix/Makefile b/osal/posix/Makefile new file mode 100644 index 00000000..992f0cb3 --- /dev/null +++ b/osal/posix/Makefile @@ -0,0 +1,35 @@ +################################################################### +#automatic detection QTOP and LOCALDIR +$(patsubst %/,%,$(dir $(realpath $(firstword $(MAKEFILE_LIST))))) +TRYQTOP := $(shell if [ -n "$$QTOP" ] ; then\ + echo $$QTOP;\ + else\ + cd $(CUR_DIR); while /usr/bin/test ! -d qmk ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find QTOP in $(firstword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) +QTOP ?= $(realpath ${TRYQTOP}) + +ifeq ($(QTOP),) +$(error Please run this in a tree) +endif +LOCALDIR = $(patsubst %/,%,$(subst $(realpath $(QTOP))/,,$(CUR_DIR))) + +#################################################################### + + +TREE_LIB_ENABLE=0 +lib= +subdirs= + +CFGFLAGS += -I$(CUR_DIR)/include + +include ${QTOP}/qmk/generic/Make.tpl + + diff --git a/qmk/arch-pack/ap.linux.posix.gcc b/qmk/arch-pack/ap.linux.posix.gcc new file mode 100644 index 00000000..21d7b6f0 --- /dev/null +++ b/qmk/arch-pack/ap.linux.posix.gcc @@ -0,0 +1,8 @@ + +CFGFLAGS += -I${QTOP}/arch/linux/common/include/ +CFGFLAGS += -I${QTOP}/arch/linux/posix/gcc + + + +ARCH_LSCRS = $(wildcard ${QTOP}/arch/linux/posix/gcc/*.c) +ARCH_LSCRS += $(wildcard ${QTOP}/arch/linux/common/*.c) diff --git a/qmk/arch-pack/apconfig b/qmk/arch-pack/apconfig new file mode 100644 index 00000000..e69de29b diff --git a/qmk/board-pack/bp.Linux_Posix b/qmk/board-pack/bp.Linux_Posix new file mode 100644 index 00000000..f06697f6 --- /dev/null +++ b/qmk/board-pack/bp.Linux_Posix @@ -0,0 +1,37 @@ +# toolchain +uname := $(shell uname -s) +ifeq ($(filter-out Linux Darwin,$(uname)),) + ifeq ($(shell uname -m),x86_64) + CROSS_COMPILE = + CC = $(CROSS_COMPILE)gcc + CXX = $(CROSS_COMPILE)g++ + LD = $(CROSS_COMPILE)ld + AR = $(CROSS_COMPILE)ar + ARFLAGS = -rc + STRIP = $(CROSS_COMPILE)strip + RANLIB = $(CROSS_COMPILE)ranlib + else + CROSS_COMPILE = + CC = $(CROSS_COMPILE)gcc -m32 + CXX = $(CROSS_COMPILE)g++ -m32 + LD = $(CROSS_COMPILE)ld -melf_i386 + AR = $(CROSS_COMPILE)ar + ARFLAGS = -rc + STRIP = $(CROSS_COMPILE)strip + RANLIB = $(CROSS_COMPILE)ranlib + endif +endif + +include ${QTOP}/qmk/arch-pack/ap.linux.posix.gcc + +CFGFLAGS += -O0 -Wall -g2 -ggdb + +CFGFLAGS += -I${QTOP}/board/Linux_Posix/hello_world/inc +CFGFLAGS += -I${QTOP}/osal/cmsis_os +CFGFLAGS += -I${QTOP}/kernel/core/include +CFGFLAGS += -I${QTOP}/kernel/evtdrv/include +CFGFLAGS += -I${QTOP}/kernel/hal/include +CFGFLAGS += -I${QTOP}/kernel/pm/include + + + diff --git a/qmk/board-pack/bp.Linux_Posix.helloworld b/qmk/board-pack/bp.Linux_Posix.helloworld new file mode 100644 index 00000000..ecd8f420 --- /dev/null +++ b/qmk/board-pack/bp.Linux_Posix.helloworld @@ -0,0 +1,40 @@ +# toolchain +uname := $(shell uname -s) +ifeq ($(filter-out Linux Darwin,$(uname)),) + ifeq ($(shell uname -m),x86_64) + CC = $(CROSS_COMPILE)gcc + CXX = $(CROSS_COMPILE)g++ + LD = $(CROSS_COMPILE)ld + AR = $(CROSS_COMPILE)ar + ARFLAGS = -rc + STRIP = $(CROSS_COMPILE)strip + RANLIB = $(CROSS_COMPILE)ranlib + else + CROSS_COMPILE = + CC = $(CROSS_COMPILE)gcc -m32 + CXX = $(CROSS_COMPILE)g++ -m32 + LD = $(CROSS_COMPILE)ld -melf_i386 + AR = $(CROSS_COMPILE)ar + ARFLAGS = -rc + STRIP = $(CROSS_COMPILE)strip + RANLIB = $(CROSS_COMPILE)ranlib + endif +endif + +CFGFLAGS += -O0 -Wall -g2 -ggdb + +CFGFLAGS += -I${QTOP}/board/Linux_Posix/hello_world/inc +CFGFLAGS += -I${QTOP}/osal/cmsis_os +CFGFLAGS += -I${QTOP}/kernel/core/include +CFGFLAGS += -I${QTOP}/kernel/evtdrv/include +CFGFLAGS += -I${QTOP}/kernel/hal/include +CFGFLAGS += -I${QTOP}/kernel/pm/include +CFGFLAGS += -I${QTOP}/arch/linux/common/include +CFGFLAGS += -I${QTOP}/arch/linux/posix/gcc + + + + + + + diff --git a/qmk/board-pack/bp.native b/qmk/board-pack/bp.native new file mode 100644 index 00000000..1679c6a0 --- /dev/null +++ b/qmk/board-pack/bp.native @@ -0,0 +1,42 @@ +# toolchain +uname := $(shell uname -s) +ifeq ($(filter-out Linux Darwin,$(uname)),) + ifeq ($(shell uname -m),x86_64) + CROSS_COMPILE = + CC = $(CROSS_COMPILE)gcc + CXX = $(CROSS_COMPILE)g++ + LD = $(CROSS_COMPILE)ld + AR = $(CROSS_COMPILE)ar + ARFLAGS = -rc + STRIP = $(CROSS_COMPILE)strip + RANLIB = $(CROSS_COMPILE)ranlib + else + CROSS_COMPILE = + CC = $(CROSS_COMPILE)gcc -m32 + CXX = $(CROSS_COMPILE)g++ -m32 + LD = $(CROSS_COMPILE)ld -melf_i386 + AR = $(CROSS_COMPILE)ar + ARFLAGS = -rc + STRIP = $(CROSS_COMPILE)strip + RANLIB = $(CROSS_COMPILE)ranlib + endif +endif + + +CFGFLAGS += -O0 -Wall -g2 -ggdb + +CFGFLAGS += -I${QTOP}/board/Linux_Posix/hello_world/inc +CFGFLAGS += -I${QTOP}/osal/cmsis_os +CFGFLAGS += -I${QTOP}/kernel/core/include +CFGFLAGS += -I${QTOP}/kernel/evtdrv/include +CFGFLAGS += -I${QTOP}/kernel/hal/include +CFGFLAGS += -I${QTOP}/kernel/pm/include +CFGFLAGS += -I${QTOP}/arch/linux/common/include +CFGFLAGS += -I${QTOP}/arch/linux/posix/gcc + + + + + + + diff --git a/qmk/generic/Make.debug b/qmk/generic/Make.debug new file mode 100644 index 00000000..9c58b2e4 --- /dev/null +++ b/qmk/generic/Make.debug @@ -0,0 +1,50 @@ +# QMK for TencentOS +# @author Jimmin.huang jimmin@163.com +# Makefile template +# aim for debug makefile +######################################################################## + + + + + +ifeq ($(MAKELEVEL),0) + + +# Standard definitions for true and false. true is any non-empty +# string, false is an empty string. These are intended for use with +# $(if). + +true := T +false := + +# ---------------------------------------------------------------------------- +# Function: not +# Arguments: 1: A boolean value +# Returns: Returns the opposite of the arg. (true -> false, false -> true) +# ---------------------------------------------------------------------------- +not = $(if $1,$(false),$(true)) + +# ---------------------------------------------------------------------------- +# Function: seq +# Arguments: 1: A string to compare against... +# 2: ...this string +# Returns: Returns $(true) if the two strings are identical +# ---------------------------------------------------------------------------- +seq = $(if $(filter-out xx,x$(subst $1,,$2)$(subst $2,,$1)x),$(false),$(true)) + +ifeq (dm,$(findstring dm,$(MAKECMDGOALS))) +$(info ###################All pre-defined and user-defined variable's Key:) +$(info $(shell echo -e '\e[1;33m $(sort $(.VARIABLES)) \e[m')) + +$(info ###################All user-defined Variables:) +$(foreach v, $(sort $(.VARIABLES)),$(if $(call seq,$(origin ${v}),file), $(eval VV:=$(value ${v})) $(info $(shell echo -e '\e[1;33m ${v} \e[m = "$(VV)"' )))) +dm: + @true +endif + + + +PHONY: dm + +endif \ No newline at end of file diff --git a/qmk/generic/Make.depend b/qmk/generic/Make.depend new file mode 100644 index 00000000..f68c644a --- /dev/null +++ b/qmk/generic/Make.depend @@ -0,0 +1,46 @@ +# QMK for TencentOS +# @author Jimmin.huang jimmin@163.com +# Makefile template +######################################################################## + +ifeq (,$(findstring clean,$(MAKECMDGOALS))) +ifneq (help,$(findstring help,$(MAKECMDGOALS))) + +all:: + @true +# +# Attempt to build the depend files. If it fails, the depend file is +# removed so that it is not included in later builds. +# +#${BLDDIR}/%.P : %.c ${BLDDIR}/.tree +# @$(ECHO) "[$(BP)] DEP ${LOCALDIR}/$<" + +#${BLDDIR}/%.P : %.cc ${BLDDIR}/.tree +# @$(ECHO) "[$(BP)] DEP ${LOCALDIR}/$<" + + +# +# If there are C or C++ files in this directory, include the +# depend files for them. +# +ifeq ($(findstring _COMPILER,$(MAKECMDGOALS))$(findstring variable,$(MAKECMDGOALS)),) +ifneq ($(strip ${LSRCS}),) +ifneq (,$(findstring .o,$(MAKECMDGOALS))) +-include $(addprefix ${BLDDIR}/,$(MAKECMDGOALS:.o=.P)) $(addprefix ${BLDDIR}/,$(MAKECMDGOALS:.o=.sig)) +else +-include $(addprefix ${BLDDIR}/,$(addsuffix .P,$(basename $(LSRCS)))) +-include $(addprefix ${BLDDIR}/,$(addsuffix .sig,$(basename $(LSRCS)))) +endif +endif +endif + +endif # help +endif # !CLEANING + +clean_d:: +ifeq (@,$(Q)) + @$(ECHO) "[$(BP)] CLEAN DEPS ${LOCALDIR}" +endif + $Q$(RM) $(BOBJS:.o=.P) + +clean:: clean_d diff --git a/qmk/generic/Make.exec b/qmk/generic/Make.exec new file mode 100644 index 00000000..b4dce87f --- /dev/null +++ b/qmk/generic/Make.exec @@ -0,0 +1,56 @@ +# QMK for TencentOS +# @author Jimmin.huang jimmin@163.com +######################################################################## + +# Make rules/targets for handling user application + +.SECONDARY:: ${LD_O_FILES} + +ifeq (,$(strip $(exec))) +exec = $(shell basename $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))) +endif + +OUTDIR = ${BLDDIR}/out + +targetexec = ${OUTDIR}/${exec} + +all:: ${OUTDIR}/.tree ${targetexec} + +$(info $(wildcard $(LIBDIR)/%.a) ) + +ifeq (,$(LD_O_FILES)) +LD_O_FILES = $(sort $(BOBJS)) +endif +ifeq (2,$(V)) +LD_INFO_OPTS := -Wl,--warn-common -Wl,--verbose +endif +ifeq (3,$(V)) +LD_INFO_OPTS := -Wl,--warn-common -Wl,-Map,${OUTDIR}/${exec}.map -Wl,--verbose +endif + +_LD_START_GROUP := -Wl,--start-group +_LD_END_GROUP := -Wl,--end-group + +$(targetexec): $(OUTDIR)/strip/.tree ${LD_O_FILES} + @rm -f $@ # Prevent core dump if currently running + @$(ECHO) "[$(BP)] LINK $@" # This is needed for error parsing + $(Q)/bin/ls $(LIBDIR) + $(Q)$(CC) \ + -o $@ \ + -L${LIBDIR} \ + $(_LD_START_GROUP) $(LD_O_FILES) $(LD_A_FILES) $(LD_L_LISTS) $(LDFLAGS) $(_LD_END_GROUP) \ + $(LD_INFO_OPTS) + $(CP) $@ $(QTOP) + $(Q)$(STRIP) --strip-debug $@ -o $(OUTDIR)/strip/$(notdir $@) + + +install:: all + +clean:: + $(Q)$(RM) ${BOBJS} + $(Q)$(RM) $(filter %.a ,$(LD_A_FILES)) + $(Q)$(RM) ${bldroot_exec} + +distclean:: clean + +.PHONY: $(targetexec) diff --git a/qmk/generic/Make.lib b/qmk/generic/Make.lib new file mode 100644 index 00000000..73eaf3c2 --- /dev/null +++ b/qmk/generic/Make.lib @@ -0,0 +1,52 @@ +# QMK for TencentOS +# @author Jimmin.huang jimmin@163.com +# Makefile template +######################################################################## + +.SECONDARY:: ${BOBJS} + +ifndef lib +lib = lib$(shell basename ${LOCALDIR}) +endif +targetlib = ${LIBDIR}/${lib}.a + + +${LIBDIR}/%.a: ${BOBJS} +ifeq (@,$(Q)) + @$(ECHO) "[$(BP)] ARLIB $(subst $(QTOP)/,,$@)" +endif + $Q$(RM) $@ + $Q$(AR) ${ARFLAGS} $@ $(sort ${BOBJS}) + +# if objs is not empty, let make .a +ifneq (,$(strip ${BOBJS})) +all:: ${BLDDIR}/.tree ${targetlib} + +$(targetlib): ${BOBJS} +ifneq (,${BOBJS}) +ifeq (@,$(Q)) + @$(ECHOE) "[$(BP)] ARLIB \e[1;32m$(subst $(QTOP)/,,$@) \e[m" +endif + $Q$(RM) $@ + $Q$(AR) ${ARFLAGS} $@ $(sort ${BOBJS}) +endif + +install:: all +clean:: +ifeq (@,$(Q)) + $Q$(ECHO) "[$(BP)] ClEAN OBJS ${LOCALDIR}" +endif + $Q$(RM) ${BOBJS} +ifdef EEEE + $Q$(RM) ${BOBJS:.o=.i} +endif + $Q$(RM) ${targetlib} + +distclean:: clean + +endif + + + + + diff --git a/qmk/generic/Make.subdirs b/qmk/generic/Make.subdirs new file mode 100644 index 00000000..b4305163 --- /dev/null +++ b/qmk/generic/Make.subdirs @@ -0,0 +1,39 @@ +# QMK for TencentOS +# @author Jimmin.huang jimmin@163.com +# Makefile template +######################################################################## + + + +.PHONY: ${subdirs} + + + +# only not treelib will do recursive subdir make +ifneq (,$(filter n no NO 0,$(TREE_LIB_ENABLE))) # no +# only have subdir, will do recursive subdir make +ifeq (,$(strip $(subdirs))) +subdirs = $(sort $(dir $(wildcard */Makefile))) +endif + +ifneq (,$(strip ${subdirs})) +# target +all:: ${subdirs} + @true + +${subdirs}:: +ifeq (@,$(Q)) + @$(ECHO) "[$(BP)] SUBDIR $(LOCALDIR)/$@ " +endif + $Q$(MAKE) -C $@ BP=${BP} + + +# target +clean clean_d install:: +ifeq (@,$(Q)) + @$(ECHO) "[$(BP)] $@ $(LOCALDIR)" +endif + @(for name in $(subdirs); do $(MAKE) -C $$name $@; done) + +endif +endif \ No newline at end of file diff --git a/qmk/generic/Make.tools b/qmk/generic/Make.tools new file mode 100644 index 00000000..d294bff7 --- /dev/null +++ b/qmk/generic/Make.tools @@ -0,0 +1,63 @@ +# QMK for TencentOS +# @author Jimmin.huang jimmin@163.com +# Makefile template +######################################################################## + +SYSOK = 0 +ifneq "$(SYSNAME)" "" +SYSOK = 1 # already set from environment +endif + + + +# unix or unix-type type hosts +ifeq "$(SYSOK)" "0" +SYSNAME := $(shell uname -s) + +ifeq "$(SYSNAME)" "Linux" +SYSOK = 1 +SED = /bin/sed +COMPRESS = /usr/bin/compress +GZIP = /usr/bin/gzip +TEST = /usr/bin/test +PERL = $(shell which perl) +LN = /bin/ln +TOUCH = /bin/touch +endif + + +ifeq "$(SYSNAME)" "Darwin" +SYSOK = 1 +SED = /usr/bin/sed +COMPRESS = /usr/bin/compress +GZIP = /usr/bin/gzip +LZMA = LZMA_NOT_DEFINED +TEST = /bin/test +PERL = $(shell which perl) +LN = /bin/ln +TOUCH = /usr/bin/touch +endif + +ifeq (MSYS_NT,$(findstring MSYS_NT,$(SYSNAME))) +SYSOK = 1 +SED = /usr/bin/sed +COMPRESS = /usr/bin/compress +GZIP = /usr/bin/gzip +LZMA = LZMA_NOT_DEFINED +TEST = /bin/test +PERL = $(shell which perl) +LN = /bin/ln +TOUCH = /usr/bin/touch +endif + +endif + +# +# Platform Independent +# +RM = /bin/rm -rf +CP = /bin/cp +MKDIR = /bin/mkdir -p +MAKEDEP = /bin/echo +ECHO = /bin/echo -e +ECHOE = /bin/echo -e \ No newline at end of file diff --git a/qmk/generic/Make.tpl b/qmk/generic/Make.tpl new file mode 100644 index 00000000..c392512c --- /dev/null +++ b/qmk/generic/Make.tpl @@ -0,0 +1,357 @@ +# QMK for TencentOS +# @author Jimmin.huang jimmin@163.com +# Makefile template +######################################################################## + +export QTOP +ALOWED_MAKE_VERSIONS :=3.82 +ifeq ($(MAKELEVEL),0) +ifeq ($(filter $(ALOWED_MAKE_VERSIONS),$(MAKE_VERSION)),) +#$(info Make $(MAKE_VERSION) not be tested, use one of $(ALOWED_MAKE_VERSIONS)) +$(info QMK for TOS) +endif +endif +ifeq ($(MAKELEVEL),0) +ifeq (help,$(findstring help,$(MAKECMDGOALS))) +NO_QMK_DEPS=1 +endif +endif +# the top Makefile node that include this file +CUR_MK_NODE_DIR = $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST)))) + +######################################################################## +# +# Set a default BP if one is not set. + + +SUPPORT-BP := $(sort $(subst $(QTOP)/qmk/board-pack/bp.,, $(wildcard $(QTOP)/qmk/board-pack/bp.*))) + + +ifndef BP + uname := $(shell uname -s) + ifeq ($(filter-out Linux Darwin,$(uname)),) + BP=Linux_Posix + endif + ifndef BP + BP=native + $(info Can't determine BP, `make help` see usage ) + endif + $(info assume default BP=${BP} ) +endif + +BP := ${BP} +export BP + + +# +# By default, turn off the "changing directory" message. +# +MAKEFLAGS += --no-print-directory + +# +# Use gmake by default +# +include ${QTOP}/qmk/generic/Make.tools + +include ${QTOP}/qmk/board-pack/bp.${BP} + + + +######################################################################## + +INCFLAGS = -I${QTOP}/arch/header -I${CUR_MK_NODE_DIR} -I${CUR_MK_NODE_DIR}/include -I${CUR_MK_NODE_DIR}/inc +INCFLAGS += -DBP=\"$(BP)\" -DFILE_NAME=\"$(subst $(dir $<),,$<)\" + +CFGFLAGS += ${INCFLAGS} +# STD_{C|CXX}FLAGS - Standard flags used by ALL compilations +# CFGFLAGS - Configuration flags used by ALL compilations + +CFLAGS += ${STD_CFLAGS} ${CFGFLAGS} $(ADD_CFLAGS) $(GLOBAL_CFLAGS) +CXXFLAGS += ${STD_CXXFLAGS} ${CFGFLAGS} $(ADD_CFLAGS) $(GLOBAL_CFLAGS) +LDFLAGS += ${STD_LDFLAGS} ${CFGLDFLAGS} $(ADD_LDFLAGS) $(GLOBAL_LDFLAGS) + + + + +V ?= 0 +# use to control printing of compilation lines +ifeq (0,$(V)) +#no VERBOSE +Q:=@ +else +# VERBOSE +Q:= +endif + +# +# Default location to place binaries and make depend files for building +# purposes. +# + +ifndef QTOPBUILD +QTOPBUILD :=build +endif +ifeq (,$(BLD_SUFFIX)) +BLD_SUFFIX := .tos +endif + +BLDROOT = ${QTOP}/${QTOPBUILD}/$(if ${BLDCONFIG},${BLDCONFIG}/)${BP}.$(notdir $(firstword $(CC)))${BLD_SUFFIX} +#$(info BLDROOT=$(BLDROOT)) + + +ifdef LOCALDIR +BLDDIR = ${BLDROOT}/${LOCALDIR} +else +BLDDIR = ${BLDROOT} +endif + +LIBDIR = ${BLDROOT} +OUTDIR = ${BLDROOT}/out + + +# +# In each directory, build a list of local sources, objects, and headers +# + +ifeq (,$(strip ${LSRCS})) # LSRCS +ifeq (,$(filter n no NO 0,$(TREE_LIB_ENABLE))) # TREE_LIB_ENABLE yes + +ifeq (,$(strip ${LSRCS_DIRS})) # LSRCS_DIRS +LSRCS_ALL = $(patsubst ./%,%, $(sort $(shell find . -name "*.c" -o -name "*.cpp" -o -name "*.s" -o -name "*.cc"))) +else +LSRCS_ALL = $(patsubst ./%,%, $(sort $(shell find ${LSRCS_DIRS} -name "*.c" -o -name "*.cpp" -o -name "*.s" -o -name "*.cc"))) +endif # LSRCS_DIRS + +else # TREE_LIB_ENABLE +LSRCS_ALL = $(patsubst ./%,%,$(sort $(wildcard *.c *.cpp *.s *.cc *.C))) # only include src in this dir. +endif # TREE_LIB_ENABLE + +endif # LSRCS + +ifneq (,$(strip ${LSRCS_EXCLUDE_FILES})) +$(info "ignore LSRCS_EXCLUDE_FILES source files: ${LSRCS_EXCLUDE_FILES}") +endif + +LSRCS = $(filter-out $(patsubst ./%,%,${LSRCS_EXCLUDE_FILES}),${LSRCS_ALL}) +LOBJS = $(addsuffix .o, $(basename ${LSRCS})) +BOBJS = $(addprefix ${BLDDIR}/,${LOBJS}) + +# +# Rule to create object file (build) directory +# + +.PHONY: all install clean + +.PRECIOUS: ${BLDDIR}/.tree $(EXECDIR) + +%/.tree: + @$(ECHO) "[$(BP)] MKDIR $(dir $@)" + $Q($(MKDIR) $(dir $@); $(TOUCH) $@) + +# Rule allowing build through CPP only, creates .i file from .c file. + +%.i: %.c + @$Q$(ECHO) "EEEE ${LOCALDIR}/$<" + $Q$(CC) -E ${CFLAGS} $< | $(SED) -e '/^ *$$/d' -e p -e d > $@ + +# Rule allowing build through source only, creates .s file from .c file. + +%.s: %.c + $Q$(CC) -S ${CFLAGS} $< + + +NO_QMK_DEPS = 1 + +# allow disabling of dependency file generation +# enable partial recompilation through use of included +# dependency makefiles +# +ifndef NO_QMK_DEPS +# take the compiler generated .d file and reparse it +# to generate a dependency graph rule for this object +# file +# the two steps generate: +# file.o: file.c \ +# file.h ... +# +# file.h: +# header.h: +# some compilers will generate errors without the latter +# part of the list + +.PHONY: .phony + +zDEPS_SED = \ + $(CP) $(BLDDIR)/$*.d $(BLDDIR)/$*.tmp;\ + $(ECHO) >> $(BLDDIR)/$*.tmp;\ + $(SED) -e 's/\#.*//' -e 's/^[^:]*: *//' \ + -e 's/ *\\$$//' -e '/^$$/ d' -e 's/$$/ :/' \ + -e '/^ .$$/d' \ + < $(BLDDIR)/$*.d >> $(BLDDIR)/$*.tmp; \ + $(SED) -e 's|^\([^\/ ].*\.o\):|'$(BLDDIR)/'\1:|g' \ + -e 's|.*?/\(.*\.o\):|'$(BLDDIR)/'\1:|g' \ + < $(BLDDIR)/$*.tmp > $(BLDDIR)/$*.P; \ + $(RM) -f $(BLDDIR)/$*.d $(BLDDIR)/$*.tmp +zDEPS_CMD = $(zDEPS_SED) + + +# newer gnu-based compilers allow -MD -MF +zDEPS_OPT = -MD -MF $(BLDDIR)/$*.d +zDEPS_CMD = $(zDEPS_SED) + + +# From gmsl + +# Standard definitions for true and false. true is any non-empty +# string, false is an empty string. These are intended for use with +# $(if). + +true := T +false := + +# ---------------------------------------------------------------------------- +# Function: not +# Arguments: 1: A boolean value +# Returns: Returns the opposite of the arg. (true -> false, false -> true) +# ---------------------------------------------------------------------------- +not = $(if $1,$(false),$(true)) + +# ---------------------------------------------------------------------------- +# Function: map +# Arguments: 1: Name of function to $(call) for each element of list +# 2: List to iterate over calling the function in 1 +# Returns: The list after calling the function on each element +# ---------------------------------------------------------------------------- +map = $(strip $(foreach a,$2,$(call $1,$a))) + +# ---------------------------------------------------------------------------- +# Function: seq +# Arguments: 1: A string to compare against... +# 2: ...this string +# Returns: Returns $(true) if the two strings are identical +# ---------------------------------------------------------------------------- +seq = $(if $(filter-out xx,x$(subst $1,,$2)$(subst $2,,$1)x),$(false),$(true)) + +# ---------------------------------------------------------------------------- +# Function: sne +# Arguments: 1: A string to compare against... +# 2: ...this string +# Returns: Returns $(true) if the two strings are not the same +# ---------------------------------------------------------------------------- +sne = $(call not,$(call seq,$1,$2)) + +# End from gmsl + +# Define comma symbol so we can repace it with a variable +comma :=, + +# Signature +last_target := + +adump_var = $$(eval $1 := $($1)) + +define new_rule +@echo '$(call map,adump_var,@ < *)' > $S +@$(if $(wildcard $F),,touch $F) +@echo $@: $F >> $S +endef + +define zdo +$(eval S := $(BLDDIR)/$*.sig)$(eval F := $(BLDDIR)/$*.force)$(eval C := $1) +$(if $(call sne,$@,$(last_target)),$(call new_rule),$(eval last_target := $@)) +@echo '$$(if $$(call sne,$$(sort $1),$(sort $(subst $(comma),$$(comma),$C))),$$(shell touch $F))' >> $S +$Q$C +endef + +# end of Signature + + +else # ifndef NO_QMK_DEPS +# No dependency files, faster compile times +# no partial compile support +zDEPS_SED = +zDEPS_OPT = +zDEPS_CPY = +zDEPS_CMD = /bin/true + +define zdo +$(eval C := $1) +$Q$C +endef + +endif # ifndef NO_QMK_DEPS + +# +# Default Build rules for .c --> .o, leaving the binary in BLDDIR/X.o, +# even if file not built from directory of source. +# + +${BLDDIR}/%.o: %.c +ifdef EEEE + @$Q$(ECHO) "EEEE ${LOCALDIR}/$<" + $Q$(CC) -E ${CFLAGS} $(EXTRA_CFLAGS) $< | $(SED) -e '/^ *$$/d' -e p -e d > $(@:.o=.i) +endif +# echo Compiling needed to properly process errors + $Q$(MKDIR) $(BLDDIR)/ + $Q$(MKDIR) $(dir $@) + $Q$(RM) -f $@ + @$Q$(ECHO) "[$(BP)] CCCC ${LOCALDIR}/$<" + $Q$(call zdo,$$(CC) $$(zDEPS_OPT) $$(CFLAGS) $$(EXTRA_CFLAGS) -o $$@ -c $$(realpath $$<)) && ($(zDEPS_CMD)) + +${BLDDIR}/%.o: %.s +ifeq (@,$(Q)) + @$(ECHO) ASAS ${LOCALDIR}/$< +endif + $Q$(CC) ${CFLAGS} ${EXTRA_CFLAGS} -o $@ -c $(realpath $<) + +${BLDDIR}/%.o: %.cpp +ifeq (@,$(Q)) + @$(ECHO) "[$(BP)] CCCC ${LOCALDIR}/$<" +endif + $Q$(CXX) ${CXXFLAGS} -o $@ -c $(realpath $<) + +${BLDDIR}/%.o: %.cc ${BLDDIR}/.tree +ifeq (@,$(Q)) + @$(ECHO) "[$(BP)] CCCC ${LOCALDIR}/$<" +endif + $Q$(CXX) ${CXXFLAGS} -o $@ -c $(realpath $<) + +# +# Cause "make foo.o" in any subdirectory to put the object in the build +# directory instead of the local directory. +# +%.o: ${BLDDIR}/%.o + @ + +# +# Targets for build +# +ifeq ($(MAKELEVEL),0) +ifeq (help,$(findstring help,$(MAKECMDGOALS))) +.PHONY: help +help: + $Q$(ECHO) "Usage:" + $Q$(ECHO) -e "\t make help" + $Q$(ECHO) -e "make for specified board-pack" + $Q$(foreach v, $(SUPPORT-BP), $(call zdo, $$(ECHO) -e "\t make BP=$$(v)") ) + $Q$(ECHO) -e "\t BP dir are: $(QTOP)/qmk/board-pack/" + $Q$(ECHO) -e "Clean build" + $Q$(ECHO) -e "\t make clean all" + $Q$(ECHO) -e "Debug build, verbose print, generate preprocess .i for .c" + $Q$(ECHO) -e "\t make V=1 " + $Q$(ECHO) -e "\t make EEEE=1 " + $Q$(ECHO) -e "Debug Makefile" + $Q$(ECHO) -e "\t make dm" +endif +endif + + + +include ${QTOP}/qmk/generic/Make.lib +include ${QTOP}/qmk/generic/Make.subdirs +include ${QTOP}/qmk/generic/Make.depend + + +include ${QTOP}/qmk/generic/Make.debug + +