forked from miku/esbulk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
62 lines (49 loc) · 1.48 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
SHELL := /bin/bash
TARGETS := esbulk
VERSION := 0.7.1
# http://docs.travis-ci.com/user/languages/go/#Default-Test-Script
test:
go get -d && go test -v
imports:
goimports -w .
fmt:
go fmt ./...
all: fmt test
go build -o esbulk cmd/esbulk/main.go
install:
go install
clean:
go clean
rm -f coverage.out
rm -f $(TARGETS)
rm -f esbulk-*.x86_64.rpm
rm -f packaging/debian/esbulk_*.deb
rm -f esbulk_*.deb
rm -rf packaging/debian/esbulk/usr
rm -rf logs/
cover:
go get -d && go test -v -coverprofile=coverage.out
go tool cover -html=coverage.out
esbulk:
CGO_ENABLED=0 go build -o esbulk cmd/esbulk/main.go
# ==== packaging
image:
DOCKER_CONTENT_TRUST=0 docker build --rm -t tirtir/esbulk:latest -t tirtir/esbulk:$(VERSION) .
docker rmi -f $$(docker images -q --filter label=stage=intermediate)
rmi:
docker rmi tirtir/esbulk:$(VERSION)
deb: $(TARGETS)
mkdir -p packaging/debian/esbulk/usr/sbin
cp $(TARGETS) packaging/debian/esbulk/usr/sbin
mkdir -p packaging/debian/esbulk/usr/local/share/man/man1
cp docs/esbulk.1 packaging/debian/esbulk/usr/local/share/man/man1
cd packaging/debian && fakeroot dpkg-deb --build esbulk .
mv packaging/debian/esbulk*deb .
rpm: $(TARGETS)
mkdir -p $(HOME)/rpmbuild/{BUILD,SOURCES,SPECS,RPMS}
cp ./packaging/rpm/esbulk.spec $(HOME)/rpmbuild/SPECS
cp $(TARGETS) $(HOME)/rpmbuild/BUILD
# md2man-roff docs/esbulk.md > docs/esbulk.1
cp docs/esbulk.1 $(HOME)/rpmbuild/BUILD
./packaging/rpm/buildrpm.sh esbulk
cp $(HOME)/rpmbuild/RPMS/x86_64/esbulk*.rpm .