Makefile 2.8 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 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
	rm -f docs/build/api/*.rst
C
Cleber Rosa 已提交
62 63 64
	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
65 66 67

check:
	selftests/checkall
68

C
Cleber Rosa 已提交
69 70 71 72 73
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

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

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

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