$NetBSD: patch-sys_unix_Makefile.src,v 1.5 2023/09/02 13:45:14 rhialto Exp $

Make included UI types configurable.

--- sys/unix/Makefile.src.orig	2023-02-15 21:52:57.000000000 +0000
+++ sys/unix/Makefile.src
@@ -41,7 +41,11 @@ SHELL=/bin/sh
 # SHELL=E:/GEMINI2/MUPFEL.TTP
 
 # Usually, the C compiler driver is used for linking:
-#LINK=$(CC)
+.if "${QT_GRAPHICS}" != ""
+LINK=$(CXX)
+.else
+LINK=$(CC)
+.endif
 
 # Pick the SYSSRC and SYSOBJ lines corresponding to your desired operating
 # system.
@@ -169,10 +173,17 @@ GNOMEINC=-I/usr/lib/glib/include -I/usr/
 
 # flags for debugging:
 # CFLAGS = -g -I../include
+#CFLAGS += -ggdb
+#LFLAGS += -ggdb
 
-#CFLAGS = -O -I../include
+CFLAGS += -I../include
 #LFLAGS = 
 
+.if "${X11_GRAPHICS}" != "" || "${QT_GRAPHICS}" != ""
+CFLAGS += -I${X11BASE}/include
+LFLAGS += ${LDFLAGS}
+.endif
+
 # The Qt and Be window systems are written in C++, while the rest of
 # NetHack is standard C.  If using Qt, uncomment the LINK line here to get
 # the C++ libraries linked in.
@@ -267,13 +278,26 @@ WINBEOBJ =
 #WINBEOBJ = winbe.o NHWindow.o NHMenuWindow.o NHMapWindow.o tile.o
 #
 #
-#WINSRC = $(WINTTYSRC)
-#WINOBJ = $(WINTTYOBJ)
+WINSRC = $(WINTTYSRC)
+WINOBJ = $(WINTTYOBJ)
 #
 # Curses - Karl Garrison, Tangles
 #WINSRC = $(WINCURSESSRC)
 #WINOBJ = $(WINCURSESOBJ)
-#
+
+.if "${CURSES_GRAPHICS}" != ""
+WINSRC += $(WINCURSESSRC)
+WINOBJ += $(WINCURSESOBJ)
+.endif
+.if "${X11_GRAPHICS}" != ""
+WINSRC += $(WINX11SRC)
+WINOBJ += $(WINX11OBJ)
+.endif
+.if "${QT_GRAPHICS}" != ""
+WINSRC += $(WINQT4SRC)
+WINOBJ += $(WINQT4OBJ)
+.endif
+
 # on some systems the termcap library is in -ltermcap or -lcurses
 # on 386 Xenix, the -ltermlib tputs() seems not to work; use -lcurses instead
 # Sysatt uses shared library in lieu of this option
@@ -292,14 +316,14 @@ WINBEOBJ =
 #
 # libraries for X11
 # If USE_XPM is defined in config.h, you will also need -lXpm here.
-#WINX11LIB = -lXaw -lXmu -lXext -lXt -lX11
+WINX11LIB = -lXaw -lXmu -lXext -lXt -lX11 -lXpm
 # WINX11LIB = -lXaw -lXmu -lXt -lX11
 # WINX11LIB = -lXaw -lXmu -lXext -lXt -lXpm -lX11 -lm
 # WINX11LIB = -lXaw -lXmu -lXpm -lXext -lXt -lX11 -lSM -lICE -lm # BSD/OS 2.0
 #
 #
 # libraries for Qt 3
-WINQTLIB = -L$(QTDIR)/lib -lqt
+WINQTLIB = -L$(QTDIR)/lib -lqt-mt -lXpm -lX11 -lICE -lSM -lz -lpng -lXext ${PTHREAD_LDFLAGS} ${PTHREAD_LIBS}
 #
 # libraries for Qt 4
 WINQT4LIB = `pkg-config QtGui --libs`
@@ -321,17 +345,28 @@ WINBELIB = -lbe
 #
 # libraries for curses port
 # link with ncurses
-WINCURSESLIB = -lncurses
+#WINCURSESLIB = -lncurses	# Set from the pkg Makefile instead
 # link with pdcurses for SDL, installed in a separate directory
 #WINCURSESLIB = -L/usr/local/lib/pdcurses -lpdcurses -lSDL
 # same as above, for XCurses
 #WINCURSESLIB = -L/usr/local/lib/pdcurses -lXCurses -lXawM -lXmu -lXext -lXt -lX11
 #
-#WINLIB = $(WINTTYLIB)
+WINLIB = $(WINTTYLIB)
 #
 # For Curses
 #WINLIB = $(WINCURSESLIB)
 #
+
+.if "${CURSES_GRAPHICS}" != ""
+WINLIB += $(WINCURSESLIB)
+.endif
+.if "${X11_GRAPHICS}" != ""
+WINLIB += $(WINX11LIB)
+.endif
+.if "$(QT_GRAPHICS)" != ""
+WINLIB += $(WINQTLIB)
+.endif
+
 # any other strange libraries your system needs (for Sysunix only -- the more
 # specialized targets should already be right)
 #
