-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathGNUmakefile
44 lines (34 loc) · 1.22 KB
/
GNUmakefile
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
SHELL = bash
PROJECTS := TrustProfile WebwinkelKeur
XML_TEMPLATES := $(shell find common -type f -name '*.xml')
XML_TARGETS := $(foreach project,$(PROJECTS),$(patsubst common/%,$(project)/%,$(XML_TEMPLATES)))
COPY_SOURCES := $(shell find common/view -type f)
COPY_TARGETS := $(foreach project,$(PROJECTS),$(patsubst common/%,$(project)/%,$(COPY_SOURCES)))
CLASS_BASES := $(shell find common/Controller -type f -name '*.php')
CLASS_TARGETS := $(foreach project,$(PROJECTS),$(patsubst common/%,$(project)/%,$(CLASS_BASES)))
PHPSTAN_LEVEL := 2
all : $(XML_TARGETS) $(COPY_TARGETS) $(CLASS_TARGETS)
.PHONY : all
clean :
git clean -df $(PROJECTS)
.PHONY : clean
define PROJECT_RULES
$(1)/%.xml : common/%.xml
@mkdir -p $$(dir $$@)
bin/templated-xml $(1) common/$$*.xml > $$@~
@mv $$@~ $$@
$(1)/%.php : common/%.php
@mkdir -p $$(dir $$@)
bin/extend-base-class $(1) $$< > $$@~
@mv $$@~ $$@
$(1)/% : common/%
@mkdir -p $$(dir $$@)
cp $$< $$@
endef
$(foreach project,$(PROJECTS),$(eval $(call PROJECT_RULES,$(project))))
phpstan : tools/phpstan/vendor/.updated
tools/phpstan/vendor/bin/phpstan analyse -l $(PHPSTAN_LEVEL) common $(PROJECTS)
.PHONY : phpstan
tools/phpstan/vendor/.updated :
composer -d tools/phpstan install
touch $@