forked from VACUMM/vacumm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
177 lines (140 loc) · 5.96 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
170
171
172
173
174
175
################################################################################
NAME=vacumm
CURDIRNAME=$(shell basename $(CURDIR))
PYTHON_PACKAGE_NAME=$(NAME)
PYTHON_VERSION=$(shell python -c 'import sys; print "%d.%d"%sys.version_info[:2]')
VERSION=$(shell PYTHONPATH=lib/python python -c 'import '$(PYTHON_PACKAGE_NAME)'; print '$(PYTHON_PACKAGE_NAME)'.__version__')
RELEASE=$(shell PYTHONPATH=lib/python python -c 'import '$(PYTHON_PACKAGE_NAME)'; print '$(PYTHON_PACKAGE_NAME)'.__release__')
DATE=$(shell PYTHONPATH=lib/python python -c 'import '$(PYTHON_PACKAGE_NAME)'; print '$(PYTHON_PACKAGE_NAME)'.__date__')
SETUP_FILE_NAME=setup.py
SDIST_FILE_NAME=$(NAME)-$(VERSION).tar.gz
SDIST_FILE_PATH=dist/$(SDIST_FILE_NAME)
TEST_INST_DIR=$(CURDIR)/test/install
TEST_SETUP_INST_DIR=$(TEST_INST_DIR)/setup-inst
#RPM_NAME=$(NAME)-$(VERSION)-$(RELEASE)
RPM_NAME=$(NAME)-$(VERSION)-*
#RPM_FILE_NAME=$(RPM_NAME).noarch.rpm
RPM_FILE_NAME=$(RPM_NAME).*.rpm
RPM_FILE_PATH=dist/$(RPM_FILE_NAME)
TEST_RPM_INST_DIR=$(TEST_INST_DIR)/rpm-inst
#EXCLUDES=--exclude var --exclude *.pid --exclude *.log* --exclude *.out --exclude *.pyc
EXCLUDES=--exclude var
################################################################################
.PHONY: lib doc html pdf
################################################################################
all: help
help:
@echo ""
@echo "$(NAME) $(VERSION).$(RELEASE) ($(DATE))"
@echo ""
@echo "Usage: make [<target1> [<target2>...]]"
@echo ""
@echo "Available make targets:"
@echo ""
@echo " Build distribution:"
@echo " sdist build python source distribution $(SDIST_FILE_PATH)"
@echo " rpm build rpm $(RPM_FILE_PATH)"
@echo " dist call all build targets"
@echo ""
@echo " Test:"
@echo " test-install test python setup in $(TEST_SETUP_INST_DIR)"
@echo " test-rpm-info test rpm info of $(RPM_FILE_PATH)"
@echo " test-rpm-install test rpm install in $(TEST_RPM_INST_DIR)"
@echo " test-rpm-update test rpm update in $(TEST_RPM_INST_DIR)"
@echo " test-rpm-erase test rpm uninstall in $(TEST_RPM_INST_DIR)"
@echo " test call all test targets"
@echo ""
@echo " Clean"
@echo " clean-doc clean documentations"
@echo " clean-lib clean source package"
@echo " clean-build clean builds"
@echo " clean-test clean test installations"
@echo " clean-all call all clean and uninstall targets"
@echo ""
@echo " Development"
@echo " lib local compilation of modules and extensions"
@echo " doc generate documentations"
@echo " html generate html documentation"
@echo " pdf generate pdf documentation"
@echo " safedoc generate documentations and all their dependencies"
@echo " install prepare for local use (build libs, fix permissions)"
@echo " uninstall clean local installations"
@echo " arch clean all and create source archive in parent directory"
@echo ""
################################################################################
# DVELOPMENT
################################################################################
doc:
cd doc/sphinx && make
html:
cd doc/sphinx && make html
pdf:
cd doc/sphinx && make pdf
safedoc:
cd test && make
cd scripts/tutorials && make
cd scripts/courses && make
touch lib/python/vacumm/misc/color.py
make doc
lib:
python setup.py build_ext --inplace --force
#cd lib/python/vacumm/misc/grid && make
# install: lib doc
install: lib
uninstall: clean-lib clean-doc
arch: clean-all
cd .. && tar cvjf $(CURDIRNAME).tbz $(CURDIRNAME) $(EXCLUDES)
################################################################################
# BUILD DIST
################################################################################
sdist: clean-partial install
python $(SETUP_FILE_NAME) sdist
rpm: clean-partial install
python $(SETUP_FILE_NAME) bdist_rpm
dist: sdist rpm
################################################################################
# TEST
################################################################################
test-install: clean-build clean-test-install
python $(SETUP_FILE_NAME) install -O1 --prefix=$(TEST_SETUP_INST_DIR)
PYTHONPATH=$(TEST_SETUP_INST_DIR)/lib/python$(PYTHON_VERSION)/site-packages python -c "import "$(PYTHON_PACKAGE_NAME)"; "$(PYTHON_PACKAGE_NAME)".info()"
test-unittests:
cd test
make
unittests: test-unittests
test-rpm-info:
@echo -e "====\nInfo\n===="
rpm -qip $(RPM_FILE_PATH)
@echo -e "====\nList\n===="
rpm -qlp $(RPM_FILE_PATH)
@echo -e "========\nRequires\n========"
rpm -qRp $(RPM_FILE_PATH)
test-rpm-install: rpm
rpm --dbpath $(TEST_RPM_INST_DIR)/var/lib/rpm --initdb
rpm --dbpath $(TEST_RPM_INST_DIR)/var/lib/rpm -ivh $(RPM_FILE_PATH) --nodeps --replacepkgs --prefix $(TEST_RPM_INST_DIR)/usr
test-rpm-update: rpm
rpm --dbpath $(TEST_RPM_INST_DIR)/var/lib/rpm --initdb
rpm --dbpath $(TEST_RPM_INST_DIR)/var/lib/rpm -Uvh $(RPM_FILE_PATH) --nodeps --replacepkgs --prefix $(TEST_RPM_INST_DIR)/usr
test-rpm-erase:
rpm --dbpath $(TEST_RPM_INST_DIR)/var/lib/rpm -e $(RPM_NAME)
test: test-install test-rpm-install test-unittests
################################################################################
# CLEAN
################################################################################
clean-doc:
-cd doc/sphinx && make clean
clean-lib:
-find lib/python -name '*.py[co]' -delete
clean-build:
-rm -rf build MANIFEST setup.pyc
clean-dist:
-rm -rf dist
clean-test-install:
-rm -rf $(TEST_SETUP_INST_DIR)
clean-test-rpm-install:
-rm -rf $(TEST_RPM_INST_DIR)
clean-test: clean-test-install clean-test-rpm-install
-rmdir $(TEST_INST_DIR)
clean-partial: clean-build clean-lib
clean: clean-partial clean-test
clean-all: uninstall clean clean-dist