-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathMakefile
63 lines (45 loc) · 2.06 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
.PHONY: assets test
GOARCHES = 386 amd64
BITS = 32 64
GOOSES = linux darwin windows
default: debug
build: version deps assets-release
rm -rf dist
mkdir -p dist
# Building each binary
@$(foreach arch,$(GOARCHES),$(foreach os, $(GOOSES), GOOS=$(os) GOARCH=$(arch) go build -o instahelper-$(v)-$(os)-$(arch);))
@$(foreach arch,$(GOARCHES),$(foreach os, $(GOOSES), mkdir -p dist/instahelper-$(v)-$(os)-$(arch);))
@$(foreach arch,$(GOARCHES),$(foreach os, $(GOOSES), mv instahelper-$(v)-$(os)-$(arch) dist/instahelper-$(v)-$(os)-$(arch)/instahelper;))
# Renames 386 > 32, amd64 > 64
@$(foreach arch,$(GOARCHES),$(foreach os, $(GOOSES), \
$(if $(filter 386,$(arch)), mv dist/instahelper-$(v)-$(os)-$(arch) dist/instahelper-$(v)-$(os)-32; ) \
$(if $(filter amd64,$(arch)), mv dist/instahelper-$(v)-$(os)-$(arch) dist/instahelper-$(v)-$(os)-64; ) \
))
# Appends .exe to windows
@$(foreach bit,$(BITS), mv dist/instahelper-$(v)-windows-$(bit)/instahelper dist/instahelper-$(v)-windows-$(bit)/instahelper.exe;)
# Creates a zip archive of each folder
@$(foreach bit,$(BITS),$(foreach os, $(GOOSES), zip -rj dist/instahelper-$(v)-$(os)-$(bit).zip dist/instahelper-$(v)-$(os)-$(bit);))
# Remove 32 bit MacOS, all are 64 bit anyways
rm dist/instahelper-$(v)-darwin-32.zip
# Renames darwin > macos
mv dist/instahelper-$(v)-darwin-64.zip dist/instahelper-$(v)-macos-64.zip
# Deletes the original folders
@$(foreach bit,$(BITS),$(foreach os, $(GOOSES), rm -rf dist/instahelper-$(v)-$(os)-$(bit);))
debug: assets
go run main.go -debug -noopen
test: deps assets
go test -v ./app/...
deps:
go get github.com/golang/dep/cmd/dep
dep ensure
version:
ifeq ($(v),)
$(error Set version with v={{VERSION}})
endif
go run app/update/gen_version.go $(v)
assets-release:
go get github.com/jteeuwen/go-bindata/...
go-bindata -nometadata -pkg="assets" -ignore=\\.DS_Store -prefix "assets" -o app/assets/assets.go assets/...
assets:
go get github.com/jteeuwen/go-bindata/...
go-bindata -debug -nometadata -pkg="assets" -ignore=\\.DS_Store -prefix "assets" -o app/assets/assets.go assets/...