docs
[awesomized/ext-ion] / docs / Makefile
index ddbea7b658fba48e8ea451cbbe0f3d570817d59c..cbfcb36c1660e4677fe6cb2581ed3ab609185535 100644 (file)
@@ -1,27 +1,44 @@
 PHP ?= php
 COMPOSER ?= composer
-TAG := $(shell (git describe --tags --exact-match --match=v[1-9]* || echo v0.0) | cut -d. -f-2 2>/dev/null)
+TAG := $(shell (git describe --tags --exact-match --match=v[1-9]*  2>/dev/null || echo v0.0) | cut -d. -f-2)
+
+# ---
+
+SPECIAL_SRC := src/ion/\\\:\\\ Security.md src/ion/\\\:\\\ Contributing.md src/ion.md
 
 .PHONY: all
 all: latest
 
-.PHONY: clean
-clean:
-       -rm -rf latest src vendor composer.*
+latest: $(TAG)
+       -unlink $@ 2>/dev/null
+       ln -s "$(TAG)/" $@
+       touch $@
+
+$(TAG): markdown | vendor/bin/ref2html
+       mkdir -p $@
+       $(PHP) $| $@ src
+       touch $@
+
+.PHONY: markdown
+markdown: src/ion.stub.php $(SPECIAL_SRC) | vendor/bin/stub2ref
+       $(PHP) $| ion $< src
+
+src src/ion:
+       -mkdir -p $@
+src/ion.stub.php: ../ion.stub.php | src
+       -test -e $@ || ln $^ $@
+src/ion.md: ../README.md | src
+       -test -e $@ || ln $^ $@
+src/ion/\\\:\\\ Security.md: ../SECURITY.md | src/ion
+       -test -e $@ || ln $^ $@
+src/ion/\\\:\\\ Contributing.md: ../CONTRIBUTING.md | src/ion
+       -test -e $@ || ln $^ $@
 
 vendor/%:
        $(COMPOSER) require m6w6/mdref:dev-master
 
-src: ../ion.stub.php | vendor/bin/stub2ref
-       mkdir -p $@ && cd $@ && $(PHP) ../$| ion ../$^
-       touch $@
+.PHONY: clean
+clean:
+       -rm -rf latest src vendor composer.*
 
-$(TAG): src | vendor/bin/ref2html
-       mkdir -p $@
-       $(PHP) $| $@ $^
-       touch $@
 
-latest: $(TAG)
-       -unlink latest 2>/dev/null
-       ln -s "$(TAG)/" latest
-       touch $@