-
Notifications
You must be signed in to change notification settings - Fork 8
/
Makefile
98 lines (78 loc) · 2.23 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
SHELL := /bin/bash
YARN := $(shell command -v yarn 2> /dev/null)
ifndef YARN
$(error yarn is not available on your system, please install yarn)
endif
GIT := $(shell command -v git 2> /dev/null)
ifndef GIT
$(error git is not available on your system, please install git)
endif
app_name=files_mediaviewer
build_dir=$(CURDIR)/build
dist_dir=$(build_dir)/dist
src_files=README.md LICENSE CHANGELOG.md
src_dirs=appinfo js l10n templates
all_src=$(src_dirs) $(src_files)
occ=$(CURDIR)/../../occ
private_key=$(HOME)/.owncloud/certificates/$(app_name).key
certificate=$(HOME)/.owncloud/certificates/$(app_name).crt
sign=$(occ) integrity:sign-app --privateKey="$(private_key)" --certificate="$(certificate)"
sign_skip_msg="Skipping signing, either no key and certificate found in $(private_key) and $(certificate) or occ can not be found at $(occ)"
ifneq (,$(wildcard $(private_key)))
ifneq (,$(wildcard $(certificate)))
ifneq (,$(wildcard $(occ)))
CAN_SIGN=true
endif
endif
endif
.DEFAULT_GOAL := help
help:
@fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##//'
##
## Build targets
##--------------------------------------
.PHONY: dist
dist: ## Build distribution
dist: js-deps build-js distdir sign package
.PHONY: js-deps
js-deps:
$(YARN) install
.PHONY: build-js
build-js:
$(YARN) run build
.PHONY: distdir
distdir:
rm -rf $(dist_dir)
mkdir -p $(dist_dir)/$(app_name)
cp -R $(all_src) $(dist_dir)/$(app_name)
rm -Rf $(dist_dir)/$(app_name)/l10n/.tx
.PHONY: sign
sign:
ifdef CAN_SIGN
$(sign) --path="$(dist_dir)/$(app_name)"
else
@echo $(sign_skip_msg)
endif
.PHONY: package
package:
tar --format=gnu -czf $(dist_dir)/$(app_name).tar.gz -C $(dist_dir) $(app_name)
##
## l10n
##--------------------------------------
.PHONY: l10n-clean
l10n-clean:
cd l10n && make clean
.PHONY: l10n-read
l10n-read: js-deps
cd l10n && make makemessages
.PHONY: l10n-write
l10n-write: l10n/l10n.pl
perl l10n/l10n.pl files_mediaviewer write
.PHONY: l10n-push
l10n-push:
cd l10n && tx push -s
.PHONY: l10n-pull
l10n-pull:
cd l10n && tx pull -a --minimum-perc=15
l10n/l10n.pl:
wget -qO l10n/l10n.pl https://rawgit.com/ownclouders/7f3e2bdf09e6c7258850d770c0edaf0b/raw/d3ad1673b5449900f85a04f95cdf7e7149140c4f/l10n.pl