Makefile 1.49 KB
Newer Older
qiuqunfeng's avatar
qiuqunfeng committed
1 2 3 4 5 6 7 8 9 10 11
VERSION = 0.1.0

## 判断操作系统及内核架构
UNAME_S := $(shell uname -s)
UNAME_M := $(shell uname -m)

#ifeq ($(UNAME_S),Linux)
#	LDFLAGS = -extldflags "-static"
#endif

## 指定镜像仓库地址: "地址:端口/项目"
liuqianli's avatar
modify  
liuqianli committed
12
REPOPREFIX?=harbor.tensorsecurity.com/tensorsecurity
qiuqunfeng's avatar
qiuqunfeng committed
13 14

## 指定镜像tag
liuqianli's avatar
modify  
liuqianli committed
15
IMAGETAG?=testcn
qiuqunfeng's avatar
qiuqunfeng committed
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31

## 指定国内源
MIRROR_SOURCE?=mirrors.aliyun.com

## holmes-packages的镜像tag
FETCHTAG?=latest

## base image的tag
BASE_IMAGE_TAG?=latest

## license版本: "sit"/"release"
LICENSE_SECRET?=sit

## 指定bin目录
BIN_DIR = $(shell pwd)/bin/

qiuqunfeng's avatar
qiuqunfeng committed
32 33
GOBIN ?= go

qiuqunfeng's avatar
qiuqunfeng committed
34 35 36 37
.PHONY: help
help:
	@fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##//'

qiuqunfeng's avatar
qiuqunfeng committed
38 39 40 41 42 43 44 45 46 47 48

download:
	$(GOBIN) mod tidy

.PHONY: build
build: download
	@echo "build waf-console"
	$(GOBIN) build -v \
		-tags=jsoniter -o dist/waf-console gitlab.com/tensorsecurity-rd/waf-console/cmd
	#upx --lzma --best dist/waf-console

qiuqunfeng's avatar
commit  
qiuqunfeng committed
49 50 51
.PHONY: waf-console
waf-console:
	@echo "build waf-console"
qiuqunfeng's avatar
qiuqunfeng committed
52
	$(GOBIN) build -v \
qiuqunfeng's avatar
commit  
qiuqunfeng committed
53 54
		-tags=jsoniter -o dist/waf-console gitlab.com/tensorsecurity-rd/waf-console/cmd
	#upx --lzma --best dist/waf-console
liuqianli's avatar
modify  
liuqianli committed
55
	docker build -t $(REPOPREFIX)/waf-console:$(IMAGETAG) -f ./build/Dockerfile .
56 57 58 59 60 61 62 63

.PHONY: waf-api-server
waf-api-server:
	@echo "build waf-api-server"
	$(GOBIN) build -v \
		-tags=jsoniter -o dist/waf-api-server gitlab.com/tensorsecurity-rd/waf-console/cmd/api-server
	#upx --lzma --best dist/waf-api-server
	docker build -t $(REPOPREFIX)/waf-api-server:$(IMAGETAG) -f ./build/api-server/Dockerfile .