| 1 |
MININET = mininet/*.py |
| 2 |
TEST = mininet/test/*.py |
| 3 |
EXAMPLES = mininet/examples/*.py |
| 4 |
MN = bin/mn |
| •5 |
PYTHON ?= python3 |
| 6 |
PYMN = $(PYTHON) -B bin/mn |
| 7 |
BIN = $(MN) |
| 8 |
PYSRC = $(MININET) $(TEST) $(EXAMPLES) $(BIN) |
| 9 |
MNEXEC = mnexec |
| 10 |
MANPAGES = mn.1 mnexec.1 |
| 11 |
P8IGN = E251,E201,E302,E202,E126,E127,E203,E226,E402,W504,W503,E731 |
| 12 |
PREFIX ?= /usr |
| 13 |
BINDIR ?= $(PREFIX)/bin |
| 14 |
MANDIR ?= $(PREFIX)/share/man/man1 |
| 15 |
DOCDIRS = doc/html doc/latex |
| 16 |
PDF = doc/latex/refman.pdf |
| 17 |
CC ?= cc |
| 18 |
|
| 19 |
CFLAGS += -Wall -Wextra |
| 20 |
|
| 21 |
all: codecheck test |
| 22 |
|
| 23 |
clean: |
| 24 |
rm -rf build dist *.egg-info *.pyc $(MNEXEC) $(MANPAGES) $(DOCDIRS) |
| 25 |
|
| 26 |
codecheck: $(PYSRC) |
| 27 |
-echo "Running code check" |
| 28 |
util/versioncheck.py |
| 29 |
pyflakes $(PYSRC) |
| 30 |
pylint --rcfile=.pylint $(PYSRC) |
| 31 |
# Exclude miniedit from pep8 checking for now |
| 32 |
pep8 --repeat --ignore=$(P8IGN) `ls $(PYSRC) | grep -v miniedit.py` |
| 33 |
|
| 34 |
errcheck: $(PYSRC) |
| 35 |
-echo "Running check for errors only" |
| 36 |
pyflakes $(PYSRC) |
| 37 |
pylint -E --rcfile=.pylint $(PYSRC) |
| 38 |
|
| 39 |
test: $(MININET) $(TEST) |
| 40 |
-echo "Running tests" |
| 41 |
mininet/test/test_nets.py |
| 42 |
mininet/test/test_hifi.py |
| 43 |
|
| 44 |
slowtest: $(MININET) |
| 45 |
-echo "Running slower tests (walkthrough, examples)" |
| 46 |
mininet/test/test_walkthrough.py -v |
| 47 |
mininet/examples/test/runner.py -v |
| 48 |
|
| 49 |
mnexec: mnexec.c $(MN) mininet/net.py |
| 50 |
$(CC) $(CFLAGS) $(LDFLAGS) -DVERSION=\"`PYTHONPATH=. $(PYMN) --version`\" $< -o $@ |
| 51 |
|
| 52 |
install-mnexec: $(MNEXEC) |
| 53 |
install -D $(MNEXEC) $(BINDIR)/$(MNEXEC) |
| 54 |
|
| 55 |
install-manpages: $(MANPAGES) |
| 56 |
install -D -t $(MANDIR) $(MANPAGES) |
| 57 |
|
| 58 |
install: install-mnexec install-manpages |
| 59 |
# This seems to work on all pip versions |
| 60 |
$(PYTHON) -m pip uninstall -y mininet || true |
| 61 |
$(PYTHON) -m pip install . |
| 62 |
|
| 63 |
develop: $(MNEXEC) $(MANPAGES) |
| 64 |
# Perhaps we should link these as well |
| 65 |
install $(MNEXEC) $(BINDIR) |
| 66 |
install $(MANPAGES) $(MANDIR) |
| 67 |
$(PYTHON) -m pip uninstall -y mininet || true |
| 68 |
$(PYTHON) -m pip install -e . --no-binary :all: |
| 69 |
|
| 70 |
man: $(MANPAGES) |
| 71 |
|
| 72 |
mn.1: $(MN) |
| 73 |
PYTHONPATH=. help2man -N -n "create a Mininet network." \ |
| 74 |
--no-discard-stderr "$(PYMN)" -o $@ |
| 75 |
|
| 76 |
mnexec.1: mnexec |
| 77 |
help2man -N -n "execution utility for Mininet." \ |
| 78 |
-h "-h" -v "-v" --no-discard-stderr ./$< -o $@ |
| 79 |
|
| 80 |
.PHONY: doc |
| 81 |
|
| 82 |
doc: man |
| 83 |
doxygen doc/doxygen.cfg |
| 84 |
make -C doc/latex |