-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
58 lines (43 loc) · 1.1 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
DESTDIR ?= /
prefix ?= $(DESTDIR)
bindir=/usr/bin
GO ?= go
V ?=
PKGS = $(shell go list ./...)
PKGFILES = $(shell find . \( -path ./vendor \) -prune \
-o -type f -name '*.go' -print)
PKGFILES_notest = $(shell echo $(PKGFILES) | tr ' ' '\n' | grep -v '_test.go' )
VERSION = $(shell git describe --tags --dirty --exact-match 2>/dev/null || git rev-parse --short HEAD)
GO_LDFLAGS = \
-ldflags "-X github.com/mendersoftware/mender-snapshot/conf.Version=$(VERSION)"
ifeq ($(V),1)
BUILDV = -v
endif
TAGS =
ifneq ($(TAGS),)
BUILDTAGS = -tags '$(TAGS)'
endif
build: mender-snapshot
clean:
@$(GO) clean
mender-snapshot: $(PKGFILES)
@$(GO) build $(GO_LDFLAGS) $(BUILDV) $(BUILDTAGS)
install: install-bin
install-bin: mender-snapshot
@install -m 755 -d $(prefix)$(bindir)
@install -m 755 mender-snapshot $(prefix)$(bindir)/
uninstall: uninstall-bin
uninstall-bin:
@rm -f $(prefix)$(bindir)/mender-snapshot
@-rmdir -p $(prefix)$(bindir)
check: test
test:
@$(GO) test $(BUILDV) $(PKGS)
.PHONY: build
.PHONY: clean
.PHONY: install
.PHONY: install-bin
.PHONY: uninstall
.PHONY: uninstall-bin
.PHONY: test
.PHONY: check