This repository has been archived by the owner on Aug 1, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 31
/
Copy pathMakefile
105 lines (69 loc) · 2.79 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
BINARY := qpm
VERSION := 0.11.0
BUILD := $(shell git rev-parse head | cut -c1-8)
TS := $(shell /bin/date "+%Y-%m-%d---%H-%M-%S")
SOURCES := $(shell find . -name '*.go')
LDFLAGS := -ldflags "-X qpm.io/qpm/core.Version=${VERSION} -X qpm.io/qpm/core.Build=${BUILD}"
go_build = GOOS=$(1) GOARCH=$(2) go build ${LDFLAGS} -o ${GOPATH}/bin/$(1)_$(2)/$(3) qpm.io/qpm
default: $(SOURCES)
go install ${LDFLAGS} qpm.io/qpm
## Supported Platforms ##
.windows: .windows_386 .windows_amd64
.linux: .linux_386 .linux_amd64
.darwin: .darwin_386 .darwin_amd64
.freebsd: .freebsd_386 .freebsd_amd64
.all: .windows .linux .darwin .freebsd
## Platform targets ##
.windows_386: ${GOPATH}/bin/windows_386/qpm.exe
.windows_amd64: ${GOPATH}/bin/windows_amd64/qpm.exe
.linux_386: ${GOPATH}/bin/linux_386/qpm
.linux_amd64: ${GOPATH}/bin/linux_amd64/qpm
.darwin_386: ${GOPATH}/bin/darwin_386/qpm
.darwin_amd64: ${GOPATH}/bin/darwin_amd64/qpm
.freebsd_386: ${GOPATH}/bin/freebsd_386/qpm
.freebsd_amd64: ${GOPATH}/bin/freebsd_amd64/qpm
## Target build steps ##
${GOPATH}/bin/windows_386/qpm.exe: $(SOURCES)
$(call go_build,windows,386,qpm.exe)
${GOPATH}/bin/windows_amd64/qpm.exe: $(SOURCES)
$(call go_build,windows,amd64,qpm.exe)
${GOPATH}/bin/linux_386/qpm: $(SOURCES)
$(call go_build,linux,386,qpm)
${GOPATH}/bin/linux_amd64/qpm: $(SOURCES)
$(call go_build,linux,amd64,qpm)
${GOPATH}/bin/darwin_386/qpm: $(SOURCES)
$(call go_build,darwin,386,qpm)
${GOPATH}/bin/darwin_amd64/qpm: $(SOURCES)
$(call go_build,darwin,amd64,qpm)
${GOPATH}/bin/freebsd_386/qpm: $(SOURCES)
$(call go_build,freebsd,386,qpm)
${GOPATH}/bin/freebsd_amd64/qpm: $(SOURCES)
$(call go_build,freebsd,amd64,qpm)
## Protobuf generation ##
.protobuf: common/messages/qpm.proto ${GOPATH}/bin/protoc-gen-go
cd common/messages; \
protoc --plugin=$$GOPATH/bin/protoc-gen-go --go_out=plugins=grpc:. *.proto
${GOPATH}/bin/protoc-gen-go:
go get -u github.com/golang/protobuf/protoc-gen-go
clean:
@rm -rf $(BINARIES)
@rm -rf staging/
@rm -rf repository/
## Targets for building the Qt Maintence Tool Repository ##
${GOPATH}/bin/packager: $(SOURCES)
go install ${LDFLAGS} qpm.io/tools/packager
.staging: .all ${GOPATH}/bin/packager
${GOPATH}/bin/packager staging
.repository: .staging
repogen -p staging/packages -r repository
gsutil -m cp -r gs://dev.qpm.io/repository gs://dev.qpm.io/repository_$(TS)
gsutil -m rsync -r repository gs://dev.qpm.io/repository
.downloads: .all
gsutil -m cp -r gs://www.qpm.io/download gs://www.qpm.io/download_$(TS)
gsutil -m rsync -x 'qpm|packager' -r bin gs://www.qpm.io/download/v$(VERSION)
.PHONY: default clean .protobuf .all \
.downloads .repository .staging/packages \
.windows .windows_386 .windows_amd64 \
.linux .linux_386 .linux_amd64 \
.darwin .darwin_386 .darwin_amd64 \
.freebsd .freebsd_386 .freebsd_amd64