parent
4f2171276f
commit
3c5d00285b
|
@ -370,6 +370,7 @@ PLAT_LINUX_OBJS :=
|
||||||
PLAT_LINUX_DEPS :=
|
PLAT_LINUX_DEPS :=
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
$(info objects:[$(PLAT_LINUX_OBJS)])
|
||||||
# 构建系统最终需要生成的目标,包含 ARM64 和 Linux 平台
|
# 构建系统最终需要生成的目标,包含 ARM64 和 Linux 平台
|
||||||
ALL_OBJS += $(PLAT_ARM64_OBJS) $(PLAT_LINUX_OBJS)
|
ALL_OBJS += $(PLAT_ARM64_OBJS) $(PLAT_LINUX_OBJS)
|
||||||
ALL_DEPS += $(PLAT_ARM64_DEPS) $(PLAT_LINUX_DEPS)
|
ALL_DEPS += $(PLAT_ARM64_DEPS) $(PLAT_LINUX_DEPS)
|
||||||
|
|
8
Makefile
8
Makefile
|
@ -33,15 +33,17 @@ endif
|
||||||
all: demo conntrack netlink trace
|
all: demo conntrack netlink trace
|
||||||
|
|
||||||
ifeq ($(OPT), install)
|
ifeq ($(OPT), install)
|
||||||
#$(shell `find ../release -name "*.zip" -delete`)
|
#$(shell `find ../release -name "*.zip" -delete`)
|
||||||
|
else ifeq ($(OPT), clean)
|
||||||
|
#
|
||||||
|
else
|
||||||
|
$(shell chmod +x ./build_env.sh && ./build_env.sh)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(OPT), clean)
|
ifeq ($(OPT), clean)
|
||||||
#
|
#
|
||||||
endif
|
endif
|
||||||
|
|
||||||
$(shell chmod +x ./build_env.sh)
|
|
||||||
$(shell test -e ./Common/compile.h || ./build_env.sh)
|
|
||||||
|
|
||||||
demo:
|
demo:
|
||||||
ifeq ($(OPT), clean)
|
ifeq ($(OPT), clean)
|
||||||
|
|
|
@ -21,18 +21,22 @@ DEBUG = TRUE
|
||||||
PLAT_LINUX ?= TRUE
|
PLAT_LINUX ?= TRUE
|
||||||
PLAT_ARM64 ?= TRUE
|
PLAT_ARM64 ?= TRUE
|
||||||
|
|
||||||
VPATH = ../user/demo
|
SRC_DIR = ../user/demo
|
||||||
|
|
||||||
|
VPATH = $(SRC_DIR)
|
||||||
|
|
||||||
# source code
|
# source code
|
||||||
|
|
||||||
# set the source file, don't used .o because of ...
|
# set the source file, don't used .o because of ...
|
||||||
# MRS Board Source Files
|
# Linux Board Source Files
|
||||||
PLAT_LINUX_SRCS := main.c version.c
|
PLAT_LINUX_SRCS := $(subst $(SRC_DIR)/, , $(wildcard $(SRC_DIR)/*.c))
|
||||||
|
#main.c version.c
|
||||||
PLAT_ARM64_SRCS := $(PLAT_LINUX_SRCS)
|
PLAT_ARM64_SRCS := $(PLAT_LINUX_SRCS)
|
||||||
|
|
||||||
# gcc CFLAGS
|
# gcc CFLAGS
|
||||||
PLAT_LINUX_CFLAGS += -DVERSION=\"v0.0.0.1\"
|
COMMON_CFLAGS := -I../../Common
|
||||||
PLAT_ARM64_CFLAGS += -DVERSION=\"v0.0.0.1\"
|
PLAT_LINUX_CFLAGS += $(COMMON_CFLAGS)
|
||||||
|
PLAT_ARM64_CFLAGS += $(COMMON_CFLAGS)
|
||||||
|
|
||||||
# this line must be at below of thus, because of...
|
# this line must be at below of thus, because of...
|
||||||
include ../../Common/common.Makefile
|
include ../../Common/common.Makefile
|
||||||
|
|
|
@ -1,9 +1,45 @@
|
||||||
#include <stdio.h>
|
#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)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
fprintf(stdout, "Hello vBRAS Product user demo version: %ld\n", get_version());
|
int c, optidx = 0;
|
||||||
return 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;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue