-
Notifications
You must be signed in to change notification settings - Fork 161
/
Makefile
95 lines (79 loc) · 2.54 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
SHELL=/bin/bash
SRC_DIR = src
DOC_DIR = doc
PLUGIN_DIR = plugins
NDPROJ_DIR = ndproj
BASE_FILES = $(SRC_DIR)/base64.js \
$(SRC_DIR)/sha1.js \
$(SRC_DIR)/md5.js \
$(SRC_DIR)/core.js
STROPHE = strophe.js
STROPHE_MIN = strophe.min.js
PLUGIN_FILES = $(shell ls $(PLUGIN_DIR)/strophe.*.js | grep -v min)
PLUGIN_FILES_MIN = $(PLUGIN_FILES:.js=.min.js)
DIST_FILES = LICENSE.txt README.txt contrib examples plugins tests doc \
$(STROPHE) $(STROPHE_MIN)
VERSION = $(shell if [ -f version.txt ]; then cat version.txt; else VERSION=`git rev-list HEAD -n1`; echo $${VERSION:0:7}; fi)
all: normal min
normal: $(STROPHE)
min: $(STROPHE_MIN) $(PLUGIN_FILES_MIN)
$(STROPHE): $(BASE_FILES)
@@echo "Building" $(STROPHE) "..."
@@cat $(BASE_FILES) | sed -e 's/@VERSION@/$(VERSION)/' > $(STROPHE)
@@echo $(STROPHE) "built."
@@echo
$(STROPHE_MIN): $(STROPHE)
@@echo "Building" $(STROPHE_MIN) "..."
ifdef YUI_COMPRESSOR
@@java -jar $(YUI_COMPRESSOR) --type js --nomunge \
$(STROPHE) > $(STROPHE_MIN)
@@echo $(STROPHE_MIN) "built."
else
@@echo $(STROPHE_MIN) "not built."
@@echo " YUI Compressor required to build minified version."
@@echo " Please set YUI_COMPRESSOR to the path to the jar file."
endif
@@echo
%.min.js: %.js
@@echo "Building" $@ "..."
ifdef YUI_COMPRESSOR
@@java -jar $(YUI_COMPRESSOR) --type js --nomunge \
$< > $@
@@echo $@ "built."
else
@@echo $@ "not built."
@@echo " YUI Compressor required to build minified version."
@@echo " Please set YUI_COMPRESSOR to the path to the jar file."
endif
@@echo
doc:
@@echo "Building Strophe documentation..."
@@if [ ! -d $(NDPROJ_DIR) ]; then mkdir $(NDPROJ_DIR); fi
@@if [ ! -d $(DOC_DIR) ]; then mkdir $(DOC_DIR); fi
@@NaturalDocs -q -i $(SRC_DIR) -i $(PLUGINS_DIR) -o html $(DOC_DIR) -p $(NDPROJ_DIR)
@@echo "Documentation built."
@@echo
release: normal min doc
@@echo "Creating release packages..."
@@mkdir strophejs-$(VERSION)
@@cp -R $(DIST_FILES) strophejs-$(VERSION)
@@tar czf strophejs-$(VERSION).tar.gz strophejs-$(VERSION)
@@zip -qr strophejs-$(VERSION).zip strophejs-$(VERSION)
@@rm -rf strophejs-$(VERSION)
@@echo "Release created."
@@echo
clean:
@@echo "Cleaning" $(STROPHE) "..."
@@rm -f $(STROPHE)
@@echo $(STROPHE) "cleaned."
@@echo "Cleaning" $(STROPHE_MIN) "..."
@@rm -f $(STROPHE_MIN)
@@echo $(STROPHE_MIN) "cleaned."
@@echo "Cleaning minified plugins..."
@@rm -f $(PLUGIN_FILES_MIN)
@@echo "Minified plugins cleaned."
@@echo "Cleaning documentation..."
@@rm -rf $(NDPROJ_DIR) $(DOC_DIR)
@@echo "Documentation cleaned."
@@echo
.PHONY: all normal min doc release clean