docs: tutorial
[awesomized/ext-ion] / docs / Makefile
1 DOCKER ?=
2 PHP ?= $(DOCKER) php
3 COMPOSER ?= $(DOCKER) composer
4 TAG := $(shell (git describe --tags --match=v[0-9]* 2>/dev/null || git tag --sort=authordate | egrep ^v[0-9] | tail -n1) | cut -d. -f-2)
5
6 # ---
7
8 SPECIAL_SRC := \
9 src/mdref.json \
10 src/ion.md \
11 src/ion/\\\:\\\ Contributing.md \
12 src/ion/\\\:\\\ Security.md \
13 tutorial
14
15 # ---
16
17 .PHONY: all
18 all: latest
19
20 latest: $(TAG)
21 -unlink $@ 2>/dev/null
22 ln -s "$(TAG)/" $@
23 touch $@
24
25 $(TAG): markdown | vendor/bin/ref2html
26 mkdir -p $@
27 -ln -s . ext-ion
28 $(PHP) $| ext-ion/$@ src
29 unlink ext-ion
30 touch $@
31
32 .PHONY: markdown
33 markdown: src/ion.stub.php $(SPECIAL_SRC) | vendor/bin/stub2ref
34 $(PHP) $| ion $< src
35
36 src src/ion src/ion/\\\:\\\ Tutorial:
37 -mkdir -p $@
38 src/mdref.json: mdref.json
39 -test -e $@ || ln $^ $@
40 src/ion.stub.php: ../ion.stub.php | src
41 -test -e $@ || ln $^ $@
42 src/ion.md: ../README.md | src
43 -test -e $@ || ln $^ $@
44 src/ion/\\\:\\\ Contributing.md: ../CONTRIBUTING.md | src/ion
45 -test -e $@ || ln $^ $@
46 src/ion/\\\:\\\ Security.md: ../SECURITY.md | src/ion
47 -test -e $@ || ln $^ $@
48
49 .PHONY: tutorial
50 tutorial: | src/ion
51 cp -R tutorial/* src/ion/
52
53 vendor/%:
54 COMPOSER= $(COMPOSER) require m6w6/mdref:dev-master
55
56 .PHONY: docker
57 docker:
58 docker-compose -f docker/compose.yml build php
59 docker-compose -f docker/compose.yml build composer
60 $(MAKE) DOCKER="docker-compose -f docker/compose.yml run --rm"
61
62 .PHONY: clean
63 clean:
64 -rm -rf latest src vendor composer* .composer