This repository has been archived by the owner on May 3, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 25
/
Makefile
executable file
·85 lines (69 loc) · 2.04 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
79
80
81
82
83
84
85
export GO15VENDOREXPERIMENT=1
DEPS = $(go list -f '{{range .TestImports}}{{.}} {{end}}' ./... | grep -v /vendor/)
WEBSITE="github.com/mephux/envdb"
DESCRIPTION="Ask your environment questions."
NAME="envdb"
BUILDVERSION=$(shell cat VERSION)
GO_VERSION=$(shell go version)
# Get the git commit
SHA=$(shell git rev-parse --short HEAD)
BUILD_COUNT=$(shell git rev-list --count HEAD)
BUILD_TAG="${BUILD_COUNT}.${SHA}"
build: lint generate
@echo "Building..."
@mkdir -p bin/
@go build \
-ldflags "-X main.Build=${BUILD_TAG}" \
${ARGS} \
-o bin/envdb
server-linux: generate
@echo "Building server..."
@mkdir -p bin/
@GOOS=linux GOARCH=amd64 go build \
-ldflags "-X main.Build=${BUILD_TAG}" \
-o bin/csos-server
generate: clean
@echo "Running go generate..."
@go generate $$(go list ./... | grep -v /vendor/)
lint:
@go vet $$(go list ./... | grep -v /vendor/)
# @for pkg in $$(go list ./... |grep -v /vendor/ |grep -v /kuber/) ; do \
# golint -min_confidence=1 $$pkg ; \
# done
package: setup strip rpm64
setup:
@mkdir -p package/root/usr/bin
@mkdir -p package/output/
@cp -R ./bin/envdb package/root/usr/bin
@./bin/envdb --version 2> VERSION
test:
go list ./... | xargs -n1 go test
strip:
strip bin/envdb
rpm64:
fpm -s dir -t rpm -n $(NAME) -v $(BUILDVERSION) -p package/output/envdb-$(BUILDVERSION)-amd64.rpm \
--rpm-compression bzip2 --rpm-os linux \
--force \
--url $(WEBSITE) \
--description $(DESCRIPTION) \
-m "Dustin Willis Webber <[email protected]>" \
--vendor "Dustin Willis Webber" -a amd64 \
--exclude */**.gitkeep \
package/root/=/
deb64:
fpm -s dir -t deb -n $(NAME) -v $(BUILDVERSION) -p package/output/envdb-$(BUILDVERSION)-amd64.deb \
--deb-compression bzip2 --deb-os linux \
--force \
--url $(WEBSITE) \
--description $(DESCRIPTION) \
-m "Dustin Willis Webber <[email protected]>" \
--vendor "Dustin Willis Webber" -a amd64 \
--exclude */**.gitkeep \
package/root/=/
clean:
rm -rf doc/
rm -rf package/
rm -rf bin/
rm -rf envdb/bindata.go
rm -rf VERSION
.PHONY: build