-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
41 lines (31 loc) · 843 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
SOURCES := $(wildcard *.go)
PREFIX := /usr/local
DESTDIR :=
LDFLAGS ?= -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now
RELEASE_LDFLAGS ?= -linkmode=external -extldflags='${LDFLAGS}'
all: cui
clean:
rm -rf cui vendor
cui: $(SOURCES) vendor
go build \
-buildmode=pie \
-trimpath \
-ldflags="$(RELEASE_LDFLAGS)" \
-mod=vendor \
-modcacherw \
-o $@ .
vendor: go.sum
go mod vendor
install:
install -Dm0755 cui "$(DESTDIR)$(PREFIX)/bin/cui"
install -Dm0644 README.md "$(DESTDIR)$(PREFIX)/share/doc/cui/README.md"
install -Dm0644 cui.1 "$(DESTDIR)$(PREFIX)/share/man/man1/cui.1"
uninstall:
rm -rf \
"$(DESTDIR)$(PREFIX)/bin/cui" \
"$(DESTDIR)$(PREFIX)/share/doc/cui" \
"$(DESTDIR)$(PREFIX)/share/man/man1/cui.1"
test: cui vendor
go test -mod=vendor ./...
./cui -version
.PHONY: all clean install test uninstall