/
Makefile
61 lines (47 loc) · 1.08 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
##
## Makefile to test and build the gladius binaries
##
##
# GLOBAL VARIABLES
##
# if we are running on a windows machine
# we need to append a .exe to the
# compiled binary
BINARY_SUFFIX=
ifeq ($(OS),Windows_NT)
BINARY_SUFFIX=.exe
endif
ifeq ($(GOOS),windows)
BINARY_SUFFIX=.exe
endif
# code source and build directories
SRC_DIR=./cmd
DST_DIR=./build
CTL_SRC=$(SRC_DIR)/
CTL_SRC_PROF=$(SRC_DIR)/gladius-network-gateway-profiler
BINARY=gladius-network-gateway$(BINARY_SUFFIX)
CTL_DEST=$(DST_DIR)/$(BINARY)
# commands for go
GOMOD=GO111MODULE=on
GOBUILD=$(GOMOD) go build
GOTEST=$(GOMOD) go test
GOCLEAN=$(GOMOD) go clean
##
# MAKE TARGETS
##
# general make targets
all: clean network-gateway
clean:
@rm -rf ./build/*
@$(GOMOD) go mod tidy
@$(GOCLEAN) $(CTL_SRC)
# dependency management
dependencies:
# download our modules
@$(GOMOD) go mod download
lint:
@gometalinter --linter='vet:go tool vet -printfuncs=Infof,Debugf,Warningf,Errorf:PATH:LINE:MESSAGE' cmd/main.go
test: $(CTL_SRC)
@$(GOTEST) $(CTL_SRC)
network-gateway: test
@$(GOBUILD) -o $(CTL_DEST)$(BINARY_SUFFIX) $(CTL_SRC)