-
-
Notifications
You must be signed in to change notification settings - Fork 22
/
Makefile
68 lines (56 loc) · 2.07 KB
/
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
PREFIX ?= /usr/local
BINDIR := $(PREFIX)/bin
.PHONY: build
build: bin/getoptions bin/gengetoptions
.PHONY: clean
clean:
rm -f bin/getoptions bin/gengetoptions getoptions.tar.gz gengetoptions.tar.gz
.PHONY: check
check: build
shellcheck --version
shellcheck tools/* src/* lib/*.sh spec/*.sh examples/*.sh
bin/gengetoptions library --shellcheck | shellcheck -s sh -
bin/gengetoptions parser -f examples/parser_definition.sh --shellcheck parser_definition parser prog | shellcheck -
.PHONY: check_with_docker
check_with_docker: build
tools/shellcheck.sh --version
tools/shellcheck.sh tools/* src/* lib/*.sh spec/*.sh examples/*.sh
bin/gengetoptions library --shellcheck | tools/shellcheck.sh -s sh -
bin/gengetoptions parser -f examples/parser_definition.sh --shellcheck parser_definition parser prog | tools/shellcheck.sh -
.PHONY: test
test:
shellspec
.PHONY: test_in_various_shells
test_in_various_shells:
if type sh; then shellspec -s sh; fi
if type dash; then shellspec -s dash; fi
if type bash; then shellspec -s bash; fi
if type busybox; then shellspec -s 'busybox ash'; fi
if type ksh; then shellspec -s ksh; fi
if type mksh; then shellspec -s mksh; fi
# Skip broken macOS posh that gives error. (posh: exit: bad number)
if type posh && posh -c exit; then shellspec -s posh; fi
if type yash; then shellspec -s yash; fi
if type zsh; then shellspec -s zsh; fi
.PHONY: test_with_coverage
test_with_coverage:
shellspec -s bash --kcov
.PHONY: dist
dist: build
tar -C bin -czf getoptions.tar.gz getoptions
tar -C bin -czf gengetoptions.tar.gz gengetoptions
.PHONY: install
install: build
mkdir -p $(BINDIR)
install -m 755 bin/getoptions $(BINDIR)/getoptions
install -m 755 bin/gengetoptions $(BINDIR)/gengetoptions
.PHONY: uninstall
uninstall:
rm -f $(BINDIR)/getoptions
rm -f $(BINDIR)/gengetoptions
bin/getoptions: VERSION tools/build.sh src/getoptions lib/*.sh
tools/build.sh < src/getoptions > bin/getoptions
chmod +x bin/getoptions
bin/gengetoptions: VERSION tools/build.sh src/gengetoptions
tools/build.sh < src/gengetoptions > bin/gengetoptions
chmod +x bin/gengetoptions