-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
54 lines (40 loc) · 869 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
47
48
49
50
51
52
53
54
.POSIX:
VERSION=0.0.1
VPATH=doc
PREFIX?=/usr/local
_INSTDIR=$(DESTDIR)$(PREFIX)
BINDIR?=$(_INSTDIR)/bin
MANDIR?=$(_INSTDIR)/share/man
GO?=go
GOFLAGS?=
GOSRC!=find . -name '*.go'
GOSRC+=go.mod
prunef: $(GOSRC)
$(GO) build $(GOFLAGS) \
-o $@
doc:
scdoc < prunef.1.scd > prunef.1
all: prunef doc
RM?=rm -f
clean:
$(RM) prunef prunef.1
install: all
mkdir -m755 -p $(BINDIR)
mkdir -m755 -p $(MANDIR)
mkdir -m755 -p $(MANDIR)/man1
install -m755 prunef $(BINDIR)/prunef
install -m644 prunef.1 $(MANDIR)/man1/prunef.1
RMDIR_IF_EMPTY:=sh -c '\
if test -d $$0 && ! ls -1qA $$0 | grep -q . ; then \
rmdir $$0; \
fi'
uninstall:
$(RM) $(BINDIR)/prunef
${RMDIR_IF_EMPTY} $(BINDIR)
$(RM) $(MANDIR)/man1/prunef.1
${RMDIR_IF_EMPTY} $(MANDIR)/man1
${RMDIR_IF_EMPTY} $(MANDIR)
test:
$(GO) test ./...
.DEFAULT_GOAL := all
.PHONY: all clean install uninstall