Tinyos 第三版Make系统

1.make系统安装

cd tools
./Bootstrap
./configure
make
sudo make install

 

2.make系统结构

3.第三版Makerules文件部分解析

 1 #  Allow users to specify additional directories to find .target, .extra, and
 2 #  .rules files. This allows for platforms to be stored in separate repositories
 3 #  and still compile against the main TinyOS code.
 4 #
 5 #  To use this feature, set the environment variable TINYOS_ROOT_DIR_ADDITIONAL
 6 #  to a space or colon separated list of additional paths to make folders you would
 7 #  like the make system to search.
 8 #
 9 #  Make expects space seperated lists, but ':' seperated is easier to read.  We
10 #  convert ':' to ' ' below so Make is happy.
11 #
12 ROOT_DIR_ADDITIONAL = $(subst :, ,$(TINYOS_ROOT_DIR_ADDITIONAL))
13 TOSMAKE_PATH = $(addsuffix /support/make,$(ROOT_DIR_ADDITIONAL))
14 TOSMAKE_PATH += $(TINYOS_MAKE_DIR)

添加附加的make目录。以“:”分隔开。

 

1 #  Also determine the path for all TinyOS OS directories that may have code in
2 #  them. This makes out-of-tree builds and multiple TinyOS code trees very easy
3 #  to manage. All relevant folders will automatically be included to the call to
4 #  nescc.
5 TOSMAKE_OS_DIR_ALL = $(addsuffix /tos,$(ROOT_DIR_ADDITIONAL)) $(TINYOS_OS_DIR)
6 
7 # Create identifying flags for the particular application, user, timestamp, etc.
8 IDENT_FLAGS := $(shell tos-ident-flags "$(COMPONENT)")
9 CFLAGS += $(IDENT_FLAGS)

第五行定义了全部make路径的变量。8-9行定义了指定目标组件的参数。

 

1 #  Set the rules that expand PFLAGS (which have %T in them) to the PFLAGS that
2 #  nescc sees when it compiles.
3 TOSDIR_OPTS = $(addprefix --tosdir ,$(TOSMAKE_OS_DIR_ALL))
4 ADD_SIM_DIRS = $(if $(filter sim sim-fast sim-sf,$(GOALS)),--sim,)
5 NESC_PFLAGS = $(shell tos-sub-tosdir $(TOSDIR_OPTS) $(ADD_SIM_DIRS) $(PFLAGS) $(TOSMAKE_PFLAGS_STD_INCLUDE))

此段代码是获取nesc编译参数中的路径参数,其中tos-sub-tosdir是创建nescc路径命令。使用以下命令查询:

tos-sub-tosdir --help

 

 1 # Colors
 2 ifndef TOSMAKE_NO_COLOR
 3 NO_COLOR=\x1b[0m
 4 OK_COLOR=\x1b[32;01m
 5 ERROR_COLOR=\x1b[31;01m
 6 WARN_COLOR=\x1b[33;01m
 7 INFO_COLOR=\x1b[34;01m
 8 endif
 9 
10 OK_STRING=$(OK_COLOR)[OK]$(NO_COLOR)
11 ERROR_STRING=$(ERROR_COLOR)[ERROR]$(NO_COLOR)
12 WARN_STRING=$(WARN_COLOR)[WARNING]$(NO_COLOR)
13 INFO_STRING=$(INFO_COLOR)[INFO]$(NO_COLOR)

此段代码是指定了OK,ERROR等的显示颜色设置。

 

posted @ 2016-10-06 18:50  ZYVV  阅读(298)  评论(0编辑  收藏  举报