-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
73 lines (57 loc) · 1.65 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
COMPOSER_CMD=composer
PHIVE_CMD=phive
GIROAPP_CMD=tools/giroapp
BOX_CMD=tools/box
GIROAPP_INSTALLED:=$(shell command -v giroapp 2> /dev/null)
.DEFAULT_GOAL=all
TARGET=giroapp-completion-plugin.phar
SRC_FILES:=$(shell find src/ -type f -name '*.php')
$(TARGET): $(SRC_FILES) stub.php box.json composer.lock vendor/installed $(BOX_CMD)
$(BOX_CMD) compile
.PHONY: all
all: test
.PHONY: build
build: $(TARGET)
.PHONY: test
test: setup_test_env $(GIROAPP_CMD)
@echo Testing completion output using "_complete 'giroapp stat' 11"
test "$(shell export GIROAPP_INI=giroapp.ini; $(GIROAPP_CMD) _complete 'giroapp stat' 11 | xargs)" = "status"
@echo OK
.PHONY: setup_test_env
setup_test_env: $(TARGET) giroapp.ini
cp $< $(shell export GIROAPP_INI=giroapp.ini; $(GIROAPP_CMD) conf plugins_dir)
giroapp.ini: $(GIROAPP_CMD)
rm -f $@
$(GIROAPP_CMD) init
echo 'org_bg = "111-1111"' >> $@
echo 'org_id = "8350000892"' >> $@
echo 'base_dir = "tmp"' >> $@
.PHONY: clean
clean:
rm -rf tmp
rm -rf tools
rm -rf vendor
rm -f $(TARGET)
rm -f giroapp.ini
.PHONY: install
install: $(TARGET) test
ifndef GIROAPP_INSTALLED
$(error "giroapp is not available, please install to continue")
endif
cp $< $(shell giroapp conf plugins_dir)
.PHONY: uninstall
uninstall:
ifndef GIROAPP_INSTALLED
$(error "giroapp is not available, please install to continue")
endif
rm -f $(shell giroapp conf plugins_dir)/$(TARGET)
composer.lock: composer.json
@echo composer.lock is not up to date
vendor/installed: composer.lock
$(COMPOSER_CMD) install
touch $@
tools/installed:
$(PHIVE_CMD) install --force-accept-unsigned
touch $@
$(BOX_CMD): tools/installed
$(GIROAPP_CMD): tools/installed