summaryrefslogtreecommitdiff
path: root/Makefile
blob: 19541456bd713f2ed9a00a5badabf9bb960c0a9c (plain)
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
# Building
RABBIT_DIR=rabbitmq-c
CODEGEN_DIR=rabbitmq-codegen
RABBIT_TARGET=clib
RABBIT_DIST=rabbitmq-c-0.5.3

# Distribuition tools
PYTHON=python

all: build

add-submodules:
	-git submodule add https://github.com/ask/rabbitmq-c.git
	-git submodule add https://github.com/rabbitmq/rabbitmq-codegen

submodules:
	git submodule init
	git submodule update
	(cd $(RABBIT_DIR); rm -rf codegen; ln -sf ../$(CODEGEN_DIR) ./codegen)

rabbitmq-c: submodules
	(cd $(RABBIT_DIR); test -f configure || autoreconf -i)
	(cd $(RABBIT_DIR); test -f Makefile  || automake --add-missing)


rabbitmq-clean:
	-(cd $(RABBIT_DIR) && make clean)
	-(cd $(RABBIT_TARGET) && make clean)

rabbitmq-distclean:
	-(cd $(RABBIT_DIR) && make distclean)
	-(cd $(RABBIT_TARGET) && make distclean)

clean-build:
	-rm -rf build

build: clean-build dist
	python setup.py build

install: build
	python setup.py install

develop: build
	python setup.py develop

pyclean:
	-python setup.py clean
	-rm -rf build
	-rm -f _librabbitmq.so

clean: pyclean rabbitmq-clean

distclean: pyclean rabbitmq-distclean removepyc
	-rm -rf dist
	-rm -rf clib
	-rm -f erl_crash.dump

$(RABBIT_TARGET):
	(test -f config.h || cd $(RABBIT_DIR); ./configure --disable-tools --disable-docs)
	(cd $(RABBIT_DIR); make distdir)
	mv "$(RABBIT_DIR)/$(RABBIT_DIST)" "$(RABBIT_TARGET)"


dist: rabbitmq-c $(RABBIT_TARGET)


rebuild:
	python setup.py build
	python setup.py install


# Distro tools

flakecheck:
	flake8 librabbitmq setup.py

flakediag:
	-$(MAKE) flakecheck

flakepluscheck:
	flakeplus librabbitmq

flakeplusdiag:
	-$(MAKE) flakepluscheck

flakes: flakediag flakeplusdiag

test:
	nosetests -xv librabbitmq.tests

cov:
	nosetests -xv librabbitmq.tests --with-coverage --cover-html --cover-branch

removepyc:
	-find . -type f -a \( -name "*.pyc" -o -name "*$$py.class" \) | xargs rm
	-find . -type d -name "__pycache__" | xargs rm -r

gitclean:
	git clean -xdn

gitcleanforce:
	git clean -xdf

distcheck: flakecheck test gitclean