As iconv(3) is in NetBSD’s libc but the GNU version can be installed to /usr/pkg, searching
/usr/pkg/include before /usr/include (standard behaviour with -I) is not a good idea.
LDFLAGS += -lX11
LDFLAGS += -L/usr/local/lib -L/usr/pkg/lib
ifeq ($(UNAME),NetBSD)
-CFLAGS += -I/usr/pkg/include
-LDFLAGS += -liconv -Wl,-rpath,/usr/local/lib -Wl,-rpath,/usr/pkg/lib
+CFLAGS += -idirafter /usr/pkg/include
+LDFLAGS += -Wl,-rpath,/usr/local/lib -Wl,-rpath,/usr/pkg/lib
endif
ifeq ($(UNAME),Linux)