From 4222a47d6a82954a8e2e144513c2867ba85d4013 Mon Sep 17 00:00:00 2001 From: AceVest Date: Wed, 20 Jun 2018 20:48:48 +0800 Subject: [PATCH] add rtos --- learn/doc/mac_bash_profile | 5 ++-- rtos/components/debug/component.mk | 0 rtos/components/test/component.mk | 0 rtos/make/makefile | 12 +++++++++ rtos/make/project.mk | 43 ++++++++++++++++++++++++++++++ 5 files changed, 58 insertions(+), 2 deletions(-) create mode 100644 rtos/components/debug/component.mk create mode 100644 rtos/components/test/component.mk create mode 100644 rtos/make/makefile create mode 100644 rtos/make/project.mk diff --git a/learn/doc/mac_bash_profile b/learn/doc/mac_bash_profile index a6103c2..5574c03 100644 --- a/learn/doc/mac_bash_profile +++ b/learn/doc/mac_bash_profile @@ -5,13 +5,14 @@ HISTCONTROL=ignoreboth #export PATH="$(brew --prefix homebrew/php/php56)/bin:$PATH" export PATH=/usr/local/sbin:$PATH export PATH=/Users/Ace/.local/bin:$PATH -export PATH=$PATH:$HOME/esp/xtensa-esp32-elf/bin +export PATH=$PATH:$HOME/workspace/esp/xtensa-esp32-elf/bin export GOBIN=/Users/Ace/.local/bin -export IDF_PATH=$HOME/esp/esp-idf +export IDF_PATH=$HOME/workspace/esp/esp-idf export PATH=$PATH:/Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin/ export PATH=$PATH:$HOME/Library/Arduino15/packages/arduino/tools/avrdude/6.0.1-arduino5/bin #多个GOPATH用';'分隔 go get会存到第一个目录 export GOPATH=/Users/Ace/go +export RTOS_PATH=$HOME/workspace/acecode/rtos/ export PS1="\W\$ " alias ll='ls -lGh' alias ls='ls -Gh' diff --git a/rtos/components/debug/component.mk b/rtos/components/debug/component.mk new file mode 100644 index 0000000..e69de29 diff --git a/rtos/components/test/component.mk b/rtos/components/test/component.mk new file mode 100644 index 0000000..e69de29 diff --git a/rtos/make/makefile b/rtos/make/makefile new file mode 100644 index 0000000..a3388c7 --- /dev/null +++ b/rtos/make/makefile @@ -0,0 +1,12 @@ +include project.mk + + +.PHONY: test +test: + echo $(OS) + @echo $(wildcard $(RTOS_PATH)) + @echo $(realpath $(wildcard $(RTOS_PATH))) + @echo $(COMPONENTS) + @echo $(COMPONENT_DIRS) + @echo $(foreach cd,$(COMPONENT_DIRS), $(wildcard $(cd)/*/component.mk)) + diff --git a/rtos/make/project.mk b/rtos/make/project.mk new file mode 100644 index 0000000..7423e9f --- /dev/null +++ b/rtos/make/project.mk @@ -0,0 +1,43 @@ + + # ?= 的意思是如果没有赋值过则赋值?=后面的值 +OS ?= + + # ifeq 的意思是判断是否相等 +ifeq ("$(OS)", "Windows_NT") +$(error "Unsupport build platform") +else + # wildcard 展开通配符 + # realpath 对于名称中的每个文件名返回规范绝对名称。规范名称不包含任何.或..成分,也没有任何重复的路径分隔符(/)或符号链接 +export RTOS_PATH := $(realpath $(wildcard $(RTOS_PATH))) +endif + +ifndef RTOS_PATH +$(error "RTOS_PATH not define") +endif + +ifndef PROJECT_PATH + # MAKEFILE_LIST 列出make用到的所有文件 + # firstword 取第一个单词 + # dir 求路径 + # abspath 求绝对路径 + # export定义一个变量、下级makefile可以访问, export VAR := 'var' <==> VAR := 'var' 和 export VAR 两条命令 +PROJECT_PATH := $(abspath $(dir $(firstword $(MAKEFILE_LIST)))) +export PROJECT_PATH +else +$(error "PROJECT_PATH was polluted") +endif + +ifndef BUILD_DIR_BASE +export BUILD_DIR_BASE := $(PROJECT_PATH)/build +endif + +ifndef COMPONENT_DIRS +export COMPONENT_DIRS := $(PROJECT_PATH)/components $(RTOS_PATH)/components $(PROJECT_PATH)/main +endif + +#ifndef COMPONENTS +COMPONENTS := $(dir $(foreach cd,$(COMPONENT_DIRS), \ + $(wildcard $(cd)/*/component.mk) $(wildcard $(cd)/component.mk))) + +export COMPONENTS +#endif -- 2.44.0