-
Notifications
You must be signed in to change notification settings - Fork 0
/
plugin.mk
54 lines (42 loc) · 1.18 KB
/
plugin.mk
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
all: pkg
clean: clean-deps clean-pkg
deps: $(deps)
clean-deps:
@if [ ! "$(deps)" = "" ]; then \
echo "rm -rf $(deps)"; \
rm -rf $(deps); \
fi
pkg: pkg_files-var plugin_name-var deps clean-pkg
mkdir pkg
cp -a $(pkg_files) pkg
cd pkg; zip -r ../$(plugin_name).zip *
clean-pkg: plugin_name-var
rm -rf pkg
rm -f $(plugin_name).zip
publish: plugin_name-var publish_url-var s3cfg s3cmd pkg
s3cmd put -Pc s3cfg $(plugin_name).zip $(publish_url)
s3cfg:
@if [ ! -e s3cfg ]; then \
echo "To publish to s3, copy s3cfg.in to s3cfg and edit" \
"s3cfg specifying your AWS credentials for s3." | fold -s; \
exit 1; \
fi
s3cmd:
@if [ "$$(which s3cmd)" = "" ]; then \
echo "To publish to s3, you must install s3cmd. If a system" \
"package isn't available, you can download the source from" \
"http://s3tools.org/s3cmd." | fold -s; \
exit 1; \
fi
define check-val
@if [ "$1" = "" ]; then \
echo "Missing required Makefile variable $2"; \
exit 1; \
fi
endef
pkg_files-var:
$(call check-val,$(pkg_files),pkg_files)
plugin_name-var:
$(call check-val,$(plugin_name),plugin_name)
publish_url-var:
$(call check-val,$(publish_url),publish_url)