This repository has been archived by the owner on Jun 2, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathMakefile
81 lines (68 loc) · 3.07 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
NO_COLOR=\033[0m
OK_COLOR=\033[32;01m
ERROR_COLOR=\033[31;01m
WARN_COLOR=\033[33;01m
DEPS = $(go list -f '{{range .TestImports}}{{.}} {{end}}' ./...)
VERSION = $(shell cat core/version.go | grep 'const VERSION' | egrep -o '\d+\.\d+\.\d+')
GO ?= $(shell echo go)
IMG_MANTA_BASE_PATH ?= public/images
all: format deps tests
dev-server:
@$(GO) run *.go -v=0 -alsologtostderr=true --outputs '$(IMG_OUTPUTS)' server
dev-server-s3:
@$(GO) run *.go --outputs $(IMG_OUTPUTS) --aws_access_key_id $(AWS_ACCESS_KEY_ID) --aws_secret_key $(AWS_SECRET_KEY) --aws_bucket $(AWS_BUCKET) --listen 127.0.0.1 --remote_base_path $(IMG_REMOTE_BASE_PATH) --remote_base_url $(IMG_REMOTE_BASE_URL) server
dev-server-manta:
@$(GO) run *.go --outputs $(IMG_OUTPUTS) --manta_url $(MANTA_URL) --manta_user $(MANTA_USER) --manta_key_id $(MANTA_KEY_ID) --sdc_identity $(SDC_IDENTITY) --remote_base_path $(IMG_MANTA_BASE_PATH) server
tests:
@$(GO) test -race -v ./...
version:
@echo $(VERSION)
deps:
@echo "$(OK_COLOR)==> Installing dependencies$(NO_COLOR)"
@$(GO) get -d -v ./...
dev-deps: deps
@echo $(DEPS) | xargs -n1 go get -d
@$(GO) get golang.org/x/tools/cmd/godoc
@$(GO) get golang.org/x/tools/cmd/vet
update-deps:
@echo "$(OK_COLOR)==> Updating all dependencies$(NO_COLOR)"
@$(GO) get -d -v -u ./...
@echo $(DEPS) | xargs -n1 go get -d -u
clean:
@rm -rf bin/
@rm -fr tmp
@rm -fr public
format:
@gofmt -l -w .
build:
@mkdir -p bin/
@echo "$(OK_COLOR)==> Building$(NO_COLOR)"
@rm -f bin/images bin/solaris/images bin/linux/images bin/darwin/images
@$(GO) build -o bin/images-$(VERSION)
@cd bin && ln -s images-$(VERSION) images
@echo "$(OK_COLOR)==> Building for solaris amd64$(NO_COLOR)"
@mkdir -p bin/solaris
@GOOS=solaris GOARCH=amd64 $(GO) build -o bin/solaris/images-$(VERSION)
@cd bin/solaris && ln -s images-$(VERSION) images
@echo "$(OK_COLOR)==> Building for darwin amd64$(NO_COLOR)"
@mkdir -p bin/darwin
@GOOS=darwin GOARCH=amd64 $(GO) build -o bin/darwin/images-$(VERSION)
@cd bin/darwin && ln -s images-$(VERSION) images
@echo "$(OK_COLOR)==> Building for linux amd64$(NO_COLOR)"
@mkdir -p bin/linux
@GOOS=linux GOARCH=amd64 $(GO) build -o bin/linux/images-$(VERSION)
@cd bin/linux && ln -s images-$(VERSION) images
@echo "$(OK_COLOR)==> Compressing$(NO_COLOR)"
@cd bin/solaris && tar -czvf images-$(VERSION).tar.gz images-$(VERSION)
@echo "$(OK_COLOR)==> Build OK$(NO_COLOR)"
release: tests build
@echo "$(OK_COLOR)==> Uploading to manta$(NO_COLOR)"
# Solaris
@mput -f bin/solaris/images-$(VERSION) /$(MANTA_USER)/public/images/bin/images-solaris-$(VERSION)
@echo "$(VERSION)" | mput -H 'content-type: text/plain' /$(MANTA_USER)/public/images/bin/images-solaris-version
# Mac
@mput -f bin/darwin/images-$(VERSION) /$(MANTA_USER)/public/images/bin/images-darwin-$(VERSION)
@echo "$(VERSION)" | mput -H 'content-type: text/plain' /$(MANTA_USER)/public/images/bin/images-darwin-version
# Linux
@mput -f bin/linux/images-$(VERSION) /$(MANTA_USER)/public/images/bin/images-linux-$(VERSION)
@echo "$(VERSION)" | mput -H 'content-type: text/plain' /$(MANTA_USER)/public/images/bin/images-linux-version