summaryrefslogtreecommitdiff
path: root/Makefile
blob: 02b950810f1e92a98b0a5e7b84512e106e5f26ed (plain)
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
59
60
61
62
63
PACKAGE_NAME = asp32

VERSION = $(shell git describe --dirty 2>/dev/null)

PREFIX = /usr/local

BINPROGS = \
	asp32

MANPAGES = \
	man/asp32.1

BASH_COMPLETION = \
	shell/bash-completion

ZSH_COMPLETION = \
	shell/zsh-completion

INCLUDES = \
	archweb.inc.sh \
	package.inc.sh \
	remote.inc.sh \
	util.inc.sh

all: $(BINPROGS) $(MANPAGES)

V_GEN = $(_v_GEN_$(V))
_v_GEN_ = $(_v_GEN_0)
_v_GEN_0 = @echo "  GEN     " $@;

edit = $(V_GEN) m4 -P $@.in | sed 's/@ASP_VERSION@/$(VERSION)/' >$@ && chmod go-w,+x $@

%: %.in $(INCLUDES)
	$(edit)

doc: $(MANPAGES)
man/%: man/%.txt Makefile
	$(V_GEN) a2x -d manpage \
		-f manpage \
		-a manversion="asp32 $(VERSION)" \
		-a manmanual="asp32 manual" $<

check: $(BINPROGS)
	@for f in $(BINPROGS); do bash -O extglob -n $$f; done

clean:
	$(RM) $(BINPROGS) $(MANPAGES)

install: all
	install -dm755 $(DESTDIR)$(PREFIX)/bin $(DESTDIR)$(PREFIX)/share/man/man1
	install -m755 $(BINPROGS) $(DESTDIR)$(PREFIX)/bin
	install -m644 $(MANPAGES) $(DESTDIR)$(PREFIX)/share/man/man1
	install -Dm644 $(BASH_COMPLETION) $(DESTDIR)$(PREFIX)/share/bash-completion/completions/asp32
	install -Dm644 $(ZSH_COMPLETION) $(DESTDIR)$(PREFIX)/share/zsh/site-functions/_asp32

dist:
	git archive --format=tar --prefix=asp32-$(VERSION)/ $(VERSION) | gzip -9 > asp32-$(VERSION).tar.gz
	gpg --detach-sign --use-agent asp32-$(VERSION).tar.gz

upload:
	scp asp32-$(VERSION).tar.gz asp32-$(VERSION).tar.gz.sig sources.archlinux32.org:sources/

.PHONY: all clean install uninstall dist upload