]> Zhao Yanbai Git Server - acecode.git/commitdiff
add rtos
authorAceVest <zhaoyanbai@126.com>
Wed, 20 Jun 2018 12:48:48 +0000 (20:48 +0800)
committerAceVest <zhaoyanbai@126.com>
Wed, 20 Jun 2018 12:48:48 +0000 (20:48 +0800)
learn/doc/mac_bash_profile
rtos/components/debug/component.mk [new file with mode: 0644]
rtos/components/test/component.mk [new file with mode: 0644]
rtos/make/makefile [new file with mode: 0644]
rtos/make/project.mk [new file with mode: 0644]

index a6103c2e9f1420c032df863b2feca426abf38f85..5574c0389a364c93866bb32572c453083d33161a 100644 (file)
@@ -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 (file)
index 0000000..e69de29
diff --git a/rtos/components/test/component.mk b/rtos/components/test/component.mk
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/rtos/make/makefile b/rtos/make/makefile
new file mode 100644 (file)
index 0000000..a3388c7
--- /dev/null
@@ -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 (file)
index 0000000..7423e9f
--- /dev/null
@@ -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