Files
nethack/sys/unix
nhmall 29951cccd1 add support for optional builder-created make.prefs
Set things up so that the Makefile build will look for 'make.prefs'
at the top of the NetHack source tree.

If 'make.prefs' is present, the Makefile build will include it
just ahead of the PRE section of a hints file specified to
sys/unix/setup.sh, or practically the first thing during a
Makefile build if no hints file was specified.

The advantage of using a 'make.prefs' is that instead of putting a
series of Makefile variable value assignments on the command line
each time, like this:
    make WANT_WIN_X11=1 WANT_WIN_TTY=1 WANT_WIN_CURSES=1 c2x=1 resp=1 update
you can, instead, put those preferences into make.prefs, like this:

# start of make.prefs
WANT_WIN_X11=1
WANT_WIN_TTY=1
WANT_WIN_CURSES=1
c2x=1
resp=1
# end of make.prefs

Now, my make command just needs to specify a target:
    make update

The syntax for checking whether make.prefs exists, and for including
it, is GNU make, or bsd make, specific, so sys/unix/mkmkfile.sh will
insert the correct syntax for the make that is in-use when
sys/unix/setup.sh is executed.

The 'make.prefs' file isn't limited to Makefile variable assignments, and
can contain any valid make syntax for the version of make on your system,
but adding make syntax beyond Makefile variable assignment will cause
your make.prefs file to become specific to that version of make. There
are syntactical differences between GNU make and bsd make, particularly
for directives and conditional tests.

The 'make.prefs' file can potentially eliminate much/all of the manual
editing of distributed repository Makefiles or hints files that you, as
a NetHack developer or builder, might routinely carry out.
You have the option of placing your preference changes in 'make.prefs'
instead.

Related reference for .500 hints file variables:

In the NetHack source tree:
sys/unix/README.hints

On GitHub:
https://github.com/NetHack/NetHack/blob/NetHack-5.0/sys/unix/README-hints

For example, on macOS, where GNU make is being used, and I typically
set things up using the macOS.500 hints file:
    sys/unix/setup.sh sys/unix/hints/macOS.500
I might have the following make.prefs in the root of my NetHack source tree:
#---- snip -------
$(info Attention - Using make.prefs)
WANT_MACSOUND=1
resp=1
#---- end-snip ---

For another example, on Linux, where GNU make is being used, and I
typically set things up using the linux.500 hints file:
    sys/unix/setup.sh sys/unix/hints/linux.500
I might have the following make.prefs file in the root of my NetHack
source tree:
#---- snip -------
$(info Using make.prefs)
WANT_WIN_X11=1
WANT_WIN_TTY=1
WANT_WIN_CURSES=1
c2x=1
resp=1
#---- end-snip ---
2026-05-18 13:03:31 -04:00
..
2026-04-30 01:13:40 -04:00
2026-04-26 10:41:11 -04:00
2026-04-26 10:41:11 -04:00
2026-04-26 10:41:11 -04:00
2026-04-30 09:27:50 -04:00
2026-04-26 10:41:11 -04:00
2026-04-26 10:41:11 -04:00
2026-04-26 10:41:11 -04:00
2026-04-26 10:41:11 -04:00
2026-04-26 10:41:11 -04:00
2026-04-26 18:01:10 -04:00
2026-05-05 06:57:32 -04:00
2026-04-26 10:41:11 -04:00
2024-02-28 20:15:56 -08:00

This README provides the instructions for building the unofficial Mac
binaries using the Apple provided developer IDE named XCode.

Establish a developer team in XCode
===================================

Your first step should be to establish a developer team within XCode.
Launch XCode and open the preferences dialog (XCode Menu->Preferences).
Select the "Accounts" tab.  Add an account (usually this should just be
your apple ID account you used to setup the Mac).  After adding the account,
select the account and then add a team (usually this will be just a
personal team for Mac Development).

Obtain your developer team identifier
=====================================

Your DEVELOPMENT_TEAM can be found by opening Keychain Access
(found by Finder->Applications->Utilities).  Click on "My Certificates".
Look for your "Mac Developer" certificate.  Right click on
the certificate to open a dialog that shows certificate details.
Look for "Organizational Unit" among the details.  This ten digit value
is your development team identifier.

Create XCodeLocal.xcconfig file
===============================

Now you need to create the XCodeLocal.xcconfig file that will be used by
XCode to get your development team identifier.  Create the file in
sys/unix and add a single line such as:
DEVELOPMENT_TEAM = XXXXXXXXXX

Where XXXXXXXXXX is replaced with your development team identifier.

Open the project and build
==========================

In XCode open the project file sys/unix/NetHack.xcodeproj, select
the product NetHack and build.  The build results are placed in
~/nethackdir.