-
Notifications
You must be signed in to change notification settings - Fork 6
/
Makefile
63 lines (44 loc) · 1.52 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
SOURCEDIR=.
SOURCES := $(shell find $(SOURCEDIR) -name '*.go')
.DEFAULT_GOAL := dev
BINARY=rome
BUILD_TIME=`date +%FT%T%z`
LDFLAGS=-ldflags "-X github.com/jwhitcraft/rome/cmd.Version=${VERSION} -X github.com/jwhitcraft/rome/cmd.BuildTime=${BUILD_TIME} -s -w"
check-env:
ifndef VERSION
$(error VERSION is undefined)
endif
GCFLAGS=-gcflags "-N -l"
build = GOOS=$(1) GOARCH=$(2) go build ${LDFLAGS} -o packages/$(1)-$(2)$(3)
rename = cp packages/$(1)-$(2)$(3) public/${BINARY}-$(4)-$(5)$(3)
release: check-env clean windows darwin linux
dev: $(SOURCES)
go build ${LDFLAGS} ${GCFLAGS} -o ${BINARY} main.go
.PHONY: clean
clean:
if [ -f ./${BINARY} ] ; then rm ${BINARY} ; fi
if [ -d ./packages ] ; then rm -f ./packages/* ; fi
test:
go test -v `glide novendor`
.PHONY: aqueduct
aqueduct:
protoc -I aqueduct/ aqueduct/aqueduct.proto --go_out=plugins=grpc:aqueduct
##### LINUX BUILDS #####
linux: packages/linux_amd64.tar.gz
packages/linux_amd64.tar.gz: $(sources)
$(call build,linux,amd64,)
$(call rename,linux,amd64,,Linux,x86_64)
packages/linux_arm.tar.gz: $(sources)
$(call build,linux,arm,)
packages/linux_arm64.tar.gz: $(sources)
$(call build,linux,arm64,)
##### DARWIN (MAC) BUILDS #####
darwin: packages/darwin_amd64.tar.gz
packages/darwin_amd64.tar.gz: $(sources)
$(call build,darwin,amd64,)
$(call rename,darwin,amd64,,Darwin,x86_64)
##### WINDOWS BUILDS #####
windows: packages/windows_amd64.zip
packages/windows_amd64.zip: $(sources)
$(call build,windows,amd64,.exe)
$(call rename,windows,amd64,.exe,Windows,x86_64)