-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMakefile
35 lines (25 loc) · 821 Bytes
/
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
# Copyright 2014 David Persson. All rights reserved.
#
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
PREFIX ?= /usr/local
VERSION ?= head-$(shell git rev-parse --short HEAD)
PROG_GOFLAGS = -X main.Version=$(VERSION)
.PHONY: install
install: $(PREFIX)/sbin/bsa
.PHONY: uninstall
uninstall:
rm $(PREFIX)/sbin/bsa
.PHONY: clean
clean:
if [ -d ./dist ]; then rm -r ./dist; fi
.PHONY: dist
dist: dist/bsa dist/bsa-darwin-amd64 dist/bsa-linux-amd64
$(PREFIX)/sbin/%: dist/%
install -m 555 $< $@
dist/%-darwin-amd64:
GOOS=darwin GOARCH=amd64 go build -mod=vendor -ldflags "$(PROG_GOFLAGS)" -o $@
dist/%-linux-amd64:
GOOS=linux GOARCH=amd64 go build -mod=vendor -ldflags "$(PROG_GOFLAGS)" -o $@
dist/%:
go build -mod=vendor -ldflags "$(PROG_GOFLAGS)" -o $@