$OpenBSD: patch-Makefile,v 1.1 2016/01/29 20:12:04 abieber Exp $
--- Makefile.orig	Wed Dec 23 09:53:36 2015
+++ Makefile	Wed Jan 27 14:13:12 2016
@@ -59,7 +59,7 @@ config.gypi: configure
 		$(error No $@, please run ./configure first)
 	fi
 
-install: all
+install: all build-pledge
 	$(PYTHON) tools/install.py $@ '$(DESTDIR)' '$(PREFIX)'
 
 uninstall:
@@ -131,6 +131,12 @@ test/addons/.buildstamp: $(ADDONS_BINDING_GYPS) | test
 # Just goes to show that recursive make really is harmful...
 # TODO(bnoordhuis) Force rebuild after gyp or node-gyp update.
 build-addons: $(NODE_EXE) test/addons/.buildstamp
+
+build-pledge: $(NODE_EXE)
+	$(NODE) deps/npm/node_modules/node-gyp/bin/node-gyp rebuild \
+		--directory="deps/npm/node_modules/node-pledge" \
+		--nodedir="$(shell pwd)" && \
+	$(RM) -rf deps/npm/node_modules/node-pledge/build/Release/{.deps,../Makefile,obj.target}
 
 test-gc: all test/gc/node_modules/weak/build/Release/weakref.node
 	$(PYTHON) tools/test.py --mode=release gc
