$NetBSD$

Treat non-Cygwin platforms similarly.
Use dl library only on Linux.

--- Makefile.orig	2015-12-29 21:26:38.000000000 +0000
+++ Makefile
@@ -18,7 +18,24 @@ ifeq ($(FILTER_AUDIO), 1)
 	CFLAGS += -DAUDIO_FILTERING
 endif
 
-ifeq ($(UNAME_S), Linux)
+ifeq ($(UNAME_O), Cygwin)
+	OUT_FILE = utox.exe
+
+	CFLAGS  += -static
+	LDFLAGS += /usr/x86_64-w64-mingw32/sys-root/mingw/lib/libwinpthread.a
+
+	CFLAGS  += $(shell x86_64-w64-mingw32-pkg-config --cflags $(DEPS))
+	LDFLAGS += $(shell x86_64-w64-mingw32-pkg-config --libs   $(DEPS))
+
+	LDFLAGS += -liphlpapi -lws2_32 -lgdi32 -lmsimg32 -ldnsapi -lcomdlg32
+	LDFLAGS += -Wl,-subsystem,windows -lwinmm -lole32 -loleaut32 -lstrmiids
+
+	OS_SRC = $(wildcard src/windows/*.c)
+	OS_OBJ = $(OS_SRC:.c=.o)
+
+	TRAY_OBJ = icons/icon.o
+	TRAY_GEN = x86_64-w64-mingw32-windres icons/icon.rc -O coff -o
+else
 	OUT_FILE = utox
 
 	DEPS += fontconfig freetype2 x11 xext xrender
@@ -41,8 +58,10 @@ ifeq ($(UNAME_S), Linux)
 	endif
 
 	CFLAGS += $(shell pkg-config --cflags $(DEPS))
-
-	LDFLAGS += -lresolv -ldl
+	LDFLAGS += -lresolv
+	ifeq ($(UNAME_S), Linux)
+		LDFLAGS += -ldl
+	endif
 	LDFLAGS += $(shell pkg-config --libs $(DEPS))
 
 	OS_SRC = $(wildcard src/xlib/*.c)
@@ -50,23 +69,6 @@ ifeq ($(UNAME_S), Linux)
 
 	TRAY_OBJ = icons/utox-128x128.o
 	TRAY_GEN = $(LD) -r -b binary icons/utox-128x128.png -o
-else ifeq ($(UNAME_O), Cygwin)
-	OUT_FILE = utox.exe
-
-	CFLAGS  += -static
-	LDFLAGS += /usr/x86_64-w64-mingw32/sys-root/mingw/lib/libwinpthread.a
-
-	CFLAGS  += $(shell x86_64-w64-mingw32-pkg-config --cflags $(DEPS))
-	LDFLAGS += $(shell x86_64-w64-mingw32-pkg-config --libs   $(DEPS))
-
-	LDFLAGS += -liphlpapi -lws2_32 -lgdi32 -lmsimg32 -ldnsapi -lcomdlg32
-	LDFLAGS += -Wl,-subsystem,windows -lwinmm -lole32 -loleaut32 -lstrmiids
-
-	OS_SRC = $(wildcard src/windows/*.c)
-	OS_OBJ = $(OS_SRC:.c=.o)
-
-	TRAY_OBJ = icons/icon.o
-	TRAY_GEN = x86_64-w64-mingw32-windres icons/icon.rc -O coff -o
 endif
 
 
@@ -123,8 +125,8 @@ install: utox
 	install -m 644 src/utox.desktop $(DESTDIR)$(PREFIX)/share/applications/utox.desktop
 	if [ "$(UNITY)" -eq "1" ]; then echo "X-MessagingMenu-UsesChatSection=true" >> $(DESTDIR)$(PREFIX)/share/applications/utox.desktop; fi
 
-	mkdir -p $(DESTDIR)$(PREFIX)/share/man/man1
-	install -m 644 src/utox.1 $(DESTDIR)$(PREFIX)/share/man/man1/utox.1
+	mkdir -p $(DESTDIR)$(PREFIX)/man/man1
+	install -m 644 src/utox.1 $(DESTDIR)$(PREFIX)/man/man1/utox.1
 
 $(OBJ): %.o: %.c $(HEADERS)
 	@echo "  CC    $@"
