$NetBSD$

Don't use bundled libraries or override LDFLAGS.

--- Makefile.orig	2017-12-31 00:16:01.000000000 +0000
+++ Makefile
@@ -87,7 +87,6 @@ CPPONLYFLAGS = -fpermissive
 CPPONLYFLAGS += $(CORE_DEFINE)
 # LDFLAGS are used generally; LDFLAGSEMULATOR are additional
 # flags only used when linking the core emulator
-LDFLAGS =
 LDFLAGSEMULATOR =
 
 CCOMFLAGS  += -D__LIBRETRO__
@@ -100,21 +99,6 @@ endif
 $(info CFLAGS = $(CONLYFLAGS))
 $(info CPPFLAGS = $(CPPONLYFLAGS))
 
-# uncomment next line to build expat as part of MAME build
-BUILD_EXPAT = 1
-
-# uncomment next line to build zlib as part of MAME build
-ifneq ($(platform), android)
-   ifneq ($(platform), emscripten)
-      BUILD_ZLIB = 1
-   endif
-endif
-# uncomment next line to build libflac as part of MAME build
-BUILD_FLAC = 1
-
-# uncomment next line to build jpeglib as part of MAME build
-BUILD_JPEGLIB = 1
-
 # uncomment next line to build PortMidi as part of MAME/MESS build
 #BUILD_MIDILIB = 1
 VRENDER ?= soft
@@ -135,13 +119,13 @@ ifneq (,$(findstring unix,$(platform)))
    REALCC ?= gcc
    NATIVECC ?= g++
    NATIVECFLAGS ?= -std=gnu99
-   BASELIBS += -lpthread
+   BASELIBS += -pthread
    CXX ?= g++
    #workaround for mame bug (c++ in .c files)
    CC := $(CXX)
    AR ?= @ar
    LD := $(CXX)
-   LIBS += -lstdc++ -lpthread -ldl
+   LIBS += -pthread
    ifeq ($(firstword $(filter x86_64,$(UNAME))),x86_64)
       PTR64 = 1
    endif
@@ -764,7 +748,7 @@ endif
 
 ifneq (,$(findstring clang,$(CC)))
 ifneq ($(platform), android)
-LIBS += -lstdc++ -lpthread
+LIBS += -pthread
 endif
 endif
 #-------------------------------------------------
