Makefile 3.0 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
AVOCADO_PLUGINS=$(filter-out ../avocado/Makefile, $(wildcard ../*/Makefile))
7 8 9 10 11 12 13

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 已提交
14
	@echo "make build-rpm-src - Generate a source RPM package (.srpm)"
15
	@echo "make build-rpm-all - Generate both source and binary RPMs"
16
	@echo "make man - Generate the avocado man page"
17
	@echo "make check - Runs tree static check, unittests and functional tests"
18 19 20
	@echo "make clean - Get rid of scratch and byte files"

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

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

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

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

54 55
clean:
	$(PYTHON) setup.py clean
56
	$(MAKE) -f $(CURDIR)/debian/rules clean || true
57
	rm -rf build/ MANIFEST BUILD BUILDROOT SPECS RPMS SRPMS SOURCES
58
	find . -name '*.pyc' -delete
59
	rm -f man/avocado.1
60
	rm -f man/avocado-rest-client.1
61
	rm -rf docs/build
62
	find docs/source/api/ -name '*.rst' -delete
63 64 65
	for MAKEFILE in $(AVOCADO_PLUGINS);\
		do make -f $$MAKEFILE unlink &>/dev/null && echo ">> UNLINK $$MAKEFILE" || echo ">> SKIP $$MAKEFILE";\
	done
66

67 68 69 70 71 72 73 74
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

75
check: clean check_cyclical modules_boundaries
76
	selftests/checkall
77

78 79 80
check_cyclical:
	selftests/cyclical_deps avocado

81 82 83
modules_boundaries:
	selftests/modules_boundaries

84 85 86 87
link:
	for MAKEFILE in $(AVOCADO_PLUGINS);\
		do make -f $$MAKEFILE link &>/dev/null && echo ">> LINK $$MAKEFILE" || echo ">> SKIP $$MAKEFILE";\
	done
C
Cleber Rosa 已提交
88

89
man: man/avocado.1 man/avocado-rest-client.1
90

91 92 93 94 95
.PHONY: source install clean check link

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