forked from owncloud/updater
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
110 lines (86 loc) · 2.41 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
SHELL := /bin/bash
#
# Define NPM and check if it is available on the system.
#
NPM := $(shell command -v npm 2> /dev/null)
ifndef NPM
$(error npm is not available on your system, please install npm)
endif
PHPUNIT="$(PWD)/lib/composer/phpunit/phpunit/phpunit"
updater_doc_files=COPYING-AGPL README.md
updater_src_files=application.php index.php
updater_src_dirs=app pub src vendor
updater_all_src=$(updater_src_files) $(updater_src_dirs) $(updater_doc_files)
build_dir=build
dist_dir=$(build_dir)/dist
COMPOSER_BIN=$(build_dir)/composer.phar
BOWER=$(build_dir)/node_modules/bower/bin/bower
# internal aliases
composer_deps=vendor/
composer_dev_deps=lib/composer/phpunit
js_deps=pub/js/vendor/
#
# Catch-all rules
#
.PHONY: all
all: $(composer_dev_deps) $(js_deps)
.PHONY: clean
clean: clean-composer-deps clean-js-deps clean-dist clean-build
#
# Basic required tools
#
$(COMPOSER_BIN):
mkdir $(build_dir)
cd $(build_dir) && curl -sS https://getcomposer.org/installer | php
$(BOWER):
$(NPM) install --prefix $(build_dir) bower
touch $(BOWER)
#
# ownCloud updater PHP dependencies
#
$(composer_deps): $(COMPOSER_BIN) composer.json composer.lock
php $(COMPOSER_BIN) install --no-dev
$(composer_dev_deps): $(COMPOSER_BIN) composer.json composer.lock
php $(COMPOSER_BIN) install --dev
.PHONY: clean-composer-deps
clean-composer-deps:
rm -f $(COMPOSER_BIN)
rm -Rf $(composer_deps)
.PHONY: update-composer
update-composer: $(COMPOSER_BIN)
rm -f composer.lock
php $(COMPOSER_BIN) install --prefer-dist
#
# ownCloud updater JavaScript dependencies
#
$(js_deps): $(BOWER) bower.json
$(BOWER) install
touch $(js_deps)
.PHONY: install-js-deps
install-js-deps: $(js_deps)
.PHONY: update-js-deps
update-js-deps: $(js_deps)
.PHONY: clean-js-deps
clean-js-deps:
rm -Rf $(js_deps)
#
# dist
#
$(dist_dir)/updater: $(composer_deps) $(js_deps)
rm -Rf $@; mkdir -p $@
cp -R $(updater_all_src) $@
find $@/{vendor/,src/} -type d -iname Test? -print | xargs rm -Rf
find $@/{vendor/,src/} -name travis -print | xargs rm -Rf
find $@/{vendor/,src/} -name doc -print | xargs rm -Rf
find $@/{vendor/,src/} -iname \*.sh -delete
find $@/{vendor/,src/} -iname \*.exe -delete
find $@/pub/js/vendor/jquery \! -name jquery.min.* -type f -exec rm -f {} +
find $@/pub/js/vendor/jquery/* -type d -exec rm -rf {} +
.PHONY: dist
dist: $(dist_dir)/updater
.PHONY: clean-dist
clean-dist:
rm -Rf $(dist_dir)
.PHONY: clean-build
clean-build:
rm -Rf $(build_dir)