Makefile 4.5 KB
Newer Older
1 2 3 4
PYTHON=`which python`
DESTDIR=/
BUILDIR=$(CURDIR)/debian/avocado
PROJECT=avocado
5
VERSION=`$(CURDIR)/avocado/core/version.py`
6 7 8 9 10 11 12

all:
	@echo "make source - Create source package"
	@echo "make install - Install on local system"
	@echo "make build-deb-src - Generate a source debian package"
	@echo "make build-deb-bin - Generate a binary debian package"
	@echo "make build-deb-all - Generate both source and binary debian packages"
C
Cleber Rosa 已提交
13
	@echo "make build-rpm-src - Generate a source RPM package (.srpm)"
14
	@echo "make build-rpm-all - Generate both source and binary RPMs"
15
	@echo "make man - Generate the avocado man page"
16
	@echo "make check - Runs tree static check, unittests and functional tests"
17 18 19
	@echo "make clean - Get rid of scratch and byte files"

source:
20 21
	if test ! -d SOURCES; then mkdir SOURCES; fi
	git archive --prefix="avocado-$(VERSION)/" -o "SOURCES/avocado-$(VERSION).tar.gz" HEAD
22 23 24 25 26 27 28

install:
	$(PYTHON) setup.py install --root $(DESTDIR) $(COMPILE)

prepare-source:
	# build the source package in the parent directory
	# then rename it to project_version.orig.tar.gz
29
	dch -D "utopic" -M -v "$(VERSION)" "Automated (make builddeb) build."
30 31 32 33 34
	$(PYTHON) setup.py sdist $(COMPILE) --dist-dir=../ --prune
	rename -f 's/$(PROJECT)-(.*)\.tar\.gz/$(PROJECT)_$$1\.orig\.tar\.gz/' ../*

build-deb-src: prepare-source
	# build the source package
35
	dpkg-buildpackage -S -elookkas@gmail.com -rfakeroot
36 37 38 39 40 41 42 43 44

build-deb-bin: prepare-source
	# build binary package
	dpkg-buildpackage -b -rfakeroot

build-deb-all: prepare-source
	# build both source and binary packages
	dpkg-buildpackage -i -I -rfakeroot

C
Cleber Rosa 已提交
45 46 47 48
build-rpm-src: source
	rpmbuild --define '_topdir %{getenv:PWD}' \
		 -bs avocado.spec

49 50 51 52
build-rpm-all: source
	rpmbuild --define '_topdir %{getenv:PWD}' \
		 -ba avocado.spec

53 54
clean:
	$(PYTHON) setup.py clean
55
	$(MAKE) -f $(CURDIR)/debian/rules clean || true
56
	rm -rf build/ MANIFEST BUILD BUILDROOT SPECS RPMS SRPMS SOURCES
57
	find . -name '*.pyc' -delete
58
	rm -f man/avocado.1
59
	rm -f man/avocado-rest-client.1
60
	rm -rf docs/build
61
	find docs/source/api/ -name '*.rst' -delete
C
Cleber Rosa 已提交
62
	test -L avocado/virt && rm -f avocado/virt || true
63 64
	test -L avocado/core/plugins/virt.py && rm -f avocado/core/plugins/virt.py || true
	test -L avocado/core/plugins/virt_bootstrap.py && rm -f avocado/core/plugins/virt_bootstrap.py || true
65
	test -L etc/avocado/conf.d/virt.conf && rm -f etc/avocado/conf.d/virt.conf || true
66 67 68 69
	test -L avocado/core/plugins/vt.py && rm -f avocado/core/plugins/vt.py || true
	test -L avocado/core/plugins/vt_list.py && rm -f avocado/core/plugins/vt_list.py || true
	test -L avocado/core/plugins/vt_bootstrap.py && rm -f avocado/core/plugins/vt_bootstrap.py || true
	test -L etc/avocado/conf.d/vt.conf && rm -f etc/avocado/conf.d/vt.conf || true
70
	test -L virttest && rm -f virttest || true
71

72 73 74 75 76 77 78 79
install-requirements-all: install-requirements install-requirements-selftests

install-requirements:
	grep -v '^#' requirements.txt | xargs -n 1 pip install

install-requirements-selftests:
	grep -v '^#' requirements-selftests.txt | xargs -n 1 pip install

80
check: clean check_cyclical modules_boundaries
81
	selftests/checkall
82

83 84 85
check_cyclical:
	selftests/cyclical_deps avocado

86 87 88
modules_boundaries:
	selftests/modules_boundaries

89 90 91
link: link_virt link_vt

link_virt:
92 93 94 95
	test -d ../avocado-virt/avocado/virt && ln -sf ../../avocado-virt/avocado/virt avocado || true
	test -f ../avocado-virt/etc/avocado/conf.d/virt.conf && ln -sf ../../../../avocado-virt/etc/avocado/conf.d/virt.conf etc/avocado/conf.d/ || true
	test -f ../avocado-virt/avocado/core/plugins/virt.py && ln -sf ../../../../avocado-virt/avocado/core/plugins/virt.py avocado/core/plugins/ || true
	test -f ../avocado-virt/avocado/core/plugins/virt_bootstrap.py && ln -sf ../../../../avocado-virt/avocado/core/plugins/virt_bootstrap.py avocado/core/plugins/ || true
96 97

link_vt:
98 99 100 101
	test -f ../avocado-vt/etc/avocado/conf.d/vt.conf && ln -sf ../../../../avocado-vt/etc/avocado/conf.d/vt.conf etc/avocado/conf.d/ || true
	test -f ../avocado-vt/avocado/core/plugins/vt.py && ln -sf ../../../../avocado-vt/avocado/core/plugins/vt.py avocado/core/plugins/ || true
	test -f ../avocado-vt/avocado/core/plugins/vt_list.py && ln -sf ../../../../avocado-vt/avocado/core/plugins/vt_list.py avocado/core/plugins/ || true
	test -f ../avocado-vt/avocado/core/plugins/vt_bootstrap.py && ln -sf ../../../../avocado-vt/avocado/core/plugins/vt_bootstrap.py avocado/core/plugins/ || true
102
	test -d ../avocado-vt/virttest && ln -sf ../avocado-vt/virttest . || true
C
Cleber Rosa 已提交
103

104
man: man/avocado.1 man/avocado-rest-client.1
105

106 107 108 109 110
.PHONY: source install clean check link

# implicit rule/recipe for man page creation
%.1: %.rst
	rst2man $< $@