# NetHack 3.7 linux.2020 $NHDT-Date: 1599593762 2020/09/08 19:36:02 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.10 $ # Copyright (c) Kenneth Lorber, Kensington, Maryland, 2007. # NetHack may be freely redistributed. See license for details. # #--------------------------------------------------------------------- # Linux hints file with support for multiple window ports (interfaces) # Tested on: # - Ubuntu focal # # If this doesn't work for your distribution, consider making a new # hints file for it, rather than changing this one. # And let us know about it. # #-PRE # linux.2020 hints file provides a single-user build for Linux (such # as Ubuntu focal). # compiler flags: various -I, -D, and -W get appended below; # these are the settings of most interest for an end-user build # (clang doesn't support '-Og', gcc needs 4.x or later) CFLAGS = -g #CFLAGS = -g -Og #CFLAGS = -O2 # note: '#-INCLUDE' is not just a comment; multiw-1 contains sections 1 to 3 #-INCLUDE multiw-1.2020 # 4. If you set WANT_WIN_QT, you need to # A) set QTDIR either here or in the environment to point to the Qt5 # Library installation root. # B) set XPMLIB to point to the Xpm library ifndef WANT_WIN_QT ifdef WANT_WIN_ALL WANT_WIN_QT=1 endif endif ifdef WANT_WIN_QT QTDIR=/usr endif # WANT_WIN_QT ifndef LIBXPM LIBXPM= -L/opt/X11/lib -lXpm endif #5. Other GAMEUID = $(USER) GAMEGRP = games #----------------------------------------------------------------------------- # You shouldn't need to change anything below here (in the hints file; if # you're reading this in Makefile augmented by hints, that may not be true). # #-INCLUDE multiw-2.2020 # MORECFLAGS is eventually appended to CFLAGS MORECFLAGS=-I../include -DNOTPARMDECL ifeq "$(CCISCLANG)" "" # get the version of gcc GCCGTEQ9 := $(shell expr `$(CC) -dumpversion | cut -f1 -d.` \>= 9) ifeq "$(GCCGTEQ9)" "1" MORECFLAGS+=-Wno-format-overflow endif #gcc version greater than or equal to 9 endif #not clang # As of LLVM build 2336.1.00, this gives dozens of spurious messages, so # leave it out by default. #MORECFLAGS+=-Wunreachable-code #MORECFLAGS+=-Wall -Wextra -Wno-missing-field-initializers -Wimplicit \ # -Wreturn-type -Wunused -Wformat -Wswitch -Wshadow -Wwrite-strings #MORECFLAGS+=-DGCC_WARN # NetHack sources control MORECFLAGS+=-DDLB MORECFLAGS+=-DHACKDIR=\"$(HACKDIR)\" MORECFLAGS+=-DDEFAULT_WINDOW_SYS=\"$(WANT_DEFAULT)\" MORECFLAGS+=-DSYSCF -DSYSCF_FILE=\"$(HACKDIR)/sysconf\" -DSECURE MORECFLAGS+=-DTIMED_DELAY MORECFLAGS+=-DDUMPLOG MORECFLAGS+=-DCONFIG_ERROR_SECURE=FALSE #MORECFLAGS+=-DGREPPATH=\"/usr/bin/grep\" MORECFLAGS+=-DCOMPRESS=\"/bin/gzip\" -DCOMPRESS_EXTENSION=\".gz\" #MORECFLAGS+=-DNOMAIL #MORECFLAGS+=-DEXTRA_SANITY_CHECKS #MORECFLAGS+=-DEDIT_GETLIN #MORECFLAGS+=-DSCORE_ON_BOTL #MORECFLAGS+=-DMSGHANDLER #MORECFLAGS+=-DTTY_TILES_ESCCODES #MORECFLAGS+=-DTTY_SOUND_ESCCODES MORECFLAGS+= $(WINCFLAGS) #WINCFLAGS set from multiw-2.2020 VARDATND = VARDATND0 = CURSESLIB = #ifdef WANT_WIN_CHAIN #HINTSRC=$(CHAINSRC) #HINTOBJ=$(CHAINOBJ) #endif # WANT_WIN_CHAIN ifdef WANT_WIN_TTY CURSESLIB = -lncurses -ltinfo endif ifdef WANT_WIN_CURSES CURSESLIB = -lncurses -ltinfo endif ifdef CURSESLIB WINLIB += $(CURSESLIB) endif ifdef WANT_WIN_X11 USE_XPM=1 WINX11LIB = -lXaw -lXmu -lXext -lXt -lX11 VARDATND0 += x11tiles NetHack.ad pet_mark.xbm pilemark.xbm # -x: if built without dlb, some versions of mkfontdir think *.lev are fonts POSTINSTALL += bdftopcf win/X11/nh10.bdf > $(HACKDIR)/nh10.pcf; ( cd $(HACKDIR); mkfontdir -x .lev ); # separate from CFLAGS so that we don't pass it to every file X11CFLAGS = -I/opt/X11/include # avoid repeated complaints about _X_NONNULL(args...) in X11CFLAGS += -Wno-variadic-macros ifdef USE_XPM MORECFLAGS += -DUSE_XPM WINX11LIB += -lXpm VARDATND0 += rip.xpm endif WINLIB += $(WINX11LIB) LFLAGS=-L/opt/X11/lib endif # WANT_WIN_X11 ifdef WANT_WIN_QT # Qt5 requires C++11 LINK = $(CXX) QTCXXFLAGS += -Wno-deprecated-declarations ifeq "$(CCISCLANG)" "" # get the version of g++ GPPGTEQ9 := $(shell expr `$(CXX) -dumpversion | cut -f1 -d.` \>= 9) ifeq "$(GPPGTEQ9)" "1" QTCXXFLAGS+= -Wno-format-truncation endif #g++ version greater than or equal to 9 endif #not clang QTCXXFLAGS += $(sort $(shell PKG_CONFIG_PATH=$(QTDIR)/lib/pkgconfig pkg-config Qt5Gui Qt5Widgets Qt5Multimedia --cflags)) QTCXXFLAGS += -fPIC WINLIB += $(shell PKG_CONFIG_PATH=$(QTDIR)/lib/pkgconfig pkg-config Qt5Gui Qt5Widgets Qt5Multimedia --libs) VARDATND0 += nhtiles.bmp rip.xpm nhsplash.xpm # XXX if /Developer/qt exists and QTDIR not set, use that ifndef QTDIR $(error QTDIR not defined in the environment or Makefile) endif # QTDIR # XXX make sure QTDIR points to something reasonable POSTINSTALL+= bdftopcf win/X11/nh10.bdf > $(INSTDIR)/nh10.pcf; \ ( cd $(INSTDIR); mkfontdir -x .lev ); else LINK = $(CC) endif # !WANT_WIN_QT # prevent duplicate tile.o in WINOBJ WINOBJ = $(sort $(WINOBJ0)) # prevent duplicates in VARDATND if both X11 and Qt are being supported VARDATND += $(sort $(VARDATND0)) # if CFLAGS=foo was specified on the command line, CFLAGS+=$(MORECFLAGS) # would be ignored without 'override'; we want to allow CFLAGS=-g vs -O # on the command line without having to specify all the other stuff # override CFLAGS+=$(MORECFLAGS) # #PREFIX=/usr PREFIX=$(wildcard ~)/nh/install HACKDIR=$(PREFIX)/games/lib/$(GAME)dir SHELLDIR = $(PREFIX)/games INSTDIR=$(HACKDIR) VARDIR = $(HACKDIR) POSTINSTALL+= cp -n sys/unix/sysconf $(INSTDIR)/sysconf; \ $(CHOWN) $(GAMEUID) $(INSTDIR)/sysconf; \ $(CHGRP) $(GAMEGRP) $(INSTDIR)/sysconf; \ chmod $(VARFILEPERM) $(INSTDIR)/sysconf; ifneq "$(CCISCLANG)" "" # gdb may not be installed if clang is chosen compiler so the game # won't start in that case due to a sysconf error. Comment out # relevant lines in sysconf. POSTINSTALL+= sed -i -e 's;^GDBPATH=/usr/bin/gdb;\#GDBPATH=/usr/bin/gdb;' \ -e 's;PANICTRACE_GDB=1;PANICTRACE_GDB=0;' $(INSTDIR)/sysconf; endif # when building liblua.a, avoid warning that use of tmpnam() should be # replaced by mkstemp(); the lua code doesn't use nethack's config.h so # this needs to be passed via make rather than defined in unixconf.h SYSCFLAGS=-DLUA_USE_POSIX # Only needed for GLIBC stack trace: LFLAGS=-rdynamic # if TTY_TILES_ESCCODES #WINSRC += tile.c #WINOBJ += tile.o # endif CHOWN=true CHGRP=true VARDIRPERM = 0755 VARFILEPERM = 0600 GAMEPERM = 0755