-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
133 lines (103 loc) · 4.16 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
################################################################################
NAME=sonat
CURDIRNAME=$(shell basename $(CURDIR))
PYTHON_PACKAGE_NAME=$(NAME)
PYTHON_VERSION=$(shell python -c 'import sys; print "%d.%d"%sys.version_info[:2]')
VERSION=$(shell python -c 'import setup; print setup.version')
RELEASE=${VERSION}
DATE=$(shell python -c 'import setup; print setup.date')
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
#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 " dist call all build targets"
@echo ""
@echo " Test:"
@echo " test-unittests perform all unit tests using nosetests'
@echo " test-install test python setup in $(TEST_SETUP_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 && make
html:
cd doc && make html
pdf:
cd doc && make pdf
safedoc:
make doc
lib:
python setup.py build_ext --inplace --force
# 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.py sdist
dist: sdist
################################################################################
# TEST
################################################################################
test-install: clean-build clean-test-install
python setup.py install -O1 --prefix=$(TEST_SETUP_INST_DIR)
python -c "import sys;sys.path.insert(0,'$(TEST_SETUP_INST_DIR)/lib/python$(PYTHON_VERSION)/site-packages');import $(PYTHON_PACKAGE_NAME); $(PYTHON_PACKAGE_NAME).info()"
test-unittests:
cd test && make
test: test-unittests test-install
################################################################################
# CLEAN
################################################################################
clean-doc:
-cd doc && 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: clean-test-install
-rmdir $(TEST_INST_DIR)
clean-partial: clean-build clean-lib
clean: clean-partial clean-test
clean-all: uninstall clean clean-dist