forked from Cloud-PG/dodas-go-client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
78 lines (60 loc) · 1.82 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
VERSION?=`git describe --tags`
DOCBIN?=mkdocs
BUILD_DATE := `date +%Y-%m-%d\ %H:%M`
VERSIONFILE := version.go
GOCMD=go
GOBUILD=$(GOCMD) build -mod=vendor -installsuffix cgo -a -x -ldflags "-w -v"
GOBUILD_DBG=$(GOCMD) build -x -mod=vendor
GOCLEAN=$(GOCMD) clean
GOTEST=$(GOCMD) test
GOGET=$(GOCMD) get
BINARY_NAME=dodas
REPO=github.com/dodas-ts/dodas-go-client
export GO111MODULE=on
# Force 64 bit architecture
export GOARCH=amd64
all: build test
build:
$(GOBUILD) -o $(BINARY_NAME)
build-debug:
env CGO_ENABLED=0 $(GOBUILD_DBG) -o $(BINARY_NAME) -v
doc:
cp README.md docs/README.md
BUILD_DOC=true ./$(BINARY_NAME)
publish-doc:
cp README.md docs/README.md
$(DOCBIN) gh-deploy
test: build
$(GOTEST) -v ./...
./$(BINARY_NAME) validate --template tests/tosca/valid_template.yml
./$(BINARY_NAME) validate --template tests/tosca/broken_template_type.yaml
./$(BINARY_NAME) validate --template tests/tosca/broken_template_node.yaml
clean:
$(GOCLEAN)
rm -f $(BINARY_NAME)
run: build
./$(BINARY_NAME)
install:
$(GOCMD) install $(REPO)
tidy:
$(GOCMD) mod tidy
$(GOCMD) mod vendor
docker-bin-build:
docker run --rm -it -v ${PWD}:/go -w /go/ golang:1.13.6 go build -mod vendor -o "$(BINARY_NAME)" -v
docker-img-build:
docker build . -t dodas
windows-build:
env GOOS=windows CGO_ENABLED=0 $(GOBUILD) -mod vendor -o $(BINARY_NAME).exe -v
macos-build:
env GOOS=darwin CGO_ENABLED=0 $(GOBUILD) -mod vendor -o $(BINARY_NAME)_osx -v
gensrc:
rm -f $(VERSIONFILE)
@echo "package main" > $(VERSIONFILE)
@echo "const (" >> $(VERSIONFILE)
@echo " VERSION = \"$(VERSION)\"" >> $(VERSIONFILE)
@echo " BUILD_DATE = \"$(BUILD_DATE)\"" >> $(VERSIONFILE)
@echo ")" >> $(VERSIONFILE)
build-release: tidy gensrc build doc publish-doc test windows-build macos-build
zip dodas.zip dodas
zip dodas.exe.zip dodas.exe
zip dodas_osx.zip dodas_osx