Move pieces of the Makefile hints sound-related changes that
are not macOS-specific from sys/unix/hints/macOS.370 to some new
include files. The WANT_MACSOUND block stays in
sys/unix/hints/macOS.370 because it is system-specific.
Before this change, the various Makefiles were assembled via
hints files macOS.370 or linux.370. Both were using included
portions from the following files in the sys/unix/hints/include
directory, in this sequence:
-INCLUDE multiw-1.370
-INCLUDE multiw-2.370
-INCLUDE compiler.370
-INCLUDE multiw-3.370
-INCLUDE cross-pre.370
-INCLUDE gbdates-pre.370
-INCLUDE gbdates-post.370
-INCLUDE cross-post.370
After this change, the various Makefiles will still be assembled
via hints files macOS.370 or linux.370. They will continue to use
included portions from the following files in the
sys/unix/hints/include directory, but with three additional
include files related to sound and soundlibs. This is the new
sequence:
-INCLUDE multiw-1.370
-INCLUDE multiw-2.370
-INCLUDE compiler.370
-INCLUDE multiw-3.370
+ -INCLUDE multisnd1-pre.370
-INCLUDE cross-pre.370
-INCLUDE gbdates-pre.370
+ -INCLUDE multisnd2-pre.370
-INCLUDE gbdates-post.370
+ -INCLUDE multisnd-post.370
-INCLUDE cross-post.370
The include mechanism continues to allow common portions that can
be shared between macOS and Linux to be maintained in a single
place only, with minimal duplication. Now, that has been extended
to include Makefile lines related to sounds and soundlib.
345 lines
9.6 KiB
Plaintext
Executable File
345 lines
9.6 KiB
Plaintext
Executable File
# NetHack 3.7 linux.370 $NHDT-Date: 1668359835 2022/11/13 17:17:15 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.50 $
|
|
# 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.370 hints file provides a single-user build for Linux (such
|
|
# as Ubuntu focal).
|
|
|
|
# note: '#-INCLUDE' is not just a comment
|
|
# multiw-1.370 contains sections 1 to 2
|
|
#-INCLUDE multiw-1.370
|
|
|
|
|
|
ifndef LIBXPM
|
|
LIBXPM= -L/opt/X11/lib -lXpm
|
|
endif
|
|
|
|
#4. 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.370
|
|
|
|
# compiler.370 contains compiler detection and adjustments common
|
|
# to both linux and macOS
|
|
|
|
#-INCLUDE compiler.370
|
|
|
|
ifdef WANT_WIN_QT
|
|
ifdef WANT_WIN_QT5
|
|
QTDIR=/usr
|
|
endif # WANT_WIN_QT5
|
|
ifdef WANT_WIN_QT6
|
|
#if your Qt6 is elsewhere, change this to match
|
|
QTDIR=/usr/local/qt6
|
|
endif # WANT_WIN_QT6
|
|
endif # WANT_WIN_QT
|
|
|
|
# multiw-3.370 must come after compiler.370
|
|
# and after QTDIR is defined.
|
|
#
|
|
#-INCLUDE multiw-3.370
|
|
|
|
ifeq "$(USE_CURSESLIB)" "1"
|
|
# default
|
|
CURSESLIB = -lncurses -ltinfo
|
|
# If CURSES_UNICODE is defined, we need ncursesw.
|
|
# Without CURSES_UNICODE the following simpler setting works.
|
|
# CURSESLIB = -lncurses -ltinfo
|
|
ifdef MAKEFILE_SRC
|
|
comma:=,
|
|
NCURSES_LFLAGS = $(shell pkg-config ncursesw --libs)
|
|
ifneq (,$(findstring ncursesw, $(NCURSES_LFLAGS)))
|
|
HAVE_NCURSESW=1
|
|
else
|
|
HAVE_NCURSESW=0
|
|
endif
|
|
#$(info $(NCURSES_LFLAGS))
|
|
#$(info HAVE_NCURSESW=$(HAVE_NCURSESW))
|
|
ifeq "$(HAVE_NCURSESW)" "1"
|
|
# remove unnecessary -Wl,-Bsymbolic-functions if present
|
|
ifneq (,$(findstring -Wl$(comma)-Bsymbolic-functions, $(NCURSES_LFLAGS)))
|
|
CURSESLIB = $(subst -Wl$(comma)-Bsymbolic-functions,,$(NCURSES_LFLAGS))
|
|
else
|
|
CURSESLIB = $(NCURSES_LFLAGS)
|
|
endif
|
|
#$(info $(CURSESLIB))
|
|
endif #HAVE_NCURSESW
|
|
endif #MAKEFILE_SRC
|
|
endif #USE_CURSESLIB
|
|
|
|
# NetHack sources control
|
|
NHCFLAGS+=-DDLB
|
|
NHCFLAGS+=-DHACKDIR=\"$(HACKDIR)\"
|
|
NHCFLAGS+=-DDEFAULT_WINDOW_SYS=\"$(WANT_DEFAULT)\"
|
|
NHCFLAGS+=-DSYSCF -DSYSCF_FILE=\"$(HACKDIR)/sysconf\" -DSECURE
|
|
NHCFLAGS+=-DTIMED_DELAY
|
|
NHCFLAGS+=-DDUMPLOG
|
|
NHCFLAGS+=-DCONFIG_ERROR_SECURE=FALSE
|
|
#NHCFLAGS+=-DGREPPATH=\"/usr/bin/grep\"
|
|
NHCFLAGS+=-DCOMPRESS=\"/bin/gzip\" -DCOMPRESS_EXTENSION=\".gz\"
|
|
#NHCFLAGS+=-DNOMAIL
|
|
#NHCFLAGS+=-DEXTRA_SANITY_CHECKS
|
|
#NHCFLAGS+=-DEDIT_GETLIN
|
|
#NHCFLAGS+=-DSCORE_ON_BOTL
|
|
#NHCFLAGS+=-DMSGHANDLER
|
|
#NHCFLAGS+=-DTTY_TILES_ESCCODES
|
|
#NHCFLAGS+=-DTTY_SOUND_ESCCODES
|
|
#NHCFLAGS+=-DNO_CHRONICLE
|
|
#NHCFLAGS+=-DLIVELOG
|
|
ifdef WANT_WIN_CURSES
|
|
ifeq "$(HAVE_NCURSESW)" "1"
|
|
NHCFLAGS+=-DCURSES_UNICODE
|
|
else
|
|
ifdef MAKEFILE_SRC
|
|
$(info Attention: CURSES_UNICODE is not being defined without ncursesw)
|
|
endif #MAKEFILE_SRC
|
|
endif #HAVE_NCURSESW
|
|
endif #WANT_WIN_CURSES
|
|
|
|
#
|
|
#-INCLUDE multisnd1-pre.370
|
|
#
|
|
|
|
# WINCFLAGS set from multiw-2.370
|
|
# SNDCFLAGS set from multisnd-pre.370
|
|
CFLAGS+= $(WINCFLAGS)
|
|
CFLAGS+= $(SNDCFLAGS)
|
|
CFLAGS+= $(NHCFLAGS)
|
|
|
|
# WINCFLAGS set from multiw-2.370
|
|
# SNDCFLAGS set from multisnd-pre.370
|
|
CCXXFLAGS+= $(WINCFLAGS)
|
|
CCXXFLAGS+= $(SNDCFLAGS)
|
|
CCXXFLAGS+= $(NHCFLAGS)
|
|
|
|
VARDATND =
|
|
VARDATND0 =
|
|
|
|
#ifdef WANT_WIN_CHAIN
|
|
#HINTSRC=$(CHAINSRC)
|
|
#HINTOBJ=$(CHAINOBJ)
|
|
#endif # WANT_WIN_CHAIN
|
|
|
|
ifdef MAKEFILE_SRC
|
|
ifdef CURSESLIB
|
|
WINLIB += $(CURSESLIB)
|
|
endif #CURSESLIB
|
|
endif #MAKEFILE_SRC
|
|
|
|
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 <X11/Xfuncproto.h>
|
|
X11CFLAGS += -Wno-variadic-macros
|
|
ifdef USE_XPM
|
|
CFLAGS += -DUSE_XPM
|
|
WINX11LIB += -lXpm
|
|
VARDATND0 += rip.xpm
|
|
endif
|
|
WINLIB += $(WINX11LIB)
|
|
LFLAGS=-L/opt/X11/lib
|
|
endif # WANT_WIN_X11
|
|
|
|
ifdef WANT_WIN_QT
|
|
LINK = $(CXX)
|
|
ifdef WANT_WIN_QT4
|
|
QTCXXFLAGS += $(sort $(shell PKG_CONFIG_PATH=$(QTDIR)/lib/pkgconfig pkg-config QtGui --cflags)) -DQT_NO_SOUND=1
|
|
WINLIB += $(shell PKG_CONFIG_PATH=$(QTDIR)/lib/pkgconfig pkg-config QtGui --libs)
|
|
endif # WANT_WIN_QT4
|
|
ifdef WANT_WIN_QT5
|
|
QTCXXFLAGS += $(sort $(shell PKG_CONFIG_PATH=$(QTDIR)/lib/pkgconfig pkg-config Qt5Gui Qt5Widgets Qt5Multimedia --cflags))
|
|
WINLIB += $(shell PKG_CONFIG_PATH=$(QTDIR)/lib/pkgconfig pkg-config Qt5Gui Qt5Widgets Qt5Multimedia --libs)
|
|
endif # WANT_WIN_QT5
|
|
ifdef WANT_WIN_QT6
|
|
# Try some likely spots for a self-built Qt6.
|
|
# You'll have to change these manually before using the hints file
|
|
# if they don't match the installed location on your system.
|
|
ifneq "$(HOSTTYPE)" ""
|
|
QTHOST=$(HOSTTYPE)
|
|
else
|
|
QTHOST=x86_64
|
|
endif
|
|
QTTOP=/usr/include/$(HOSTTYPE)-linux-gnu/qt6
|
|
ifneq ($(wildcard $(QTTOP)/*),)
|
|
#we don't set QTLOCATED=1 for this
|
|
QTINCDIR=/usr/include/$(QTHOST)-linux-gnu/qt6
|
|
QTLIBDIR=/usr/lib/$(QTHOST)-linux.gnu
|
|
QTCXXFLAGS += -DQT_WIDGETS_LIB -DQT_MULTIMEDIA_LIB -DQT_NETWORK_LIB -DQT_GUI_LIB -DQT_CORE_LIB
|
|
QTCXXFLAGS += -I$(QTINCDIR)/QtWidgets -I$(QTINCDIR) -I$(QTINCDIR)/QtMultimedia
|
|
QTCXXFLAGS += -I$(QTINCDIR)/QtNetwork -I$(QTINCDIR)/QtGui -I$(QTINCDIR)/QtCore
|
|
WINLIB += -L$(QTLIBDIR) -lQt6Widgets -lQt6Multimedia -lQt6Network -lQt6Gui -lQt6Core
|
|
MOCPATH = /usr/lib/qt6/libexec/moc
|
|
#/usr/lib/x86_64-linux-gnu/libQt6EglFSDeviceIntegration.so
|
|
endif
|
|
ifndef QTINCDIR
|
|
ifneq ($(wildcard /usr/local/Qt6/*),)
|
|
QTDIR=/usr/local/Qt6
|
|
QTLOCATED=1
|
|
endif # wildcard /usr/local/Qt6
|
|
ifneq ($(wildcard /usr/local/qt6/*),)
|
|
QTDIR=/usr/local/qt6
|
|
QTLOCATED=1
|
|
endif # wildcard /usr/local/qt6
|
|
endif # !QTINCDIR
|
|
ifdef QTLOCATED
|
|
QTCXXFLAGS += -I$(QTDIR)/include/QtCore
|
|
QTCXXFLAGS += -I$(QTDIR)/include/QtGui
|
|
QTCXXFLAGS += -I$(QTDIR)/include/QtMultimedia
|
|
QTCXXFLAGS += -I$(QTDIR)/include/QtWidgets
|
|
MOCPATH = $(QTDIR)/libexec/moc
|
|
WINLIB += -L$(QTDIR)/lib -lQt6Widgets -lQt6Multimedia -lQt6Network -lQt6Gui -lQt6Core
|
|
endif # QTLOCATED
|
|
endif # !QTINCDIR
|
|
ifndef QTDIR
|
|
$(error QTDIR not defined in the environment or Makefile)
|
|
endif # QTDIR
|
|
# XXX if /Developer/qt exists and QTDIR not set, use that
|
|
# XXX make sure QTDIR points to something reasonable
|
|
QTCXXFLAGS += -fPIC
|
|
POSTINSTALL+= bdftopcf win/X11/nh10.bdf > $(INSTDIR)/nh10.pcf; \
|
|
( cd $(INSTDIR); mkfontdir -x .lev );
|
|
VARDATND0 += nhtiles.bmp rip.xpm nhsplash.xpm
|
|
else # WANT_WIN_QT
|
|
LINK = $(CC)
|
|
endif # !WANT_WIN_QT
|
|
|
|
# prevent duplicate tile.o in WINOBJ
|
|
WINOBJ = $(WINOBJ0) $(sort $(XTRAOBJ))
|
|
# prevent duplicates in VARDATND if both X11 and Qt are being supported
|
|
VARDATND += $(sort $(VARDATND0))
|
|
|
|
GIT_HASH := $(shell echo `git rev-parse --verify HEAD` 2>&1)
|
|
GIT_BRANCH := $(shell echo `git rev-parse --abbrev-ref HEAD` 2>&1)
|
|
|
|
ifdef GIT_HASH
|
|
GITHASH = -DNETHACK_GIT_SHA=\"$(GIT_HASH)\"
|
|
endif
|
|
ifdef GIT_BRANCH
|
|
GITBRANCH = -DNETHACK_GIT_BRANCH=\"$(GIT_BRANCH)\"
|
|
endif
|
|
|
|
ifdef WANT_LIBNH
|
|
CFLAGS += -DSHIM_GRAPHICS -DNOTTYGRAPHICS -DNOSHELL -DLIBNH -fpic
|
|
LIBNHSYSSRC = ../sys/libnh/libnhmain.c \
|
|
../sys/share/ioctl.c ../sys/share/unixtty.c \
|
|
../sys/unix/unixunix.c ../sys/unix/unixres.c \
|
|
../win/shim/winshim.c
|
|
LIBNHSYSOBJ = $(TARGETPFX)libnhmain.o $(TARGETPFX)ioctl.o \
|
|
$(TARGETPFX)unixtty.o $(TARGETPFX)unixunix.o \
|
|
$(TARGETPFX)unixres.o $(TARGETPFX)winshim.o \
|
|
$(TARGETPFX)date.o
|
|
#don't bother building the game executable as it will fail
|
|
#without winshim
|
|
override GAME=
|
|
MOREALL += ( cd src ; $(MAKE) pregame ; $(MAKE) $(TARGETPFX)libnh.a )
|
|
endif # WANT_LIBNH
|
|
|
|
#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
|
|
|
|
# Lua
|
|
# 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_LINUX
|
|
ifdef GITSUBMODULES
|
|
LUAFLAGS=CC='$(CC)' SYSCFLAGS='$(SYSCFLAGS)'
|
|
ifneq "$(CCISCLANG)" ""
|
|
# clang
|
|
LUAFLAGS +=CWARNGCC=''
|
|
endif # clang
|
|
override LUAHEADERS = submodules/lua
|
|
override LUA2NHTOP = ../..
|
|
override LUAMAKEFLAGS=$(LUAFLAGS)
|
|
endif # GITSUBMODULES
|
|
DLLIB = -ldl
|
|
|
|
# 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
|
|
#
|
|
#-INCLUDE cross-pre.370
|
|
#
|
|
|
|
#
|
|
#-INCLUDE gbdates-pre.370
|
|
#
|
|
|
|
#
|
|
#-INCLUDE multisnd2-pre.370
|
|
#
|
|
|
|
#-POST
|
|
|
|
#
|
|
#-INCLUDE gbdates-post.370
|
|
#
|
|
#
|
|
#-INCLUDE multisnd-post.370
|
|
#
|
|
|
|
ifdef WANT_LIBNH
|
|
$(TARGETPFX)libnh.a: $(HOBJ) $(LIBNHSYSOBJ) ../lib/lua/liblua.a
|
|
$(AR) rcs $@ $(HOBJ) $(LIBNHSYSOBJ) ../lib/lua/liblua.a
|
|
@echo "$@ built."
|
|
$(TARGETPFX)libnhmain.o : ../sys/libnh/libnhmain.c $(HACK_H)
|
|
$(CC) $(CFLAGS) -c -o$@ $<
|
|
$(TARGETPFX)winshim.o : ../win/shim/winshim.c $(HACK_H)
|
|
$(CC) $(CFLAGS) -c -o$@ $<
|
|
endif # WANT_LIBNH
|
|
|
|
#
|
|
#-INCLUDE cross-post.370
|
|
#
|
|
|