1NAME = abuild-lint
2VER = 0.5
3
4PREFIX ?= /usr/local
5BINDIR ?= $(PREFIX)/bin
6MANDIR ?= $(PREFIX)/share/man
7DOCDIR ?= $(PREFIX)/share/doc/$(NAME)
8
9IMPORTPATH=src/github.com/nmeum/$(NAME)
10export GOPATH=$(CURDIR)
11
12all: $(NAME)
13$(IMPORTPATH): $(GOPATH)
14 mkdir -p $(shell dirname $@)
15 ln -fs $< $@
16
17check: $(IMPORTPATH)
18 cd $< && go test
19$(NAME): $(IMPORTPATH)
20 cd $< && go build -o $@
21
22install: $(NAME) $(NAME).1 README.md
23 install -Dm755 $(NAME) "$(DESTDIR)$(BINDIR)/$(NAME)"
24 install -Dm644 $(NAME).1 "$(DESTDIR)$(MANDIR)/man1/$(NAME).1"
25 install -Dm644 README.md "$(DESTDIR)$(DOCDIR)/README.md"
26
27dist:
28 mkdir -p $(NAME)-$(VER)
29 cp -R $(wildcard *.go) $(wildcard *.md) GNUmakefile \
30 $(NAME).1 vendor $(NAME)-$(VER)
31 find $(NAME)-$(VER) -name '.git' -exec rm -rf {} +
32 tar -czf $(NAME)-$(VER).tar.gzip $(NAME)-$(VER)
33 rm -rf $(NAME)-$(VER)
34
35.PHONY: all check install dist $(NAME)