-
Notifications
You must be signed in to change notification settings - Fork 88
/
Makefile
169 lines (125 loc) · 3.71 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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
#
# Makefile for KeepNote
#
# common building tasks
#
PKG=keepnote
VERSION:=$(shell python -c 'import keepnote; print keepnote.PROGRAM_VERSION_TEXT')
# build programs
PYTHON=python
VENV_DIR=env
VENV=. $(VENV_DIR)/bin/activate
# release filenames
SDIST_FILE=$(PKG)-$(VERSION).tar.gz
RPM_FILE=$(PKG)-$(VERSION)-1.noarch.rpm
EBUILD_FILE=$(PKG)-$(VERSION).ebuild
DEB_FILE=$(PKG)_$(VERSION)-1_all.deb
WININSTALLER_FILE=$(PKG)-$(VERSION).exe
# release file locations
SDIST=dist/$(SDIST_FILE)
RPM=dist/$(RPM_FILE)
DEB=dist/$(DEB_FILE)
EBUILD=dist/$(EBUILD_FILE)
WININSTALLER=dist/$(WININSTALLER_FILE)
# files to upload
UPLOAD_FILES=$(SDIST) $(RPM) $(DEB) $(EBUILD) $(WININSTALLER)
CODEQUALITY_FILES=\
setup.py \
keepnote/*.py \
keepnote/gui \
keepnote/notebook \
keepnote/server \
tests/*.py
TMP_FILES=MANIFEST
# windows related variables
WINDIR=dist/$(PKG)-$(VERSION).win
WINEXE=$(WINDIR)/$(PKG).exe
WININSTALLER_SRC=installer.iss
# personal www paths
WWW=/var/www/dev/rasm/keepnote
.PHONY: all dev venv sdist rpm deb ebuild clean cq test teardown help share \
winebuild wineinstaller winclean contribs \
pypi upload upload-test upload-contrib
#=============================================================================
# dev
dev: venv
$(VENV) && pip install -r requirements-dev.txt
npm install
[ -f bower ] || ln -s node_modules/.bin/bower bower
[ -f gulp ] || ln -s node_modules/.bin/gulp gulp
./bower install
venv: $(VENV_DIR)/bin/activate
$(VENV_DIR)/bin/activate:
virtualenv --system-site-packages env
cq:
$(VENV) && pep8 $(CODEQUALITY_FILES) | grep -v 'tarfile\|sqlitedict\|bottle.py' || true
$(VENV) && pyflakes $(CODEQUALITY_FILES) | grep -v 'tarfile\|sqlitedict\|bottle.py' || true
test: venv
$(VENV) && nosetests -sv tests/*.py
npm test
teardown:
rm -rf $(VENV_DIR)
rm -rf node_modules
rm -rf bower_components
rm -f bower gulp
# show makefile actions
help:
grep '^[^$$][^\w=]*:[^=]*$$' Makefile | sed 's/:.*//'
#=============================================================================
# linux build
all: $(UPLOAD_FILES)
# source distribution *.tar.gz
sdist: $(SDIST)
$(SDIST):
$(PYTHON) setup.py sdist
# RPM binary package
rpm: $(RPM)
$(RPM):
$(PYTHON) setup.py bdist --format=rpm
# Debian package
deb: $(DEB)
$(DEB): $(SDIST)
pkg/deb/make-deb.sh $(VERSION)
mv pkg/deb/$(DEB_FILE) $(DEB)
# Gentoo package
ebuild: $(EBUILD)
$(EBUILD):
cp pkg/ebuild/$(PKG)-template.ebuild $(EBUILD)
clean:
rm -rf $(TMP_FILES) $(UPLOAD_FILES) $(WINDIR) $(WININSTALLER_SRC)
#=============================================================================
# icons
share:
mkdir -p share/icons/gnome/16x16/
cp -r -L /usr/share/icons/gnome/16x16/mimetypes share/icons/gnome/16x16/
mkdir -p share/icons/gnome/16x16/actions
cp -L /usr/share/icons/gnome/16x16/actions/gtk-execute.png share/icons/gnome/16x16/actions
#=============================================================================
# wine build
winebuild: $(WINEXE)
$(WINEXE):
pkg/win/build.sh
wineinstaller: $(WININSTALLER)
$(WININSTALLER): $(WINEXE) $(WININSTALLER_SRC)
./wine.sh iscc $(WININSTALLER_SRC)
$(WININSTALLER_SRC):
$(PYTHON) pkg/win/make-win-installer-src.py \
pkg/win/installer-template.iss > $(WININSTALLER_SRC)
winclean:
rm -rf $(WININSTALLER) $(WININSTALLER_SRC) $(WINDIR)
#=============================================================================
# contrib
contribs:
make -C contrib
#=============================================================================
# upload
pypi:
$(PYTHON) setup.py register
upload: $(UPLOAD_FILES)
cp $(UPLOAD_FILES) $(WWW)/download
tar zxv -C $(WWW)/download \
-f $(WWW)/download/$(SDIST_FILE)
upload-test: $(UPLOAD_FILES)
cp $(UPLOAD_FILES) $(WWW)/download-test
upload-contrib:
make -C contrib upload