Commit 006576a6 authored by Martín Ferrari's avatar Martín Ferrari

Some improvements to the Makefile.

parent 75f3762b
...@@ -2,9 +2,11 @@ SRC = src ...@@ -2,9 +2,11 @@ SRC = src
TEST = test TEST = test
BUILDDIR = build BUILDDIR = build
DISTDIR = dist DISTDIR = dist
COVERDIR = coverage
SRCFILES := $(shell find $(SRC) -type f)
# stupid distutils, it's broken in so many ways # stupid distutils, it's broken in so many ways
SUBBUILDDIR = $(shell python -c 'import distutils.util, sys; \ SUBBUILDDIR := $(shell python -c 'import distutils.util, sys; \
print "lib.%s-%s" % (distutils.util.get_platform(), \ print "lib.%s-%s" % (distutils.util.get_platform(), \
sys.version[0:3])') sys.version[0:3])')
PYTHON25 := $(shell python -c 'import sys; v = sys.version_info; \ PYTHON25 := $(shell python -c 'import sys; v = sys.version_info; \
...@@ -16,11 +18,13 @@ else ...@@ -16,11 +18,13 @@ else
BUILDDIR := $(BUILDDIR)/lib BUILDDIR := $(BUILDDIR)/lib
endif endif
COVERAGE = $(or $(shell which coverage), $(shell which python-coverage), \ COVERAGE := $(or $(shell which coverage), $(shell which python-coverage), \
coverage) coverage)
all: all: build_stamp
build_stamp: $(SRCFILES)
./setup.py build ./setup.py build
touch $@
install: all install: all
./setup.py install ./setup.py install
...@@ -32,25 +36,32 @@ test: all ...@@ -32,25 +36,32 @@ test: all
PYTHONPATH="$(BUILDDIR)" $$i || retval=$$?; \ PYTHONPATH="$(BUILDDIR)" $$i || retval=$$?; \
done; exit $$retval done; exit $$retval
coverage: all coverage: coverage_stamp
rm -f .coverage $(COVERAGE) -r -m `find "$(BUILDDIR)" -name \\*.py -type f`
coverage-report: coverage_stamp
rm -rf $(COVERDIR)
$(COVERAGE) -b -d $(COVERDIR) `find "$(BUILDDIR)" -name \\*.py -type f`
@echo "Coverage report created in $(COVERDIR)/index.html"
coverage_stamp: build_stamp
for i in `find "$(TEST)" -perm -u+x -type f`; do \ for i in `find "$(TEST)" -perm -u+x -type f`; do \
set -e; \ set -e; \
PYTHONPATH="$(BUILDDIR)" $(COVERAGE) -x $$i; \ PYTHONPATH="$(BUILDDIR)" $(COVERAGE) -x $$i; \
done done
$(COVERAGE) -c $(COVERAGE) -c
$(COVERAGE) -r -m `find "$(BUILDDIR)" -name \\*.py -type f` touch $@
rm -f .coverage
clean: clean:
./setup.py clean ./setup.py clean
rm -f `find -name \*.pyc` .coverage *.pcap rm -f `find -name \*.pyc` .coverage *.pcap *_stamp
rm -rf $(COVERDIR)
$(MAKE) -C $(CURDIR)/benchmarks/ clean $(MAKE) -C $(CURDIR)/benchmarks/ clean
distclean: clean distclean: clean
rm -rf "$(DISTDIR)" rm -rf "$(DISTDIR)"
MANIFEST: MANIFEST: distclean
find . -path ./.hg -prune -o -path ./build -prune -o \ find . -path ./.hg -prune -o -path ./build -prune -o \
-name \*.pyc -prune -o -name \*.swp -prune -o \ -name \*.pyc -prune -o -name \*.swp -prune -o \
-name MANIFEST -prune -o -type f -print | \ -name MANIFEST -prune -o -type f -print | \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment