This evolves and hopefully eases the game-build requirements by
removing game-compile dependencies on any header files generated
by the makedefs utility, including:
date.h dependency and its inclusion is removed and comparable functionality
is produced at runtime via new file src/date.c.
pm.h dependency and its inclusion is removed and comparable functionality is
produced by moving the monster definitions from monst.c into new header
file called monsters.h and altering them slightly. The former pm.h header
file #define PM_ values are now replaced with appropriate emitted enum
entries during the compiler preprocessing.
onames.h dependency and its inclusion is removed and comparable functionality
is produced by moving the object definitions from objects.c into new header
file called objects.h and altering them slightly. The former onames.h header
file #define values are now replaced with appropriate emitted enum entries
during the compiler preprocessing.
artilist.h has been slightly altered, and the former onames.h artifact-related
header file #define ART_ values are now replaced with appropriate emitted enum
entries during the compiler preprocessing.
makedefs can still produce date.h (makedefs -v), pm.h (makedefs -p), and
onames.h (makedefs -o) for reference purposes. They won't be used during
the compiler.
The other uses for makedefs remain. They are used to prepare external
file content that the game utilizes, not prerequisite code for the
compile:
makedefs -d (database)
makedefs -r (rumors)
makedefs -h (oracles)
makedefs -s (epitaphs, engravings, bogusmons)
date.c
Pull the code for date/time stamping from mdlib.c into date.c.
Set date.o to be dependent on source files, header files, and .o files
so that date.o is rebuilt from date.c when any of those changes, thus
ensuring an accurate date/time stamp. It also includes git sha
functionality formerly done by makedefs writing #define directives
into include/date.h. For unix it passes the git info on
the compile line for date.c (via sys/unix/hints/linux.2020, macOS.2020)
nethack --dumpenums (optional, but on by default)
Allow developer to obtain some internal enum values from NetHack
without having to resort to an external utility such as
makedefs.
Uncomment #define NODUMPENUMS in config.h to disable this.
The updates to sys/windows/Makefile.gcc have not been tested yet.
222 lines
6.2 KiB
Plaintext
Executable File
222 lines
6.2 KiB
Plaintext
Executable File
# NetHack 3.7 linux.2020 $NHDT-Date: 1599687610 2020/09/09 21:40:10 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.11 $
|
|
# 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).
|
|
|
|
# note: '#-INCLUDE' is not just a comment
|
|
# multiw-1.2020 contains sections 1 to 2
|
|
#-INCLUDE multiw-1.2020
|
|
|
|
# 3. 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
|
|
|
|
#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.2020
|
|
|
|
# compiler.2020 contains compiler detection and adjustments common
|
|
# to both linux and macOS
|
|
|
|
#-INCLUDE compiler.2020
|
|
|
|
# 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
|
|
|
|
CFLAGS+= $(WINCFLAGS) #WINCFLAGS set from multiw-2.2020
|
|
CFLAGS+= $(NHCFLAGS)
|
|
|
|
CCXXFLAGS+= $(WINCFLAGS) #WINCFLAGS set from multiw-2.2020
|
|
CCXXFLAGS+= $(NHCFLAGS)
|
|
|
|
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 <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
|
|
# Qt5 requires C++11
|
|
LINK = $(CXX)
|
|
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))
|
|
|
|
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
|
|
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= libnhmain.o ioctl.o unixtty.o unixunix.o \
|
|
unixres.o winshim.o
|
|
#don't bother building the game executable as it will fail
|
|
#without winshim
|
|
override GAME=
|
|
MOREALL += ( cd src ; $(MAKE) pregame ; $(MAKE) 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
|
|
|
|
# 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
|
|
#
|
|
#-INCLUDE cross-pre.2020
|
|
#
|
|
#-POST
|
|
#
|
|
#-INCLUDE cross-post.2020
|
|
#
|
|
ifdef WANT_LIBNH
|
|
libnh.a: $(HOBJ) $(LIBNHSYSOBJ) ../lib/lua/liblua.a
|
|
$(AR) rcs $@ $(HOBJ) $(LIBNHSYSOBJ) ../lib/lua/liblua.a
|
|
@echo "$@ built."
|
|
libnhmain.o : ../sys/libnh/libnhmain.c $(HACK_H)
|
|
$(CC) $(CFLAGS) -c -o$@ $<
|
|
winshim.o : ../win/shim/winshim.c $(HACK_H)
|
|
$(CC) $(CFLAGS) -c -o$@ $<
|
|
endif # WANT_LIBNH
|
|
#
|