forked from karitra/mp707
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
46 lines (33 loc) · 748 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
36
37
38
39
40
41
42
43
44
45
46
SLUG = $(shell head -1 go.mod | cut -d/ -f2-)
NAME = mp707
CGO_ENABLED = 1
GO111MODULE = on
export SLUG
export NAME
export CGO_ENABLED
export GO111MODULE
LDFLAGS += -w -s
.PHONY: all
all: build
.PHONY: check
check: vet test
.PHONY: vet
vet:
go vet -v ./...
.PHONY: test
test:
go test -v -count 1 ./...
.PHONY: clean
clean:
rm -vf cmd/$(NAME)/$(NAME)
rm -rvf release
.PHONY: build
build: cmd/$(NAME)/$(NAME)
.PHONY: static
static: LDFLAGS += -linkmode external -extldflags '-static $(shell pkg-config --libs libudev)'
static: build
cmd/$(NAME)/$(NAME):
cd cmd/$(NAME); go build -v -ldflags "$(LDFLAGS)"
release: release/$(NAME).linux.386 release/$(NAME).linux.amd64
release/$(NAME).linux.%:
GOARCH=$* OUTPUT=$@ scripts/release.sh