-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
35 lines (26 loc) · 1.08 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
PREFIX ?= /usr/local
DIST := COPYING Makefile readme.md
PROJECT := mtmapprune
VERSION = 4
BUILD = `git describe --tags --always`
$(PROJECT): main.go
go build -ldflags "-X main.Version=$(VERSION) -X main.Build=$(BUILD)" -o $(PROJECT)
build: $(PROJECT)
install: $(PROJECT)
go install
mkdir -p $(DESTDIR)$(PREFIX)/bin
install -m0755 $(PROJECT) $(DESTDIR)$(PREFIX)/bin/$(PROJECT)
clean:
go clean
dist:
rm -rf $(PROJECT)-$(BUILD)
mkdir $(PROJECT)-$(BUILD)
cp $(DIST) $(PROJECT)-$(BUILD)/
rm -f $(PROJECT)-$(BUILD)/$(PROJECT)
GOOS=linux GOARCH=amd64 go build -ldflags "-X main.Version=$(VERSION) -X main.Build=$(BUILD)" -o $(PROJECT) -o $(PROJECT)-$(BUILD)/$(PROJECT)
rm -f $(PROJECT)-$(BUILD)-x86_64.zip
zip -r $(PROJECT)-$(BUILD)-x86_64.zip $(PROJECT)-$(BUILD)/
rm -f $(PROJECT)-$(BUILD)/$(PROJECT)
CC=x86_64-w64-mingw32-gcc GOOS=windows GOARCH=amd64 CGO_ENABLED=1 go build -ldflags "-X main.Version=$(VERSION) -X main.Build=$(BUILD)" -o $(PROJECT) -o $(PROJECT)-$(BUILD)/$(PROJECT).exe
rm -f $(PROJECT)-$(BUILD)-win64.zip
zip -r $(PROJECT)-$(BUILD)-win64.zip $(PROJECT)-$(BUILD)/