forked from quantum-journal/o3po
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
35 lines (26 loc) · 1.26 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
PHP := php
SRC := o3po/
DOCS := docs/
PHPUNIT := phpunit
ifndef PHPUNITCOMMAND # on travis we set this via the travis.yml to make sure we run with a phpunit version that is compatible with the used php version
PHPUNITCOMMAND := $(shell command -v $(PHPUNIT) 2> /dev/null)
endif
ifndef PHPUNITCOMMAND
PHPUNITCOMMAND := "phpunit"
endif
PHPDOCUMENTORPHAR := phpDocumentor.phar
all:
@echo "Please specify a target to make:\ndocs:\t\tgenerate the documentation\nlint:\t\trun php in lint mode\ntest:\trun phpunit unit tests\ntest-[test file]:\trun specific unit test"
.PHONY: docs
docs: $(shell find . -type f -name '*.php') $(PHPDOCUMENTORPHAR)
@$(PHP) $(PHPDOCUMENTORPHAR) -i index.php -i display.php --force --validate --sourcecode -vv -d $(SRC) -t $(DOCS)
$(PHPDOCUMENTORPHAR):
@wget -O $(PHPDOCUMENTORPHAR) http://www.phpdoc.org/$(PHPDOCUMENTORPHAR)
lint:
@find . -type f -name '*.php' -exec php -l {} \;
run-tests: test
test: test-.
test-%: $(shell find . -type f -name '*.php') setsttysizenonzero
$(PHPUNITCOMMAND) --verbose --coverage-clover=coverage.xml --coverage-html=coverage-html --whitelist $(SRC) --bootstrap tests/resources/bootstrap.php --test-suffix 'test.php' tests/$(subst test-,,$@)
setsttysizenonzero:
@if [ "$(shell stty size)" = "0 0" ]; then stty cols 80; fi