| 1 |
VER=26 |
| 2 |
|
| 3 |
PREFIX = /usr/local |
| 4 |
|
| 5 |
BINPROGS = \ |
| 6 |
arch-chroot \ |
| 7 |
genfstab \ |
| 8 |
pacstrap |
| 9 |
|
| 10 |
MANS = \ |
| 11 |
doc/arch-chroot.8 \ |
| 12 |
doc/genfstab.8 \ |
| 13 |
doc/pacstrap.8 |
| 14 |
|
| 15 |
BASH = bash |
| 16 |
ZSHCOMP := $(wildcard completion/zsh/*) |
| 17 |
BASHCOMP := $(wildcard completion/bash/*) |
| 18 |
|
| 19 |
all: $(BINPROGS) man |
| 20 |
man: $(MANS) |
| 21 |
|
| 22 |
V_GEN = $(_v_GEN_$(V)) |
| 23 |
_v_GEN_ = $(_v_GEN_0) |
| 24 |
_v_GEN_0 = @echo " GEN " $@; |
| 25 |
|
| 26 |
edit = $(V_GEN) m4 -P [email protected] >$@ && chmod go-w,+x $@ |
| 27 |
|
| 28 |
arch-chroot: arch-chroot.in common |
| 29 |
$(edit) |
| 30 |
|
| 31 |
genfstab: genfstab.in fstab-helpers |
| 32 |
$(edit) |
| 33 |
|
| 34 |
pacstrap: pacstrap.in common |
| 35 |
$(edit) |
| 36 |
|
| 37 |
doc/%: doc/%.asciidoc doc/asciidoc.conf |
| 38 |
$(V_GEN) a2x --no-xmllint --asciidoc-opts="-f doc/asciidoc.conf" -d manpage -f manpage -D doc $< |
| 39 |
|
| 40 |
clean: |
| 41 |
$(RM) $(BINPROGS) $(MANS) |
| 42 |
|
| 43 |
check: all |
| 44 |
@for f in $(BINPROGS); do bash -O extglob -n $$f; done |
| 45 |
@r=0; for t in test/test_*; do $(BASH) $$t || { echo $$t fail; r=1; }; done; exit $$r |
| 46 |
|
| 47 |
shellcheck: $(BINPROGS) |
| 48 |
shellcheck -W 99 --color $(BINPROGS) |
| 49 |
shellcheck -W 99 --color -x test/test_* |
| 50 |
|
| 51 |
install: all |
| 52 |
install -d $(DESTDIR)$(PREFIX)/bin |
| 53 |
install -m 0755 $(BINPROGS) $(DESTDIR)$(PREFIX)/bin |
| 54 |
install -d $(DESTDIR)$(PREFIX)/share/zsh/site-functions |
| 55 |
install -m 0644 $(ZSHCOMP) $(DESTDIR)$(PREFIX)/share/zsh/site-functions |
| 56 |
install -d $(DESTDIR)$(PREFIX)/share/bash-completion/completions |
| 57 |
install -m 0644 $(BASHCOMP) $(DESTDIR)$(PREFIX)/share/bash-completion/completions |
| 58 |
install -d $(DESTDIR)$(PREFIX)/share/man/man8 |
| 59 |
install -m 0644 $(MANS) $(DESTDIR)$(PREFIX)/share/man/man8 |
| 60 |
|
| 61 |
.PHONY: all man clean check shellcheck install |