Merge pull request #1147 from aurutils/sync--filter
[aurutils.git] / Makefile
blob31ef7db8b70fbded629a7ef574a8084b1e2831f8
1 PROGNM = aurutils
2 PREFIX ?= /usr
3 SHRDIR ?= $(PREFIX)/share
4 BINDIR ?= $(PREFIX)/bin
5 LIBDIR ?= $(PREFIX)/lib
6 ETCDIR ?= /etc
7 AURUTILS_LIB_DIR ?= $(LIBDIR)/$(PROGNM)
8 AURUTILS_VERSION ?= $(shell git describe --tags || true)
9 ifeq ($(AURUTILS_VERSION),)
10 AURUTILS_VERSION := 19
11 endif
12 AURUTILS_SHELLCHECK = $(wildcard lib/*)
14 .PHONY: shellcheck install build completion aur
16 build: aur completion
18 aur: aur.in
19 sed -e 's|AURUTILS_LIB_DIR|$(AURUTILS_LIB_DIR)|' \
20 -e 's|AURUTILS_VERSION|$(AURUTILS_VERSION)|' $< >$@
22 completion:
23 @$(MAKE) -C completions bash zsh
25 shellcheck: aur
26 @shellcheck -x -f gcc -e 1071 $(AURUTILS_SHELLCHECK)
28 prove:
29 @env -C perl prove
31 test: aur shellcheck prove
32 @tests/parseopt-consistency
34 install-aur: aur
35 @install -Dm755 aur -t '$(DESTDIR)$(BINDIR)'
37 install: install-aur
38 @install -Dm755 lib/aur-* -t '$(DESTDIR)$(AURUTILS_LIB_DIR)'
39 @install -Dm644 man1/* -t '$(DESTDIR)$(SHRDIR)/man/man1'
40 @install -Dm644 man7/* -t '$(DESTDIR)$(SHRDIR)/man/man7'
41 @install -Dm644 LICENSE -t '$(DESTDIR)$(SHRDIR)/licenses/$(PROGNM)'
42 @install -Dm644 README.md -t '$(DESTDIR)$(SHRDIR)/doc/$(PROGNM)'
43 @install -Dm644 examples/* -t '$(DESTDIR)$(SHRDIR)/doc/$(PROGNM)/examples'
44 @install -dm755 aurutils '$(DESTDIR)$(ETCDIR)/$(PROGNM)'
45 @$(MAKE) -C completions DESTDIR='$(DESTDIR)' install-bash install-zsh
46 @$(MAKE) -C perl DESTDIR='$(DESTDIR)' install-perl