-
Notifications
You must be signed in to change notification settings - Fork 41
/
Makefile
62 lines (49 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
TARGETS := esbulk
VERSION := 0.7.18
GOLDFLAGS := "-w -s"
# testing against elasticsearch may require larger amounts of memory
test:
go test -cover -v
imports:
goimports -w .
fmt:
go fmt ./...
all: fmt test
go build -ldflags=$(GOLDFLAGS) -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 -ldflags=$(GOLDFLAGS) -o esbulk cmd/esbulk/main.go
# ==== packaging
image:
DOCKER_CONTENT_TRUST=0 docker build --rm -t tirtir/esbulk:latest -t tirtir/esbulk:$(VERSION) .
docker image prune --force --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 .