Mod aaa-12 更新demo工程

RCA:
SOL:
修改人:huangxin
检视人:huangxin
This commit is contained in:
黄昕 2019-06-17 17:05:32 +08:00
parent 4f2171276f
commit 3c5d00285b
4 changed files with 54 additions and 11 deletions

View File

@ -370,6 +370,7 @@ PLAT_LINUX_OBJS :=
PLAT_LINUX_DEPS :=
endif
$(info objects:[$(PLAT_LINUX_OBJS)])
# 构建系统最终需要生成的目标,包含 ARM64 和 Linux 平台
ALL_OBJS += $(PLAT_ARM64_OBJS) $(PLAT_LINUX_OBJS)
ALL_DEPS += $(PLAT_ARM64_DEPS) $(PLAT_LINUX_DEPS)

View File

@ -34,14 +34,16 @@ all: demo conntrack netlink trace
ifeq ($(OPT), install)
#$(shell `find ../release -name "*.zip" -delete`)
else ifeq ($(OPT), clean)
#
else
$(shell chmod +x ./build_env.sh && ./build_env.sh)
endif
ifeq ($(OPT), clean)
#
endif
$(shell chmod +x ./build_env.sh)
$(shell test -e ./Common/compile.h || ./build_env.sh)
demo:
ifeq ($(OPT), clean)

View File

@ -21,18 +21,22 @@ DEBUG = TRUE
PLAT_LINUX ?= TRUE
PLAT_ARM64 ?= TRUE
VPATH = ../user/demo
SRC_DIR = ../user/demo
VPATH = $(SRC_DIR)
# source code
# set the source file, don't used .o because of ...
# MRS Board Source Files
PLAT_LINUX_SRCS := main.c version.c
# Linux Board Source Files
PLAT_LINUX_SRCS := $(subst $(SRC_DIR)/, , $(wildcard $(SRC_DIR)/*.c))
#main.c version.c
PLAT_ARM64_SRCS := $(PLAT_LINUX_SRCS)
# gcc CFLAGS
PLAT_LINUX_CFLAGS += -DVERSION=\"v0.0.0.1\"
PLAT_ARM64_CFLAGS += -DVERSION=\"v0.0.0.1\"
COMMON_CFLAGS := -I../../Common
PLAT_LINUX_CFLAGS += $(COMMON_CFLAGS)
PLAT_ARM64_CFLAGS += $(COMMON_CFLAGS)
# this line must be at below of thus, because of...
include ../../Common/common.Makefile

View File

@ -1,9 +1,45 @@
#include <stdio.h>
#include <unistd.h>
#include <getopt.h>
extern const char* get_version(void);
#include "compile.h"
/**
* @brief
* @note
* @param argc:
* @param **argv:
* @retval 0
*/
int main(int argc, char **argv)
{
fprintf(stdout, "Hello vBRAS Product user demo version: %ld\n", get_version());
return 0;
int c, optidx = 0;
opterr = 0;
static struct option long_opts[] = {
{ "help", 0, 0, 'h' },
{ "version", 0, 0, 'v' },
// TODO 添加其它需要处理的参数配置
{ 0, 0, 0, 0 }
};
while((c = getopt_long(argc, argv, "hv", long_opts, &optidx)) != -1)
{
switch (c)
{
case 'v':
fprintf(stdout, "User demo version: %s(%s)\n", sGATE_GIT_TAGS, sGATE_GIT_VERS);
break;
//TODO 添加其它必要处理参数过程
case '?':
case 'h':
fprintf(stdout, "Usage: %s [-h] [-v] ...\n", argv[0]);
fprintf(stdout, "options:\n");
fprintf(stdout, "\t-v, --version show program version\n");
fprintf(stdout, "\t-h, --help print this message\n");
break;
}
}
return 0;
}