-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
57 lines (39 loc) · 1.22 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
#
# Makefile for mattjmattj/yo-client
#
# Licence: BSD-2-Clause
# Author: Matthias Jouan
SHELL=/bin/bash
SOURCES := $(shell find src -name '*.php')
TESTS := $(shell find tests -name '*.php')
BUILDDIR := build
BUILDDIRTREE := $(foreach file,$(SOURCES) $(TESTS),$(BUILDDIR)/$(dir $(file)))
LINTER := php -l
PHPCS := vendor/bin/phpcs
PHPCSOPTIONS := --standard=PSR2
PHPUNIT := vendor/bin/phpunit
PHPUNITOPTIONS := --coverage-clover=coverage.clover
PIPEFAIL := set -o pipefail;
LINTED := $(patsubst %.php,$(BUILDDIR)/%.lint,$(SOURCES) $(TESTS))
PHPCSED := $(patsubst %.php,$(BUILDDIR)/%.phpcs,$(SOURCES) $(TESTS))
all: lint phpcs phpunit
# lint
$(BUILDDIR)/%.lint: %.php
@echo "Checking syntax for $<"
@$(PIPEFAIL) $(LINTER) $< | tee $@
lint: prepare-build $(LINTED)
# phpcs
$(BUILDDIR)/%.phpcs: %.php
@echo "Checking coding standards for $<"
@$(PIPEFAIL) $(PHPCS) $(PHPCSOPTIONS) $< | tee $@
phpcs: prepare-build $(PHPCSED)
#phpunit
$(BUILDDIR)/phpunit.log: $(SOURCES)
@echo "Running phpunit tests"
@$(PIPEFAIL) $(PHPUNIT) $(PHPUNITOPTIONS) | tee $@
phpunit: $(BUILDDIR)/phpunit.log
prepare-build:
@mkdir -p $(BUILDDIRTREE)
clean:
rm -rf $(BUILDDIR)
.PHONY: all lint phpcs phpunit prepare-build clean