$OpenBSD: patch-Makefile,v 1.1.1.1 2017/08/21 18:47:12 akoshibe Exp $
Refactoring to make things buildable with both GNU and BSD make
and account for directory organization differences.
Index: Makefile
--- Makefile.orig
+++ Makefile
@@ -2,23 +2,23 @@ MININET = mininet/*.py
 TEST = mininet/test/*.py
 EXAMPLES = mininet/examples/*.py
 MN = bin/mn
-PYMN = python -B bin/mn
+PYMN = $(PYTHON) -B bin/mn
 BIN = $(MN)
 PYSRC = $(MININET) $(TEST) $(EXAMPLES) $(BIN)
 MNEXEC = mnexec
 MANPAGES = mn.1 mnexec.1
 P8IGN = E251,E201,E302,E202,E126,E127,E203,E226
-BINDIR = /usr/bin
-MANDIR = /usr/share/man/man1
 DOCDIRS = doc/html doc/latex
 PDF = doc/latex/refman.pdf
 
 CFLAGS += -Wall -Wextra
 
+include config.mk
+
 all: codecheck test
 
 clean:
-	rm -rf build dist *.egg-info *.pyc $(MNEXEC) $(MANPAGES) $(DOCDIRS)
+	rm -rf config.mk util/install.sh build dist *.egg-info *.pyc $(MNEXEC) $(MANPAGES) $(DOCDIRS)
 
 codecheck: $(PYSRC)
 	-echo "Running code check"
@@ -49,23 +49,27 @@ mnexec: mnexec.c $(MN) mininet/net.py
 install: $(MNEXEC) $(MANPAGES)
 	install $(MNEXEC) $(BINDIR)
 	install $(MANPAGES) $(MANDIR)
-	python setup.py install
+	$(PYTHON) setup.py install
 
+uninstall:
+	rm -rf $(BINDIR)/$(MNEXEC) $(BINDIR)/mn $(PKGDIR)/mininet-*.egg
+	printf $(MANDIR)'/%s\n' $(MANPAGES) | xargs rm
+
 develop: $(MNEXEC) $(MANPAGES)
 # 	Perhaps we should link these as well
 	install $(MNEXEC) $(BINDIR)
 	install $(MANPAGES) $(MANDIR)
-	python setup.py develop
+	$(PYTHON) setup.py develop
 
 man: $(MANPAGES)
 
-mn.1: $(MN)
-	PYTHONPATH=. help2man -N -n "create a Mininet network." \
-	--no-discard-stderr "$(PYMN)" -o $@
+mn.1:
+	help2man -N -n "create a Mininet network." \
+	--no-discard-stderr "$(PYTHON) $(MN)" -o $@
 
-mnexec.1: mnexec
+mnexec.1:
 	help2man -N -n "execution utility for Mininet." \
-	-h "-h" -v "-v" --no-discard-stderr ./$< -o $@
+	-h "-h" -v "-v" --no-discard-stderr ./$(MNEXEC) -o $@
 
 .PHONY: doc
 
