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

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
	$(PYTHON) setup.py sdist $(COMPILE) --dist-dir=SOURCES --prune
21 22 23 24 25 26 27

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
28
	dch -D "utopic" -M -v "$(VERSION)" "Automated (make builddeb) build."
29 30 31 32 33
	$(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
34
	dpkg-buildpackage -S -elookkas@gmail.com -rfakeroot
35 36 37 38 39 40 41 42 43

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 已提交
44 45 46 47
build-rpm-src: source
	rpmbuild --define '_topdir %{getenv:PWD}' \
		 -bs avocado.spec

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

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

check:
	selftests/checkall
67

C
Cleber Rosa 已提交
68 69 70 71 72
link:
	test -d ../avocado-virt/avocado/virt && ln -s ../../avocado-virt/avocado/virt avocado || true
	test -f ../avocado-virt/avocado/plugins/virt.py && ln -s ../../../avocado-virt/avocado/plugins/virt.py avocado/plugins/ || true
	test -f ../avocado-virt/avocado/plugins/virt_bootstrap.py && ln -s ../../../avocado-virt/avocado/plugins/virt_bootstrap.py avocado/plugins/ || true

73
man: man/avocado.1 man/avocado-rest-client.1
74

75 76 77 78 79
.PHONY: source install clean check link

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