This repository has been archived by the owner on May 6, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
48 lines (37 loc) · 1.69 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
VERSION := 0.5.2
GO_BUILDOPT := -ldflags '-s -w -X main.version=$(VERSION)'
gom:
go get github.com/mattn/gom
gom install
run:
gom run main.go ${ARGS}
fmt:
gom exec goimports -w *.go ohgi/*.go
test:
gom test -v -cover -race github.com/hico-horiuchi/ohgi/ohgi
build: fmt
gom build $(GO_BUILDOPT) -o bin/ohgi main.go
release: fmt
if [ -e bin/v$(VERSION) ]; then rm -rf bin/v$(VERSION); fi
mkdir bin/v$(VERSION)
GOOS=linux GOARCH=amd64 gom build $(GO_BUILDOPT) -o bin/v$(VERSION)/ohgi$(VERSION).linux-amd64 main.go
GOOS=linux GOARCH=386 gom build $(GO_BUILDOPT) -o bin/v$(VERSION)/ohgi$(VERSION).linux-386 main.go
GOOS=darwin GOARCH=amd64 gom build $(GO_BUILDOPT) -o bin/v$(VERSION)/ohgi$(VERSION).darwin-amd64 main.go
GOOS=darwin GOARCH=386 gom build $(GO_BUILDOPT) -o bin/v$(VERSION)/ohgi$(VERSION).darwin-386 main.go
zip bin/v$(VERSION)/ohgi$(VERSION).linux-amd64.zip bin/v$(VERSION)/ohgi$(VERSION).linux-amd64
zip bin/v$(VERSION)/ohgi$(VERSION).linux-386.zip bin/v$(VERSION)/ohgi$(VERSION).linux-386
zip bin/v$(VERSION)/ohgi$(VERSION).darwin-amd64.zip bin/v$(VERSION)/ohgi$(VERSION).darwin-amd64
zip bin/v$(VERSION)/ohgi$(VERSION).darwin-386.zip bin/v$(VERSION)/ohgi$(VERSION).darwin-386
ls -d bin/v$(VERSION)/* | grep -v zip | xargs rm
clean:
rm -rf bin/*
link:
mkdir -p $(GOPATH)/src/github.com/hico-horiuchi
if [ ! -d $(GOPATH)/src/github.com/hico-horiuchi/ohgi ]; then ln -s $(CURDIR) $(GOPATH)/src/github.com/hico-horiuchi/ohgi; fi
unlink:
rm $(GOPATH)/src/github.com/hico-horiuchi/ohgi
if [ -z "`ls $(GOPATH)/src/github.com/hico-horiuchi`" ]; then rmdir $(GOPATH)/src/github.com/hico-horiuchi; fi
install: build
cp bin/ohgi /usr/local/bin/
uninstall: clean unlink
rm -f /usr/local/bin/ohgi