$NetBSD$

Adapt for NetBSD & pkgsrc.

--- Makefile.orig	2019-10-27 10:55:35.000000000 +0000
+++ Makefile
@@ -25,10 +25,17 @@
 ifeq ($(shell uname -s),Darwin)
 CONFIG_DARWIN=y
 endif
+ifeq ($(shell uname -s),NetBSD)
+CONFIG_NETBSD=y
+endif
 # Windows cross compilation from Linux
 #CONFIG_WIN32=y
 # use link time optimization (smaller and faster executables but slower build)
 CONFIG_LTO=y
+# Skip this for now, to support gcc5 without gcc-ar
+ifdef CONFIG_NETBSD
+CONFIG_LTO=
+endif
 # consider warnings as errors (for development)
 #CONFIG_WERROR=y
 # force 32 bit build for some utilities
@@ -165,8 +172,10 @@ QJSBN_OBJS=$(OBJDIR)/qjs.bn.o $(OBJDIR)/
 
 LIBS=-lm
 ifndef CONFIG_WIN32
+ifndef CONFIG_NETBSD
 LIBS+=-ldl
 endif
+endif
 
 $(OBJDIR):
 	mkdir -p $(OBJDIR) $(OBJDIR)/examples $(OBJDIR)/tests
