makefile文件结构:
1.可执行文件makeapp.bat
2.总目录下makefile
3.源文件目录下makefile
范例及说明:
1.可执行文件makeapp.bat
set WIND_BASE=C:\\Tornado22 //设置Tornado所在目录
set WIND_HOST_TYPE=x86-win32 //设置主机类型
set path=%WIND_BASE%\\host\\%WIND_HOST_TYPE%\\bin;%path%
set CPU=PPC604 //设置运行环境CPU类型
set TOOL=gnu
set OS=VXWORKS //设置运行环境操作系统
set VOB_DIR=z: //设置源文件根目录
set MINOR_VERSION=5.5
make -f makefile //指定总目录下makefile文件名
2.总目录下makefile:
# Project type: library, vxapp
PRJ_TYPE = vxapp
# Build Directory
PRJ_DIR = $(VOB_DIR)/wbg_wimax/bs/cp //目标目录
#define source path
EXECUTABLE := $(PRJ_DIR)/cmac.out //生成.out名及目录
OBJS := $(PRJ_DIR)/cmac/src/cmac.o $(PRJ_DIR)/app/src/app.o \\
$(PRJ_DIR)/hwm/src/hwm.o $(PRJ_DIR)/oam/src/oam.o \\
$(PRJ_DIR)/rrm/src/rrm.o $(PRJ_DIR)/r1/src/r1.o //生成目标名及目录
PRJ_LIBS :=
# Tornado default build environment
include $(VOB_DIR)/3g_build/make.$(CPU)$(TOOL) //build环境目录
.PHONY : exe deps objs clean veryclean rebuild
exe : //make执行目录列表
$(MAKE) -C $(PRJ_DIR)/cmac/src
$(MAKE) -C $(PRJ_DIR)/app/src
$(MAKE) -C $(PRJ_DIR)/hwm/src
$(MAKE) -C $(PRJ_DIR)/oam/src
$(LD) -N -r -o $(EXECUTABLE) $(OBJS)
clean : //make clean执行目录列表
$(MAKE) -C $(PRJ_DIR)/cmac/src -f makefile clean
$(MAKE) -C $(PRJ_DIR)/app/src -f makefile clean
$(MAKE) -C $(PRJ_DIR)/hwm/src -f makefile clean
$(MAKE) -C $(PRJ_DIR)/oam/src -f makefile clean
veryclean: //make veryclean执行目录列表
$(MAKE) -C $(PRJ_DIR)/cmac/src -f makefile veryclean
$(MAKE) -C $(PRJ_DIR)/app/src -f makefile veryclean
$(MAKE) -C $(PRJ_DIR)/hwm/src -f makefile veryclean
$(MAKE) -C $(PRJ_DIR)/oam/src -f makefile veryclean
$(RM) $(EXECUTABLE)
rebuild: veryclean exe
### The end of makefile
3.源文件目录下makefile:
# Project type: library, vxapp
PRJ_TYPE = vxapp
# Build Directory
3G_BUILD_DIR = $(VOB_DIR)/3g_build
PRJ_DIR = $(VOB_DIR)/wbg_wimax/bs/cp/cmac/src
# Self-defined compiler options (Public define in 3g_build/makefile.def)
SELF_CFLAGS =
SELF_CPPFLAGS =
SELF_INCLUDE = -I../../cmac/inc \\
-I../../oam/inc \\
-I../../common/inc \\
-I../../app/inc \\
-I../../hwm/inc \\
-I../../r1/inc \\
-I../../rrm/inc \\
-I../../../../common/r64tlv/inc //头文件搜索列表
SELF_DEFINE = -DENABLE_STATIC_ARP
#define source path
EXECUTABLE := $(PRJ_DIR)/cmac.o //生成目标文件名及目录
ADDLIBS :=
#include makefile.def which defined by Cody.tian
include $(3G_BUILD_DIR)/makefile.def
因篇幅问题不能全部显示,请点此查看更多更全内容