forked from whiteinge/ok.sh
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
64 lines (51 loc) · 1.54 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
# Install ok.sh; build the website/README; run the tests.
PROGRAM ?= ok.sh
DESTDIR ?= $(HOME)
DESTDIRB ?= /
VERSION :=
.PHONY: test
test :
make -C tests all
.PHONY: docker
docker : .image
docker run -it --rm -v $$PWD:/oksh oksh
# Remove this file to trigger a rebuild.
.image :
docker build -t oksh .
touch $@
.PHONY: busybox
busybox : .busybox
env -i -- PATH=$$PWD/.busybox SHELL=sh $$PWD/.busybox/sh
.busybox :
mkdir -p $$PWD/.busybox
busybox --install -s $$PWD/.busybox
ln -s $$(which curl) $$PWD/.busybox/curl
ln -s $$(which jq) $$PWD/.busybox/jq
ln -s $$(which make) $$PWD/.busybox/make
ln -s $$(which socat) $$PWD/.busybox/socat
clean :
rm -f .image
install : $(PROGRAM)
cp $(PROGRAM) "$(DESTDIR)/bin/"
chmod 755 "$(DESTDIR)/bin/$(PROGRAM)"
cp $(PROGRAM) "$(DESTDIRB)bin/"
chmod 777 "$(DESTDIRB)bin/$(PROGRAM)"
.PHONY: version
version : readme
sed -i -e "s/VERSION=.*/VERSION='$(VERSION)'/g" $(PROGRAM)
git add $(PROGRAM) README.md
git commit -m 'Update version to $(VERSION)'
git tag -a $(VERSION) -s
.PHONY: shellcheck
shellcheck :
make -C tests shellcheck
readme : $(PROGRAM)
@ printf '<!---\nThis README file is generated. Changes will be overwritten.\n-->\n' > README.md
@ printf '[![Build Status](https://travis-ci.org/whiteinge/ok.sh.svg?branch=master)](https://travis-ci.org/whiteinge/ok.sh)\n\n' >> README.md
OK_SH_MARKDOWN=1 ./$(PROGRAM) help >> README.md
.PHONY: preview
preview :
@ pandoc -f gfm < README.md > README.html
.PHONY: posixdocs
posixdocs:
wget -np --mirror https://pubs.opengroup.org/onlinepubs/9699919799/