forked from Raimondi/delimitMate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
62 lines (49 loc) · 1.83 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
PLUGIN=$(shell basename "$$PWD")
SCRIPT=$(wildcard plugin/*.vim)
#AUTOL=$(wildcard autoload/*.vim)
AUTOL=autoload/$(PLUGIN).vim
DOC=$(wildcard doc/*.txt)
TESTS=$(wildcard autoload/*Tests.vim)
VERSION=$(shell perl -ne 'if (/\*\sCurrent\srelease:/) {s/^\s+(\d+\.\S+)\s.*$$/\1/;print}' $(DOC))
VIMFOLDER=~/.vim/
VIM=/usr/bin/vim
.PHONY: $(PLUGIN).vba README
all: vimball README zip gzip
vimball: $(PLUGIN).vba
clean:
@echo clean
rm -f *.vba */*.orig *.~* .VimballRecord *.zip *.gz
dist-clean: clean
undo:
for i in */*.orig; do mv -f "$$i" "$${i%.*}"; done
README:
@echo README
cp -f $(DOC) README
$(PLUGIN).vba:
@echo $(PLUGIN).vba
rm -f $(PLUGIN)-$(VERSION).vba
$(VIM) -N -c 'ru! vimballPlugin.vim' -c ':call append("0", [ "$(SCRIPT)", "$(AUTOL)", "$(DOC)"])' -c '$$d' -c ":%MkVimball $(PLUGIN)-$(VERSION) ." -c':q!'
ln -f $(PLUGIN)-$(VERSION).vba $(PLUGIN).vba
zip:
@echo zip
rm -f *.zip
zip -r $(PLUGIN).zip doc plugin autoload
zip $(PLUGIN).zip -d \*.sw\? || echo 1
zip $(PLUGIN).zip -d \*.un\? || echo 1
zip $(PLUGIN).zip -d \*.orig || echo 1
zip $(PLUGIN).zip -d \*tags || echo 1
zip $(PLUGIN).zip -d $(TESTS)
ln -f $(PLUGIN).zip $(PLUGIN)-$(VERSION).zip
gzip: vimball
@echo vimball
gzip -f $(PLUGIN).vba
release: version all
version:
@echo version: $(VERSION)
perl -i.orig -pne 'if (/^"\sVersion:/) {s/(\d+\.\S+)/$(VERSION)/}' $(SCRIPT) $(AUTOL)
perl -i.orig -pne 'if (/let\sdelimitMate_version/) {s/"(\d+\.\S+)"/"$(VERSION)"/}' $(SCRIPT)
perl -i.orig -pne 'if (/beasts/) {s/(v\d+\.\S+)/v$(VERSION)/}' $(DOC)
perl -i.orig -MPOSIX -pne 'if (/^"\sModified:/) {$$now_string = strftime "%F", localtime; s/(\d+-\d+-\d+)/$$now_string/e}' $(SCRIPT) $(AUTOL)
perl -i.orig -MPOSIX -pne 'if (/^\s+$(VERSION)\s+\d+-\d+-\d+\s+\*/) {$$now_string = strftime "%F", localtime; s/(\d+-\d+-\d+)/$$now_string/}' $(DOC)
@echo Version: $(VERSION)
echo: