1.make系统安装

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

2.make系统结构

Tinyos 第三版Make系统-LMLPHP

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

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

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

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

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

 #  Set the rules that expand PFLAGS (which have %T in them) to the PFLAGS that
# nescc sees when it compiles.
TOSDIR_OPTS = $(addprefix --tosdir ,$(TOSMAKE_OS_DIR_ALL))
ADD_SIM_DIRS = $(if $(filter sim sim-fast sim-sf,$(GOALS)),--sim,)
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
 # Colors
ifndef TOSMAKE_NO_COLOR
NO_COLOR=\x1b[0m
OK_COLOR=\x1b[;01m
ERROR_COLOR=\x1b[;01m
WARN_COLOR=\x1b[;01m
INFO_COLOR=\x1b[;01m
endif OK_STRING=$(OK_COLOR)[OK]$(NO_COLOR)
ERROR_STRING=$(ERROR_COLOR)[ERROR]$(NO_COLOR)
WARN_STRING=$(WARN_COLOR)[WARNING]$(NO_COLOR)
INFO_STRING=$(INFO_COLOR)[INFO]$(NO_COLOR)

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

05-11 22:45