compile NetHack-3.7 without makedefs-generated .h files

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.
This commit is contained in:
nhmall
2021-08-17 14:43:29 -04:00
parent 61b6bab292
commit 9bb96322a8
50 changed files with 5745 additions and 4936 deletions

View File

@@ -124,13 +124,10 @@ steps to be carried out:
1. Compile and link util/makedefs.
2. Run makedefs repeatedly with different command line options to produce
several output files that are required for:
(a) additional build steps to follow, including some header
files: pm.h, onames.h, date.h.
(b) creation of files, containing information required by,
or about the game during its execution, that are stored in a
portable, platform-independent way, that need to be inserted
into the game package.
several required output files that contain information required by the
game, or contain information about the game during its execution, that
are stored in a portable, platform-independent way, that need to be
inserted into the game package (makedefs -d, -z, -r, -h, -s).
3. Compile and link several less critical utilities such as uudecode,
tile-generation utilities, and so forth, all of which need to execute
on the build platform during the build process to produce output files
@@ -261,14 +258,18 @@ On the HOST, here are the mandatory things that have to be built.
from sources: util/makedefs.c, src/mdlib.c, src/monst.c, src/objects.c
b) Execute HOST native makedefs utility, util/makedefs, as follows:
util/makedefs -v
util/makedefs -o
util/makedefs -p
util/makedefs -z
util/makedefs -d
util/makedefs -r
util/makedefs -h
util/makedefs -s
Required for complete packaging of the game, but not the C source
game compile:
util/makedefs -d
util/makedefs -r
util/makedefs -h
util/makedefs -s
For reference purposes, but no longer a required prerequisite for the
game compile process:
util/makedefs -v
util/makedefs -o
util/makedefs -p
c) Using the HOST native compiler, build these additional utilities if your
target platform requires components that they produce. It is important

23
Porting
View File

@@ -182,20 +182,23 @@ NetHack requires the following steps to be carried out:
Compile and link util/makedefs. Run makedefs repeatedly with different command
line options to produce several output files that are required for:
(a) additional build steps to follow, including some header
files: pm.h, onames.h, date.h.
(b) creation of files, containing information required by,
(a) creation of files, containing information required by,
or about the game during its execution, that are stored in a
portable, platform-independent way, that need to be inserted
into the final game package.
util/makedefs -v
util/makedefs -o
util/makedefs -p
util/makedefs -d
util/makedefs -r
util/makedefs -h
util/makedefs -s
Required for complete packaging of the game, but not the C source
game compile:
util/makedefs -d
util/makedefs -r
util/makedefs -h
util/makedefs -s
For reference purposes, but no longer a required prerequisite for the
game compile process:
util/makedefs -v
util/makedefs -o
util/makedefs -p
4.2. Other utilities

View File

@@ -1269,3 +1269,17 @@ adjust window port interface to pass a pointer to a glyph_info struct which
and the symset index; this affects two window port calls that get
passed glyphs: print_glyph() and add_menu().
switch from k&r C to C99
remove the game-compile dependencies on any pre-generated header files
date.h dependency and inclusion is removed and comparable functionality is
produced at runtime; REPRODUCIBLE_BUILD capability will need to be
reviewed and adjusted
pm.h dependency and inclusion is removed and comparable functionality is
produced by moving the monster definitions from monst.c into new header
file called monsters.h, then taking advantage of the C preprocessor to
generate appropriate enum values during compile
onames.h dependency and inclusion is removed and comparable functionality is
produced by moving the object definitions from objects.c into new header
file called objects.h, then taking advantage of the C preprocessor to
generate appropriate enum values during compile
artilist.h is used to generate appropriate artifact enum values by the C
preprocessor during compile

View File

@@ -1018,13 +1018,15 @@ in the future to make it possible to replace this on a per window-port basis.
VII. Conventions
init_nhwindows() is expected to display a gee-whiz banner window, including
the Copyright message. It is recommended that the COPYRIGHT_BANNER_A,
COPYRIGHT_BANNER_B, COPYRIGHT_BANNER_C, and COPYRIGHT_BANNER_D macros from
patchlevel.h and date.h be used for constructing the Copyright message.
the Copyright message. It is recommended that the COPYRIGHT_BANNER_A macro
from patchlevel.h, COPYRIGHT_BANNER_B from patchlevel.h,
nomakedefs.copyright_banner_c internal global variable, and
COPYRIGHT_BANNER_D macros from patchlevel.h be used for constructing the
Copyright message.
COPYRIGHT_BANNER_A is a quoted string that has NetHack copyright declaration,
COPYRIGHT_BANNER_B is a quoted string that states who the copyright belongs to,
COPYRIGHT_BANNER_C is a quoted string generated by makedefs that includes
version and build information, and
nomakedefs.copyright_banner_c is a quoted string produced at runtime that
includes version and build information, and
COPYRIGHT_BANNER_D simply says "See License for details."
Be sure to #include "patchlevel.h" and date.h to define these macros. Using
the macros will prevent having to update the Copyright information in each

View File

@@ -1,5 +1,5 @@
* NH_filestag=(file%s_for_all_versions)
..files NH_filegenerated=win32api.h,tile.h,dgn_comp.h,lev_comp.h,date.h,onames.h,pm.h
..files NH_filegenerated=win32api.h,tile.h,date.h
win32api.h NH_filesgentag=(file%s_for_win32_that_are_moved_into_include_at_compile_time)
@@ -9,8 +9,6 @@ dgn_comp.h NH_filesgentag=(file%s_generated_by_yacc_(or_copied_from_sys/share)_a
lev_comp.h NH_filesgentag=>dgn_comp.h
date.h NH_filesgentag=(file%s_generated_by_makedefs_at_compile_time)
onames.h NH_filesgentag=>date.h
pm.h NH_filesgentag=>date.h
wintty.h NH_filestag=(file%s_for_tty_versions)

View File

@@ -6,15 +6,23 @@
#if defined(MAKEDEFS_C) || defined (MDLIB_C)
/* in makedefs.c, all we care about is the list of names */
#define A(nam, typ, s1, s2, mt, atk, dfn, cry, inv, al, cl, rac, cost, clr) nam
#define A(nam, typ, s1, s2, mt, atk, dfn, cry, inv, al, cl, rac, \
cost, clr, bn) nam
static const char *artifact_names[] = {
#elif defined(ARTI_ENUM)
#define A(nam, typ, s1, s2, mt, atk, dfn, cry, inv, al, cl, rac, \
cost, clr, bn) \
ART_##bn
#else
/* in artifact.c, set up the actual artifact list structure */
#define A(nam, typ, s1, s2, mt, atk, dfn, cry, inv, al, cl, rac, cost, clr) \
{ \
typ, nam, s1, s2, mt, atk, dfn, cry, inv, al, cl, rac, cost, clr \
#define A(nam, typ, s1, s2, mt, atk, dfn, cry, inv, al, cl, rac, \
cost, clr, bn) \
{ \
typ, nam, s1, s2, mt, atk, dfn, cry, inv, al, cl, rac, \
cost, clr \
}
/* clang-format off */
@@ -42,12 +50,12 @@ static NEARDATA struct artifact artilist[] = {
/* dummy element #0, so that all interesting indices are non-zero */
A("", STRANGE_OBJECT, 0, 0, 0, NO_ATTK, NO_DFNS, NO_CARY, 0, A_NONE,
NON_PM, NON_PM, 0L, NO_COLOR),
NON_PM, NON_PM, 0L, NO_COLOR, PLACEHOLDER),
A("Excalibur", LONG_SWORD, (SPFX_NOGEN | SPFX_RESTR | SPFX_SEEK
| SPFX_DEFN | SPFX_INTEL | SPFX_SEARCH),
0, 0, PHYS(5, 10), DRLI(0, 0), NO_CARY, 0, A_LAWFUL, PM_KNIGHT, NON_PM,
4000L, NO_COLOR),
4000L, NO_COLOR, EXCALIBUR),
/*
* Stormbringer only has a 2 because it can drain a level,
* providing 8 more.
@@ -55,7 +63,7 @@ static NEARDATA struct artifact artilist[] = {
A("Stormbringer", RUNESWORD,
(SPFX_RESTR | SPFX_ATTK | SPFX_DEFN | SPFX_INTEL | SPFX_DRLI), 0, 0,
DRLI(5, 2), DRLI(0, 0), NO_CARY, 0, A_CHAOTIC, NON_PM, NON_PM, 8000L,
NO_COLOR),
NO_COLOR, STORMBRINGER),
/*
* Mjollnir can be thrown when wielded if hero has 25 Strength
* (usually via gauntlets of power but possible with rings of
@@ -70,10 +78,10 @@ static NEARDATA struct artifact artilist[] = {
*/
A("Mjollnir", WAR_HAMMER, /* Mjo:llnir */
(SPFX_RESTR | SPFX_ATTK), 0, 0, ELEC(5, 24), NO_DFNS, NO_CARY, 0,
A_NEUTRAL, PM_VALKYRIE, NON_PM, 4000L, NO_COLOR),
A_NEUTRAL, PM_VALKYRIE, NON_PM, 4000L, NO_COLOR, MJOLLNIR),
A("Cleaver", BATTLE_AXE, SPFX_RESTR, 0, 0, PHYS(3, 6), NO_DFNS, NO_CARY,
0, A_NEUTRAL, PM_BARBARIAN, NON_PM, 1500L, NO_COLOR),
0, A_NEUTRAL, PM_BARBARIAN, NON_PM, 1500L, NO_COLOR, CLEAVER),
/*
* Grimtooth glows in warning when elves are present, but its
@@ -82,7 +90,7 @@ static NEARDATA struct artifact artilist[] = {
*/
A("Grimtooth", ORCISH_DAGGER, (SPFX_RESTR | SPFX_WARN | SPFX_DFLAG2),
0, M2_ELF, PHYS(2, 6), NO_DFNS,
NO_CARY, 0, A_CHAOTIC, NON_PM, PM_ORC, 300L, CLR_RED),
NO_CARY, 0, A_CHAOTIC, NON_PM, PM_ORC, 300L, CLR_RED, GRIMTOOTH),
/*
* Orcrist and Sting have same alignment as elves.
*
@@ -92,54 +100,55 @@ static NEARDATA struct artifact artilist[] = {
*/
A("Orcrist", ELVEN_BROADSWORD, (SPFX_WARN | SPFX_DFLAG2), 0, M2_ORC,
PHYS(5, 0), NO_DFNS, NO_CARY, 0, A_CHAOTIC, NON_PM, PM_ELF, 2000L,
CLR_BRIGHT_BLUE), /* bright blue is actually light blue */
CLR_BRIGHT_BLUE, ORCRIST), /* bright blue is actually light blue */
A("Sting", ELVEN_DAGGER, (SPFX_WARN | SPFX_DFLAG2), 0, M2_ORC, PHYS(5, 0),
NO_DFNS, NO_CARY, 0, A_CHAOTIC, NON_PM, PM_ELF, 800L, CLR_BRIGHT_BLUE),
NO_DFNS, NO_CARY, 0, A_CHAOTIC, NON_PM, PM_ELF, 800L, CLR_BRIGHT_BLUE,
STING),
/*
* Magicbane is a bit different! Its magic fanfare
* unbalances victims in addition to doing some damage.
*/
A("Magicbane", ATHAME, (SPFX_RESTR | SPFX_ATTK | SPFX_DEFN), 0, 0,
STUN(3, 4), DFNS(AD_MAGM), NO_CARY, 0, A_NEUTRAL, PM_WIZARD, NON_PM,
3500L, NO_COLOR),
3500L, NO_COLOR, MAGICBANE),
A("Frost Brand", LONG_SWORD, (SPFX_RESTR | SPFX_ATTK | SPFX_DEFN), 0, 0,
COLD(5, 0), COLD(0, 0), NO_CARY, 0, A_NONE, NON_PM, NON_PM, 3000L,
NO_COLOR),
NO_COLOR, FROST_BRAND),
A("Fire Brand", LONG_SWORD, (SPFX_RESTR | SPFX_ATTK | SPFX_DEFN), 0, 0,
FIRE(5, 0), FIRE(0, 0), NO_CARY, 0, A_NONE, NON_PM, NON_PM, 3000L,
NO_COLOR),
NO_COLOR, FIRE_BRAND),
A("Dragonbane", BROADSWORD,
(SPFX_RESTR | SPFX_DCLAS | SPFX_REFLECT), 0, S_DRAGON,
PHYS(5, 0), NO_DFNS, NO_CARY, 0, A_NONE, NON_PM, NON_PM, 500L,
NO_COLOR),
NO_COLOR, DRAGONBANE),
A("Demonbane", LONG_SWORD, (SPFX_RESTR | SPFX_DFLAG2), 0, M2_DEMON,
PHYS(5, 0), NO_DFNS, NO_CARY, 0, A_LAWFUL, NON_PM, NON_PM, 2500L,
NO_COLOR),
NO_COLOR, DEMONBANE),
A("Werebane", SILVER_SABER, (SPFX_RESTR | SPFX_DFLAG2), 0, M2_WERE,
PHYS(5, 0), DFNS(AD_WERE), NO_CARY, 0, A_NONE, NON_PM, NON_PM, 1500L,
NO_COLOR),
NO_COLOR, WEREBANE),
A("Grayswandir", SILVER_SABER, (SPFX_RESTR | SPFX_HALRES), 0, 0,
PHYS(5, 0), NO_DFNS, NO_CARY, 0, A_LAWFUL, NON_PM, NON_PM, 8000L,
NO_COLOR),
NO_COLOR, GRAYSWANDIR),
A("Giantslayer", LONG_SWORD, (SPFX_RESTR | SPFX_DFLAG2), 0, M2_GIANT,
PHYS(5, 0), NO_DFNS, NO_CARY, 0, A_NEUTRAL, NON_PM, NON_PM, 200L,
NO_COLOR),
NO_COLOR, GIANTSLAYER),
A("Ogresmasher", WAR_HAMMER, (SPFX_RESTR | SPFX_DCLAS), 0, S_OGRE,
PHYS(5, 0), NO_DFNS, NO_CARY, 0, A_NONE, NON_PM, NON_PM, 200L,
NO_COLOR),
NO_COLOR, OGRESMASHER),
A("Trollsbane", MORNING_STAR, (SPFX_RESTR | SPFX_DCLAS), 0, S_TROLL,
PHYS(5, 0), NO_DFNS, NO_CARY, 0, A_NONE, NON_PM, NON_PM, 200L,
NO_COLOR),
NO_COLOR, TROLLSBANE),
/*
* Two problems: 1) doesn't let trolls regenerate heads,
* 2) doesn't give unusual message for 2-headed monsters (but
@@ -147,7 +156,7 @@ static NEARDATA struct artifact artilist[] = {
*/
A("Vorpal Blade", LONG_SWORD, (SPFX_RESTR | SPFX_BEHEAD), 0, 0,
PHYS(5, 1), NO_DFNS, NO_CARY, 0, A_NEUTRAL, NON_PM, NON_PM, 4000L,
NO_COLOR),
NO_COLOR, VORPAL_BLADE),
/*
* Ah, never shall I forget the cry,
* or the shriek that shrieked he,
@@ -157,11 +166,11 @@ static NEARDATA struct artifact artilist[] = {
* (From Sir W.S. Gilbert's "The Mikado")
*/
A("Snickersnee", KATANA, SPFX_RESTR, 0, 0, PHYS(0, 8), NO_DFNS, NO_CARY,
0, A_LAWFUL, PM_SAMURAI, NON_PM, 1200L, NO_COLOR),
0, A_LAWFUL, PM_SAMURAI, NON_PM, 1200L, NO_COLOR, SNICKERSNEE),
A("Sunsword", LONG_SWORD, (SPFX_RESTR | SPFX_DFLAG2), 0, M2_UNDEAD,
PHYS(5, 0), DFNS(AD_BLND), NO_CARY, 0, A_LAWFUL, NON_PM, NON_PM, 1500L,
NO_COLOR),
NO_COLOR, SUNSWORD),
/*
* The artifacts for the quest dungeon, all self-willed.
@@ -170,52 +179,53 @@ static NEARDATA struct artifact artilist[] = {
A("The Orb of Detection", CRYSTAL_BALL,
(SPFX_NOGEN | SPFX_RESTR | SPFX_INTEL), (SPFX_ESP | SPFX_HSPDAM), 0,
NO_ATTK, NO_DFNS, CARY(AD_MAGM), INVIS, A_LAWFUL, PM_ARCHEOLOGIST,
NON_PM, 2500L, NO_COLOR),
NON_PM, 2500L, NO_COLOR, ORB_OF_DETECTION),
A("The Heart of Ahriman", LUCKSTONE,
(SPFX_NOGEN | SPFX_RESTR | SPFX_INTEL), SPFX_STLTH, 0,
/* this stone does double damage if used as a projectile weapon */
PHYS(5, 0), NO_DFNS, NO_CARY, LEVITATION, A_NEUTRAL, PM_BARBARIAN,
NON_PM, 2500L, NO_COLOR),
NON_PM, 2500L, NO_COLOR, HEART_OF_AHRIMAN),
A("The Sceptre of Might", MACE,
(SPFX_NOGEN | SPFX_RESTR | SPFX_INTEL | SPFX_DALIGN), 0, 0, PHYS(5, 0),
DFNS(AD_MAGM), NO_CARY, CONFLICT, A_LAWFUL, PM_CAVE_DWELLER, NON_PM, 2500L,
NO_COLOR),
NO_COLOR, SCEPTRE_OF_MIGHT),
#if 0 /* OBSOLETE */
A("The Palantir of Westernesse", CRYSTAL_BALL,
(SPFX_NOGEN|SPFX_RESTR|SPFX_INTEL),
(SPFX_ESP|SPFX_REGEN|SPFX_HSPDAM), 0,
NO_ATTK, NO_DFNS, NO_CARY,
TAMING, A_CHAOTIC, NON_PM , PM_ELF, 8000L, NO_COLOR ),
TAMING, A_CHAOTIC, NON_PM , PM_ELF, 8000L, NO_COLOR,
PALANTIR_OF_WESTERNESSE ),
#endif
A("The Staff of Aesculapius", QUARTERSTAFF,
(SPFX_NOGEN | SPFX_RESTR | SPFX_ATTK | SPFX_INTEL | SPFX_DRLI
| SPFX_REGEN),
0, 0, DRLI(0, 0), DRLI(0, 0), NO_CARY, HEALING, A_NEUTRAL, PM_HEALER,
NON_PM, 5000L, NO_COLOR),
NON_PM, 5000L, NO_COLOR, STAFF_OF_AESCULAPIUS),
A("The Magic Mirror of Merlin", MIRROR,
(SPFX_NOGEN | SPFX_RESTR | SPFX_INTEL | SPFX_SPEAK), SPFX_ESP, 0,
NO_ATTK, NO_DFNS, CARY(AD_MAGM), 0, A_LAWFUL, PM_KNIGHT, NON_PM, 1500L,
NO_COLOR),
NO_COLOR, MAGIC_MIRROR_OF_MERLIN),
A("The Eyes of the Overworld", LENSES,
(SPFX_NOGEN | SPFX_RESTR | SPFX_INTEL | SPFX_XRAY), 0, 0, NO_ATTK,
DFNS(AD_MAGM), NO_CARY, ENLIGHTENING, A_NEUTRAL, PM_MONK, NON_PM,
2500L, NO_COLOR),
2500L, NO_COLOR, EYES_OF_THE_OVERWORLD),
A("The Mitre of Holiness", HELM_OF_BRILLIANCE,
(SPFX_NOGEN | SPFX_RESTR | SPFX_DFLAG2 | SPFX_INTEL | SPFX_PROTECT), 0,
M2_UNDEAD, NO_ATTK, NO_DFNS, CARY(AD_FIRE), ENERGY_BOOST, A_LAWFUL,
PM_CLERIC, NON_PM, 2000L, NO_COLOR),
PM_CLERIC, NON_PM, 2000L, NO_COLOR, MITRE_OF_HOLINESS),
A("The Longbow of Diana", BOW,
(SPFX_NOGEN | SPFX_RESTR | SPFX_INTEL | SPFX_REFLECT), SPFX_ESP, 0,
PHYS(5, 0), NO_DFNS, NO_CARY, CREATE_AMMO, A_CHAOTIC, PM_RANGER, NON_PM,
4000L, NO_COLOR),
4000L, NO_COLOR, LONGBOW_OF_DIANA),
/* MKoT has an additional carry property if the Key is not cursed (for
rogues) or blessed (for non-rogues): #untrap of doors and chests
@@ -223,40 +233,45 @@ A("The Palantir of Westernesse", CRYSTAL_BALL,
A("The Master Key of Thievery", SKELETON_KEY,
(SPFX_NOGEN | SPFX_RESTR | SPFX_INTEL | SPFX_SPEAK),
(SPFX_WARN | SPFX_TCTRL | SPFX_HPHDAM), 0, NO_ATTK, NO_DFNS, NO_CARY,
UNTRAP, A_CHAOTIC, PM_ROGUE, NON_PM, 3500L, NO_COLOR),
UNTRAP, A_CHAOTIC, PM_ROGUE, NON_PM, 3500L, NO_COLOR,
MASTER_KEY_OF_THIEVERY),
A("The Tsurugi of Muramasa", TSURUGI,
(SPFX_NOGEN | SPFX_RESTR | SPFX_INTEL | SPFX_BEHEAD | SPFX_LUCK
| SPFX_PROTECT),
0, 0, PHYS(0, 8), NO_DFNS, NO_CARY, 0, A_LAWFUL, PM_SAMURAI, NON_PM,
4500L, NO_COLOR),
4500L, NO_COLOR, TSURUGI_OF_MURAMASA),
A("The Platinum Yendorian Express Card", CREDIT_CARD,
(SPFX_NOGEN | SPFX_RESTR | SPFX_INTEL | SPFX_DEFN),
(SPFX_ESP | SPFX_HSPDAM), 0, NO_ATTK, NO_DFNS, CARY(AD_MAGM),
CHARGE_OBJ, A_NEUTRAL, PM_TOURIST, NON_PM, 7000L, NO_COLOR),
CHARGE_OBJ, A_NEUTRAL, PM_TOURIST, NON_PM, 7000L, NO_COLOR,
YENDORIAN_EXPRESS_CARD),
A("The Orb of Fate", CRYSTAL_BALL,
(SPFX_NOGEN | SPFX_RESTR | SPFX_INTEL | SPFX_LUCK),
(SPFX_WARN | SPFX_HSPDAM | SPFX_HPHDAM), 0, NO_ATTK, NO_DFNS, NO_CARY,
LEV_TELE, A_NEUTRAL, PM_VALKYRIE, NON_PM, 3500L, NO_COLOR),
LEV_TELE, A_NEUTRAL, PM_VALKYRIE, NON_PM, 3500L, NO_COLOR,
ORB_OF_FATE),
A("The Eye of the Aethiopica", AMULET_OF_ESP,
(SPFX_NOGEN | SPFX_RESTR | SPFX_INTEL), (SPFX_EREGEN | SPFX_HSPDAM), 0,
NO_ATTK, DFNS(AD_MAGM), NO_CARY, CREATE_PORTAL, A_NEUTRAL, PM_WIZARD,
NON_PM, 4000L, NO_COLOR),
NON_PM, 4000L, NO_COLOR, EYE_OF_THE_AETHIOPICA),
#if !defined(ARTI_ENUM)
/*
* terminator; otyp must be zero
*/
A(0, 0, 0, 0, 0, NO_ATTK, NO_DFNS, NO_CARY, 0, A_NONE, NON_PM, NON_PM, 0L,
0) /* 0 is CLR_BLACK rather than NO_COLOR but it doesn't matter here */
0, TERMINATOR) /* 0 is CLR_BLACK rather than NO_COLOR but it doesn't matter here */
}; /* artilist[] (or artifact_names[]) */
#endif
#undef A
#if !defined(MAKEDEFS_C) && !defined(MDLIB_C)
#if !defined(MAKEDEFS_C) && !defined(MDLIB_C) && !defined(ARTI_ENUM)
#undef NO_ATTK
#undef NO_DFNS
#undef DFNS

View File

@@ -270,6 +270,16 @@
#endif
#endif
/*
* NODUMPENUMS
* If there are memory constraints and you don't want to store information
* about the internal enum values for monsters and objects, this can be
* uncommented to define NODUMPENUMS. Doing so will disable the
* nethack --dumpenums
* command line option.
*/
/* #define NODUMPENUMS */
/*
* If COMPRESS is defined, it should contain the full path name of your
* 'compress' program.

View File

@@ -250,11 +250,6 @@ E NEARDATA struct you u;
E NEARDATA time_t ubirthday;
E NEARDATA struct u_realtime urealtime;
#include "onames.h"
#ifndef PM_H /* (pm.h has already been included via youprop.h) */
#include "pm.h"
#endif
struct mvitals {
uchar born;
uchar died;
@@ -434,6 +429,9 @@ E const char *ARGV0;
#endif
enum earlyarg {ARG_DEBUG, ARG_VERSION, ARG_SHOWPATHS
#ifndef NODUMPENUMS
, ARG_DUMPENUMS
#endif
#ifdef WIN32
,ARG_WINDOWS
#endif

View File

@@ -247,6 +247,11 @@ extern char yn_function(const char *, const char *, char);
extern boolean paranoid_query(boolean, const char *);
extern void makemap_prepost(boolean, boolean);
/* ### date.c ### */
extern void populate_nomakedefs(struct version_info *);
extern void free_nomakedefs(void);
/* ### dbridge.c ### */
extern boolean is_pool(int, int);
@@ -1193,6 +1198,9 @@ extern int buzzmu(struct monst *, struct attack *);
extern void runtime_info_init(void);
extern const char *do_runtime_info(int *);
#ifndef NODUMPENUMS
extern void dump_enums(void);
#endif
/* ### mhitm.c ### */

View File

@@ -111,40 +111,6 @@ typedef uchar nhsym;
#include "coord.h"
#if defined(CROSSCOMPILE)
struct cross_target_s {
const char *build_date;
const char *copyright_banner_c;
const char *git_sha;
const char *git_branch;
const char *version_string;
const char *version_id;
unsigned long version_number;
unsigned long version_features;
unsigned long ignored_features;
unsigned long version_sanity1;
unsigned long version_sanity2;
unsigned long version_sanity3;
unsigned long build_time;
};
extern struct cross_target_s cross_target;
#if defined(CROSSCOMPILE_TARGET) && !defined(MAKEDEFS_C)
#define BUILD_DATE cross_target.build_date /* "Wed Apr 1 00:00:01 2020" */
#define COPYRIGHT_BANNER_C cross_target.copyright_banner_c
#define NETHACK_GIT_SHA cross_target.git_sha
#define NETHACK_GIT_BRANCH cross_target.git_branch
#define VERSION_ID cross_target.version_id
#define IGNORED_FEATURES cross_target.ignored_features
#define VERSION_FEATURES cross_target.version_features
#define VERSION_NUMBER cross_target.version_number
#define VERSION_SANITY1 cross_target.version_sanity1
#define VERSION_SANITY2 cross_target.version_sanity2
#define VERSION_SANITY3 cross_target.version_sanity3
#define VERSION_STRING cross_target.version_string
#define BUILD_TIME cross_target.build_time /* (1574157640UL) */
#endif /* CROSSCOMPILE_TARGET && !MAKEDEFS_C */
#endif /* CROSSCOMPILE */
/*
* Automatic inclusions for the subsidiary files.
* Please don't change the order. It does matter.
@@ -356,6 +322,26 @@ struct savefile_info {
#define SFI1_ZEROCOMP (1L << 2)
#endif
/* This is used to store some build-info data that used
to be present in makedefs-generated header file date.h */
struct nomakedefs_s {
const char *build_date;
const char *copyright_banner_c;
const char *git_sha;
const char *git_branch;
const char *version_string;
const char *version_id;
unsigned long version_number;
unsigned long version_features;
unsigned long ignored_features;
unsigned long version_sanity1;
unsigned long version_sanity2;
unsigned long version_sanity3;
unsigned long build_time;
};
extern struct nomakedefs_s nomakedefs;
/*
* Configurable internal parameters.
*

View File

@@ -185,6 +185,18 @@ typedef struct {
#include "dungeon.h"
#include "sym.h"
#include "mkroom.h"
enum artifacts_nums {
#define ARTI_ENUM
#include "artilist.h"
#undef ARTI_ENUM
AFTER_LAST_ARTIFACT
};
enum misc_arti_nums {
NROFARTIFACTS = (AFTER_LAST_ARTIFACT - 1)
};
#include "objclass.h"
#include "youprop.h"
#include "wintype.h"

3326
include/monsters.h Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -134,9 +134,6 @@ struct objdescr {
const char *oc_descr; /* description when name unknown */
};
extern NEARDATA struct objclass objects[];
extern NEARDATA struct objdescr obj_descr[];
/*
* All objects have a class. Make sure that all classes have a corresponding
* symbol below.
@@ -183,6 +180,23 @@ struct fruit {
#define newfruit() (struct fruit *) alloc(sizeof(struct fruit))
#define dealloc_fruit(rind) free((genericptr_t)(rind))
enum objects_nums {
#define OBJECTS_ENUM
#include "objects.h"
#undef OBJECTS_ENUM
NUM_OBJECTS
};
enum misc_object_nums {
LAST_GEM = (JADE),
NUM_GLASS_GEMS = ((LUCKSTONE - JADE) - 1),
MAXSPELL = ((SPE_BOOK_OF_THE_DEAD - SCR_BLANK_PAPER) + 1)
};
extern NEARDATA struct objclass objects[NUM_OBJECTS + 1];
extern NEARDATA struct objdescr obj_descr[NUM_OBJECTS + 1];
#define OBJ_NAME(obj) (obj_descr[(obj).oc_name_idx].oc_name)
#define OBJ_DESCR(obj) (obj_descr[(obj).oc_descr_idx].oc_descr)
#endif /* OBJCLASS_H */

1532
include/objects.h Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -39,7 +39,8 @@
#define COPYRIGHT_BANNER_A "NetHack, Copyright 1985-2021"
#define COPYRIGHT_BANNER_B \
" By Stichting Mathematisch Centrum and M. Stephenson."
/* COPYRIGHT_BANNER_C is generated by makedefs into date.h */
/* nomakedefs.copyright_banner_c is generated at runtime */
#define COPYRIGHT_BANNER_C nomakedefs.copyright_banner_c
#define COPYRIGHT_BANNER_D " See license for details."
/*

View File

@@ -66,6 +66,13 @@ struct permonst {
extern NEARDATA struct permonst mons[]; /* the master list of monster types */
enum monnums {
#define MONS_ENUM
#include "monsters.h"
#undef MONS_ENUM
NUMMONS
};
#define VERY_SLOW 3
#define SLOW_SPEED 9
#define NORMAL_SPEED 12 /* movement rates */
@@ -82,4 +89,5 @@ extern NEARDATA struct permonst mons[]; /* the master list of monster types */
#define pmname(pm,g) ((((g) == MALE || (g) == FEMALE) && (pm)->pmnames[g]) \
? (pm)->pmnames[g] : (pm)->pmnames[NEUTRAL])
#endif
#endif /* PERMONST_H */

View File

@@ -8,7 +8,6 @@
#include "prop.h"
#include "permonst.h"
#include "mondata.h"
#include "pm.h"
/* KMH, intrinsics patch.
* Reorganized and rewritten for >32-bit properties.

2
src/.gitignore vendored
View File

@@ -12,4 +12,4 @@ graphicschk
nhdat
o
nhdat*
date.nmk

View File

@@ -28,6 +28,7 @@ early_init(void)
objects_globals_init();
monst_globals_init();
sys_early_init();
runtime_info_init();
}
static void
@@ -803,6 +804,9 @@ static const struct early_opt earlyopts[] = {
{ARG_DEBUG, "debug", 5, TRUE},
{ARG_VERSION, "version", 4, TRUE},
{ARG_SHOWPATHS, "showpaths", 9, FALSE},
#ifndef NODUMPENUMS
{ARG_DUMPENUMS, "dumpenums", 9, FALSE},
#endif
#ifdef WIN32
{ARG_WINDOWS, "windows", 4, TRUE},
#endif
@@ -881,6 +885,12 @@ argcheck(int argc, char *argv[], enum earlyarg e_arg)
case ARG_SHOWPATHS: {
return 2;
}
#ifndef NODUMPENUMS
case ARG_DUMPENUMS: {
dump_enums();
return 2;
}
#endif
#ifdef WIN32
case ARG_WINDOWS: {
if (extended_opt) {
@@ -953,4 +963,59 @@ debug_fields(const char *opts)
#endif
return;
}
#ifndef NODUMPENUMS
void
dump_enums(void)
{
int i, j;
enum enum_dumps {
monsters_enum,
objects_enum,
objects_misc_enum,
NUM_ENUM_DUMPS
};
static const char *titles[NUM_ENUM_DUMPS] =
{ "monnums", "objects_nums" , "misc_object_nums" };
struct enum_dump {
int val;
const char *nm;
};
#define DUMP_ENUMS
struct enum_dump monsdump[] = {
#include "monsters.h"
{ NUMMONS, "NUMMONS" },
};
struct enum_dump objdump[] = {
#include "objects.h"
{ NUM_OBJECTS, "NUM_OBJECTS" },
};
#undef DUMP_ENUMS
struct enum_dump omdump[] = {
{ LAST_GEM, "LAST_GEM" },
{ NUM_GLASS_GEMS, "NUM_GLASS_GEMS" },
{ MAXSPELL, "MAXSPELL" },
};
struct enum_dump *ed[NUM_ENUM_DUMPS] = { monsdump, objdump, omdump };
static const char *pfx[NUM_ENUM_DUMPS] = { "PM_", "", "" };
int szd[NUM_ENUM_DUMPS] = { SIZE(monsdump), SIZE(objdump), SIZE(omdump) };
for (i = 0; i < NUM_ENUM_DUMPS; ++ i) {
raw_printf("enum %s = {", titles[i]);
for (j = 0; j < szd[i]; ++j) {
raw_printf(" %s%s = %i%s",
(j == szd[i] - 1) ? "" : pfx[i],
ed[i]->nm,
ed[i]->val,
(j == szd[i] - 1) ? "" : ",");
ed[i]++;
}
raw_print("};");
raw_print("");
}
raw_print("");
}
#endif /* NODUMPENUMS */
/*allmain.c*/

144
src/date.c Normal file
View File

@@ -0,0 +1,144 @@
/* NetHack 3.7 date.c $NHDT-Date: 1608933420 2020/12/25 21:57:00 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.17 $ */
/* Copyright (c) Michael Allison, 2021. */
/* NetHack may be freely redistributed. See license for details. */
#include "config.h"
/* these are in extern.h but we don't include hack.h */
void populate_nomakedefs(struct version_info *);
void free_nomakedefs(void);
#define Snprintf(str, size, ...) \
nh_snprintf(__func__, __LINE__, str, size, __VA_ARGS__)
extern void nh_snprintf(const char *func, int line, char *str, size_t size,
const char *fmt, ...);
extern char *mdlib_version_string(char *, const char *);
extern char *version_id_string(char *, int, const char *);
extern char *bannerc_string(char *, int, const char *);
extern int case_insensitive_comp(const char *, const char *);
struct nomakedefs_s nomakedefs = {
/* https://groups.google.com/forum/#!original/
comp.sources.games/91SfKYg_xzI/dGnR3JnspFkJ */
"Tue, 28-Jul-87 13:18:57 EDT",
"Version 1.0, built Jul 28 13:18:57 1987.",
(const char *) 0, /* git_sha */
(const char *) 0, /* git_branch */
"1.0.0-0",
"NetHack Version 1.0.0-0 - last build Tue Jul 28 13:18:57 1987.",
0x01010000UL,
0x00000000UL,
0x00000000UL,
0x00000000UL,
0x00000000UL,
0x00000000UL,
554476737UL,
};
#if defined(__DATE__) && defined(__TIME__)
#define extract_field(t,s,n,z) \
do { \
for (i = 0; i < n; ++i) \
t[i] = s[i + z]; \
t[i] = '\0'; \
} while (0)
void
populate_nomakedefs(struct version_info *version)
{
int i;
char tmpbuf1[BUFSZ], tmpbuf2[BUFSZ], *strp;
const char *mth[] = {
"Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
struct tm t = {0};
time_t timeresult;
/*
* In a cross-compiled environment, you can't execute
* the target binaries during the build, so we can't
* use makedefs to write the values of the build
* date and time to a file for retrieval. Not for
* information meaningful to the target execution
* environment.
*
* How can we capture the build date/time of the target
* binaries in such a situation? We need to rely on the
* cross-compiler itself to do it for us during the
* cross-compile.
*
* To that end, we are going to make use of the
* following pre-defined preprocessor macros for this:
* gcc, msvc, clang __DATE__ "Feb 12 1996"
* gcc, msvc, clang __TIME__ "23:59:01"
*
*/
/* if (sizeof __DATE__ + sizeof __TIME__ + sizeof "123" <
sizeof tmpbuf1) */
Snprintf(tmpbuf1, sizeof tmpbuf1, "%s %s", __DATE__, __TIME__);
/* "Feb 12 1996 23:59:01"
01234567890123456789 */
if ((int) strlen(tmpbuf1) == 20) {
extract_field(tmpbuf2, tmpbuf1, 4, 7); /* year */
t.tm_year = atoi(tmpbuf2) - 1900;
extract_field(tmpbuf2, tmpbuf1, 3, 0); /* mon */
for (i = 0; i < SIZE(mth); ++i)
if (!case_insensitive_comp(tmpbuf2, mth[i])) {
t.tm_mon = i;
break;
}
extract_field(tmpbuf2, tmpbuf1, 2, 4); /* mday */
strp = tmpbuf2;
if (*strp == ' ')
strp++;
t.tm_mday = atoi(strp);
extract_field(tmpbuf2, tmpbuf1, 2, 12); /* hour */
t.tm_hour = atoi(tmpbuf2);
extract_field(tmpbuf2, tmpbuf1, 2, 15); /* min */
t.tm_min = atoi(tmpbuf2);
extract_field(tmpbuf2, tmpbuf1, 2, 18); /* sec */
t.tm_sec = atoi(tmpbuf2);
timeresult = mktime(&t);
nomakedefs.build_time = (unsigned long) timeresult;
nomakedefs.build_date = strdup(tmpbuf1);
}
nomakedefs.version_number = version->incarnation;
nomakedefs.version_features = version->feature_set;
#ifdef MD_IGNORED_FEATURES
nomakedefs.ignored_features = MD_IGNORED_FEATURES;
#endif
nomakedefs.version_sanity1 = version->entity_count;
nomakedefs.version_sanity2 = version->struct_sizes1;
nomakedefs.version_sanity3 = version->struct_sizes2;
nomakedefs.version_string = strdup(mdlib_version_string(tmpbuf2, "."));
nomakedefs.version_id = strdup(version_id_string(tmpbuf2, sizeof tmpbuf2,
nomakedefs.build_date));
nomakedefs.copyright_banner_c = strdup(bannerc_string(
tmpbuf2, sizeof tmpbuf2,
nomakedefs.build_date));
#ifdef NETHACK_GIT_SHA
nomakedefs.git_sha = strdup(NETHACK_GIT_SHA);
#endif
#ifdef NETHACK_GIT_BRANCH
nomakedefs.git_branch = strdup(NETHACK_GIT_BRANCH);
#endif
}
void
free_nomakedefs(void)
{
if (nomakedefs.build_date)
free((genericptr_t) nomakedefs.build_date);
if (nomakedefs.version_string)
free((genericptr_t) nomakedefs.version_string);
if (nomakedefs.version_id)
free((genericptr_t) nomakedefs.version_id);
if (nomakedefs.copyright_banner_c)
free((genericptr_t) nomakedefs.copyright_banner_c);
}
#endif /* __DATE__ && __TIME__ */
/*date.c*/

View File

@@ -1763,6 +1763,7 @@ nh_terminate(int status)
dlb_cleanup();
l_nhcore_done();
}
free_nomakedefs();
#ifdef VMS
/*

View File

@@ -48,17 +48,17 @@
#endif /* !MAKEDEFS_C */
/* shorten up some lines */
#if defined(CROSSCOMPILE_TARGET) || defined(OPTIONS_AT_RUNTIME)
#define FOR_RUNTIME
#endif
#if defined(MAKEDEFS_C) || defined(FOR_RUNTIME)
#include <stdarg.h>
/* REPRODUCIBLE_BUILD will change this to TRUE */
static boolean date_via_env = FALSE;
static char *version_string(char *, const char *);
static char *version_id_string(char *, const char *);
static char *bannerc_string(char *, const char *);
char *mdlib_version_string(char *, const char *);
char *version_id_string(char *, int, const char *);
char *bannerc_string(char *, int, const char *);
int case_insensitive_comp(const char *, const char *);
static void make_version(void);
static char *eos(char *);
@@ -71,20 +71,17 @@ static char *mdlib_strsubst(char *, const char *, const char *);
static int mkstemp(char *);
#endif
#endif
#endif /* MAKEDEFS_C || FOR_RUNTIME */
#if defined(MAKEDEFS_C) || defined(FOR_RUNTIME) || defined(WIN32) \
|| (defined(CROSSCOMPILE_TARGET) && defined(__DATE__) && defined(__TIME__))
static int case_insensitive_comp(const char *, const char *);
#endif
#endif /* MAKEDEFS_C || FOR_RUNTIME */
#if !defined(MAKEDEFS_C) && defined(WIN32)
extern int GUILaunched;
#endif
/* these two are in extern.h but we don't include hack.h */
/* these are in extern.h but we don't include hack.h */
void runtime_info_init(void);
const char *do_runtime_info(int *);
void populate_nomakedefs(struct version_info *);
void build_options(void);
static int count_and_validate_winopts(void);
@@ -92,10 +89,6 @@ static void opt_out_words(char *, int *);
static void build_savebones_compat_string(void);
static int idxopttext, done_runtime_opt_init_once = 0;
#define MAXOPT 40
#if !defined(MAKEDEFS_C) && defined(CROSSCOMPILE_TARGET) \
&& defined(__DATE__) && defined(__TIME__)
static char rttimebuf[MAXOPT];
#endif
static char *opttext[120] = { 0 };
char optbuf[BUFSZ];
static struct version_info version;
@@ -257,8 +250,8 @@ make_version(void)
#if defined(MAKEDEFS_C) || defined(FOR_RUNTIME)
static char *
version_string(char *outbuf, const char *delim)
char *
mdlib_version_string(char *outbuf, const char *delim)
{
Sprintf(outbuf, "%d%s%d%s%d", VERSION_MAJOR, delim, VERSION_MINOR, delim,
PATCHLEVEL);
@@ -268,8 +261,40 @@ version_string(char *outbuf, const char *delim)
return outbuf;
}
static char *
version_id_string(char *outbuf, const char *build_date)
#define Snprintf(str, size, ...) \
nh_snprintf(__func__, __LINE__, str, size, __VA_ARGS__)
extern void nh_snprintf(const char *func, int line, char *str, size_t size,
const char *fmt, ...);
#ifdef MAKEDEFS_C
DISABLE_WARNING_FORMAT_NONLITERAL
void
nh_snprintf(const char *func UNUSED, int line UNUSED, char *str, size_t size,
const char *fmt, ...)
{
va_list ap;
int n;
va_start(ap, fmt);
#ifdef NO_VSNPRINTF
n = vsprintf(str, fmt, ap);
#else
n = vsnprintf(str, size, fmt, ap);
#endif
va_end(ap);
if (n < 0 || (size_t)n >= size) { /* is there a problem? */
str[size-1] = 0; /* make sure it is nul terminated */
}
}
RESTORE_WARNING_FORMAT_NONLITERAL
#endif /* MAKEDEFS_C */
char *
version_id_string(char *outbuf, int bufsz, const char *build_date)
{
char subbuf[64], versbuf[64];
char statusbuf[64];
@@ -293,16 +318,16 @@ version_id_string(char *outbuf, const char *build_date)
Strcpy(&subbuf[1], PORT_SUB_ID);
#endif
Sprintf(outbuf, "%s NetHack%s Version %s%s - last %s %s.", PORT_ID,
subbuf, version_string(versbuf, "."), statusbuf,
Snprintf(outbuf, bufsz, "%s NetHack%s Version %s%s - last %s %s.", PORT_ID,
subbuf, mdlib_version_string(versbuf, "."), statusbuf,
date_via_env ? "revision" : "build", build_date);
return outbuf;
}
/* still within #if MAKDEFS_C || FOR_RUNTIME */
static char *
bannerc_string(char *outbuf, const char *build_date)
char *
bannerc_string(char *outbuf, int bufsz, const char *build_date)
{
char subbuf[64], versbuf[64];
@@ -319,14 +344,9 @@ bannerc_string(char *outbuf, const char *build_date)
#endif
#endif
Sprintf(outbuf, " Version %s %s%s, %s %s.",
version_string(versbuf, "."), PORT_ID, subbuf,
date_via_env ? "revised" : "built", &build_date[4]);
#if 0
Sprintf(outbuf, "%s NetHack%s %s Copyright 1985-%s (built %s)",
PORT_ID, subbuf, version_string(versbuf,"."), RELEASE_YEAR,
&build_date[4]);
#endif
Snprintf(outbuf, bufsz, " Version %s %s%s, %s %s.",
mdlib_version_string(versbuf, "."), PORT_ID, subbuf,
date_via_env ? "revised" : "built", build_date);
return outbuf;
}
@@ -348,27 +368,6 @@ mkstemp(char *template)
#endif /* HAS_NO_MKSTEMP */
#endif /* MAKEDEFS_C || FOR_RUNTIME */
#if defined(MAKEDEFS_C) || defined(FOR_RUNTIME) || defined(WIN32) \
|| (defined(CROSSCOMPILE_TARGET) && defined(__DATE__) && defined(__TIME__))
static int
case_insensitive_comp(const char *s1, const char *s2)
{
uchar u1, u2;
for (;; s1++, s2++) {
u1 = (uchar) *s1;
if (isupper(u1))
u1 = tolower(u1);
u2 = (uchar) *s2;
if (isupper(u2))
u2 = tolower(u2);
if (u1 == '\0' || u1 != u2)
break;
}
return u1 - u2;
}
#endif
static char *
eos(char *str)
{
@@ -791,103 +790,33 @@ build_options(void)
return;
}
#if defined(__DATE__) && defined(__TIME__)
#define extract_field(t,s,n,z) \
do { \
for (i = 0; i < n; ++i) \
t[i] = s[i + z]; \
t[i] = '\0'; \
} while (0)
#endif
int
case_insensitive_comp(const char *s1, const char *s2)
{
uchar u1, u2;
for (;; s1++, s2++) {
u1 = (uchar) *s1;
if (isupper(u1))
u1 = tolower(u1);
u2 = (uchar) *s2;
if (isupper(u2))
u2 = tolower(u2);
if (u1 == '\0' || u1 != u2)
break;
}
return u1 - u2;
}
void
runtime_info_init(void)
{
#if !defined(MAKEDEFS_C) && defined(CROSSCOMPILE_TARGET) \
&& defined(__DATE__) && defined(__TIME__)
int i;
char tmpbuf[BUFSZ], *strp;
const char *mth[] = {
"Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
struct tm t = {0};
time_t timeresult;
#endif
if (!done_runtime_opt_init_once) {
done_runtime_opt_init_once = 1;
build_savebones_compat_string();
/* construct the current version number */
make_version();
#if !defined(MAKEDEFS_C) && defined(CROSSCOMPILE_TARGET)
#if defined(__DATE__) && defined(__TIME__)
/*
* In a cross-compiled environment, you can't execute
* the target binaries during the build, so we can't
* use makedefs to write the values of the build
* date and time to a file for retrieval. Not for
* information meaningful to the target execution
* environment.
*
* How can we capture the build date/time of the target
* binaries in such a situation? We need to rely on the
* cross-compiler itself to do it for us during the
* cross-compile.
*
* To that end, we are going to make use of the
* following pre-defined preprocessor macros for this:
* gcc, msvc, clang __DATE__ "Feb 12 1996"
* gcc, msvc, clang __TIME__ "23:59:01"
*
*/
if (sizeof __DATE__ + sizeof __TIME__ + sizeof "123" <
sizeof rttimebuf)
Sprintf(rttimebuf, "%s %s", __DATE__, __TIME__);
/* "Feb 12 1996 23:59:01"
01234567890123456789 */
if ((int) strlen(rttimebuf) == 20) {
extract_field(tmpbuf, rttimebuf, 4, 7); /* year */
t.tm_year = atoi(tmpbuf) - 1900;
extract_field(tmpbuf, rttimebuf, 3, 0); /* mon */
for (i = 0; i < SIZE(mth); ++i)
if (!case_insensitive_comp(tmpbuf, mth[i])) {
t.tm_mon = i;
break;
}
extract_field(tmpbuf, rttimebuf, 2, 4); /* mday */
strp = tmpbuf;
if (*strp == ' ')
strp++;
t.tm_mday = atoi(strp);
extract_field(tmpbuf, rttimebuf, 2, 12); /* hour */
t.tm_hour = atoi(tmpbuf);
extract_field(tmpbuf, rttimebuf, 2, 15); /* min */
t.tm_min = atoi(tmpbuf);
extract_field(tmpbuf, rttimebuf, 2, 18); /* sec */
t.tm_sec = atoi(tmpbuf);
timeresult = mktime(&t);
BUILD_TIME = (unsigned long) timeresult;
BUILD_DATE = rttimebuf;
}
#endif /* __DATE__ && __TIME__ */
VERSION_NUMBER = version.incarnation;
VERSION_FEATURES = version.feature_set;
#ifdef MD_IGNORED_FEATURES
IGNORED_FEATURES = MD_IGNORED_FEATURES;
#endif
VERSION_SANITY1 = version.entity_count;
VERSION_SANITY2 = version.struct_sizes1;
VERSION_SANITY3 = version.struct_sizes2;
VERSION_STRING = strdup(version_string(tmpbuf, "."));
VERSION_ID = strdup(version_id_string(tmpbuf, BUILD_DATE));
COPYRIGHT_BANNER_C = strdup(bannerc_string(tmpbuf, BUILD_DATE));
#ifdef NETHACK_HOST_GIT_SHA
NETHACK_GIT_SHA = strdup(NETHACK_HOST_GIT_SHA);
#endif
#ifdef NETHACK_HOST_GIT_BRANCH
NETHACK_GIT_BRANCH = strdup(NETHACK_HOST_GIT_BRANCH);
#endif
#endif /* !MAKEDEFS_C && CROSSCOMPILE_TARGET */
populate_nomakedefs(&version); /* date.c */
idxopttext = 0;
build_options();
}
@@ -904,7 +833,7 @@ do_runtime_info(int *rtcontext)
if (*rtcontext >= 0 && *rtcontext < (MAXOPT - 1)) {
retval = opttext[*rtcontext];
*rtcontext += 1;
}
}
return retval;
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -197,7 +197,7 @@ static const char *const shkhealthfoods[] = {
* The iprobs array in each entry defines the probabilities for various kinds
* of objects to be present in the given shop type. You can associate with
* each percentage either a generic object type (represented by one of the
* *_CLASS macros) or a specific object (represented by an onames.h define).
* *_CLASS enum value) or a specific object enum value.
* In the latter case, prepend it with a unary minus so the code can know
* (by testing the sign) whether to use mkobj() or mksobj().
*/

View File

@@ -5,50 +5,9 @@
#include "hack.h"
#include "dlb.h"
#include "date.h"
#if defined(CROSSCOMPILE)
struct cross_target_s cross_target = {
/* https://groups.google.com/forum/#!original/
comp.sources.games/91SfKYg_xzI/dGnR3JnspFkJ */
"Tue, 28-Jul-87 13:18:57 EDT",
"Version 1.0, built Jul 28 13:18:57 1987.",
"0000000000000000000000000000000000000000",
"master",
"1.0.0-0",
"NetHack Version 1.0.0-0 - last build Tue Jul 28 13:18:57 1987.",
0x01010000UL,
0x00000000UL,
0x00000000UL,
0x00000000UL,
0x00000000UL,
0x00000000UL,
554476737UL,
};
#endif /* CROSSCOMPILE */
#if defined(NETHACK_GIT_SHA)
const char *NetHack_git_sha
#if !defined(CROSSCOMPILE) || !defined(CROSSCOMPILE_TARGET)
= NETHACK_GIT_SHA
#else
#ifdef NETHACK_HOST_GIT_SHA
= NETHACK_HOST_GIT_SHA
#endif
#endif
;
#endif
#if defined(NETHACK_GIT_BRANCH)
const char *NetHack_git_branch
#if !defined(CROSSCOMPILE) || !defined(CROSSCOMPILE_TARGET)
= NETHACK_GIT_BRANCH
#else
#ifdef NETHACK_HOST_GIT_BRANCH
= NETHACK_HOST_GIT_BRANCH
#endif
#endif
;
#ifndef OPTIONS_AT_RUNTIME
#define OPTIONS_AT_RUNTIME
#endif
static void insert_rtoption(char *);
@@ -57,17 +16,16 @@ static void insert_rtoption(char *);
char *
version_string(char *buf)
{
return strcpy(buf, VERSION_STRING);
return strcpy(buf, nomakedefs.version_string);
}
/* fill and return the given buffer with the long nethack version string */
char *
getversionstring(char *buf)
{
Strcpy(buf, VERSION_ID);
Strcpy(buf, nomakedefs.version_id);
#if defined(RUNTIME_PORT_ID) \
|| defined(NETHACK_GIT_SHA) || defined(NETHACK_GIT_BRANCH)
#if defined(RUNTIME_PORT_ID)
{
int c = 0;
#if defined(RUNTIME_PORT_ID)
@@ -82,28 +40,28 @@ getversionstring(char *buf)
#if defined(RUNTIME_PORT_ID)
tmp = get_port_id(tmpbuf);
if (tmp)
Sprintf(eos(buf), "%s%s", c++ ? "," : "", tmp);
Snprintf(eos(buf), (sizeof buf - strlen(buf)) - 1,
"%s%s", c++ ? "," : "", tmp);
#endif
#if defined(NETHACK_GIT_SHA)
if (NetHack_git_sha)
Sprintf(eos(buf), "%s%s", c++ ? "," : "", NetHack_git_sha);
#endif
#if defined(NETHACK_GIT_BRANCH)
if (nomakedefs.git_sha)
Snprintf(eos(buf), (sizeof buf - strlen(buf)) - 1,
"%s%s", c++ ? "," : "", nomakedefs.git_sha);
#if (NH_DEVEL_STATUS != NH_STATUS_RELEASED)
if (NetHack_git_branch)
Sprintf(eos(buf), "%sbranch:%s",
c++ ? "," : "", NetHack_git_branch);
#endif
if (nomakedefs.git_branch)
Snprintf(eos(buf), (sizeof buf - strlen(buf)) - 1,
"%sbranch:%s",
c++ ? "," : "", nomakedefs.git_branch);
#endif
if (c)
Strcat(buf, ")");
Snprintf(eos(buf), (sizeof buf - strlen(buf)) - 1,
"%s", ")");
else /* if nothing has been added, strip " (" back off */
*p = '\0';
if (dotoff)
Strcat(buf, ".");
Snprintf(eos(buf), (sizeof buf - strlen(buf)) - 1,
"%s", ".");
}
#endif /* RUNTIME_PORT_ID || NETHACK_GIT_SHA || NETHACK_GIT_BRANCH */
#endif /* RUNTIME_PORT_ID */
return buf;
}
@@ -148,7 +106,7 @@ doextversion(void)
(const char *) 0
};
#endif /*0*/
#if defined(OPTIONS_AT_RUNTIME) || defined(CROSSCOMPILE_TARGET)
#if defined(OPTIONS_AT_RUNTIME)
use_dlb = FALSE;
#else
done_rt = TRUE;
@@ -267,7 +225,7 @@ early_version_info(boolean pastebuf)
raw_printf("%s", buf);
if (pastebuf) {
#if defined(RUNTIME_PASTEBUF_SUPPORT) && !defined(LIBNH)
#if defined(RUNTIME_PASTEBUF_SUPPORT) && !defined(LIBNH)
/*
* Call a platform/port-specific routine to insert the
* version information into a paste buffer. Useful for
@@ -327,7 +285,7 @@ comp_times(long filetime)
{
/* BUILD_TIME is constant but might have L suffix rather than UL;
'filetime' is historically signed but ought to have been unsigned */
return (boolean) ((unsigned long) filetime < (unsigned long) BUILD_TIME);
return (boolean) ((unsigned long) filetime < (unsigned long) nomakedefs.build_time);
}
#endif
@@ -338,9 +296,9 @@ check_version(struct version_info *version_data, const char *filename,
if (
#ifdef VERSION_COMPATIBILITY
version_data->incarnation < VERSION_COMPATIBILITY
|| version_data->incarnation > VERSION_NUMBER
|| version_data->incarnation > nomakedefs.version_number
#else
version_data->incarnation != VERSION_NUMBER
version_data->incarnation != nomakedefs.version_number
#endif
) {
if (complain)
@@ -348,17 +306,17 @@ check_version(struct version_info *version_data, const char *filename,
return FALSE;
} else if (
#ifndef IGNORED_FEATURES
version_data->feature_set != VERSION_FEATURES
version_data->feature_set != nomakedefs.version_features
#else
(version_data->feature_set & ~IGNORED_FEATURES)
!= (VERSION_FEATURES & ~IGNORED_FEATURES)
(version_data->feature_set & ~nomakedefs.ignored_features)
!= (VERSION_FEATURES & ~nomakedefs.ignored_features)
#endif
|| ((utdflags & UTD_SKIP_SANITY1) == 0
&& version_data->entity_count != VERSION_SANITY1)
&& version_data->entity_count != nomakedefs.version_sanity1)
|| ((utdflags & UTD_CHECKSIZES) &&
(version_data->struct_sizes1 != VERSION_SANITY2))
(version_data->struct_sizes1 != nomakedefs.version_sanity2))
|| ((utdflags & UTD_CHECKSIZES) &&
(version_data->struct_sizes2 != VERSION_SANITY3))) {
(version_data->struct_sizes2 != nomakedefs.version_sanity3))) {
if (complain)
pline("Configuration incompatibility for file \"%s\".", filename);
return FALSE;
@@ -421,23 +379,16 @@ store_formatindicator(NHFILE *nhfp)
void
store_version(NHFILE *nhfp)
{
#if !defined(CROSSCOMPILE) || !defined(CROSSCOMPILE_TARGET)
static const struct version_info version_data = {
VERSION_NUMBER, VERSION_FEATURES,
VERSION_SANITY1, VERSION_SANITY2, VERSION_SANITY3
#else
struct version_info version_data = {
0UL,0UL,0UL,0UL,0Ul
#endif
};
#if defined(CROSSCOMPILE) && defined(CROSSCOMPILE_TARGET)
version_data.incarnation = VERSION_NUMBER; /* actual version number */
version_data.feature_set = VERSION_FEATURES; /* bitmask of config settings */
version_data.entity_count = VERSION_SANITY1; /* # of monsters and objects */
version_data.struct_sizes1 = VERSION_SANITY2; /* size of key structs */
version_data.struct_sizes2 = VERSION_SANITY3; /* size of more key structs */
#endif
version_data.incarnation = nomakedefs.version_number; /* actual version number */
version_data.feature_set = nomakedefs.version_features; /* bitmask of config settings */
version_data.entity_count = nomakedefs.version_sanity1; /* # of monsters and objects */
version_data.struct_sizes1 = nomakedefs.version_sanity2; /* size of key structs */
version_data.struct_sizes2 = nomakedefs.version_sanity3; /* size of more key structs */
if (nhfp->structlevel) {
bufoff(nhfp->fd);
/* bwrite() before bufon() uses plain write() */
@@ -504,10 +455,10 @@ copyright_banner_line(int indx)
if (indx == 2)
return COPYRIGHT_BANNER_B;
#endif
#ifdef COPYRIGHT_BANNER_C
if (indx == 3)
return COPYRIGHT_BANNER_C;
#endif
return nomakedefs.copyright_banner_c;
#ifdef COPYRIGHT_BANNER_D
if (indx == 4)
return COPYRIGHT_BANNER_D;

View File

@@ -383,7 +383,7 @@ RM_H = $(INCL)/align.h $(INCL)/rm.h
SKILLS_H = $(INCL)/skills.h
SP_LEV_H = $(INCL)/align.h $(INCL)/sp_lev.h
YOUPROP_H = $(PERMONST_H) $(MONDATA_H) $(INCL)/prop.h \
$(INCL)/pm.h $(INCL)/youprop.h
$(INCL)/youprop.h
YOU_H = $(MONST_H) $(YOUPROP_H) $(INCL)/align.h \
$(INCL)/attrib.h $(INCL)/you.h
DISPLAY_H = $(MONDATA_H) $(INCL)/vision.h $(INCL)/display.h
@@ -392,7 +392,7 @@ PCCONF_H = $(INCL)/micro.h $(INCL)/system.h $(INCL)/pcconf.h \
CONFIG_H = $(GLOBAL_H) $(INCL)/fnamesiz.h $(INCL)/tradstdc.h \
$(INCL)/config1.h $(INCL)/config.h
DECL_H = $(YOU_H) $(INCL)/spell.h $(INCL)/color.h \
$(INCL)/obj.h $(INCL)/onames.h $(INCL)/pm.h \
$(INCL)/obj.h $(INCL)/objects.h \
$(INCL)/decl.h
GLOBAL_H = $(PCCONF_H) $(INCL)/coord.h $(INCL)/global.h
HACK_H = $(CONFIG_H) $(INCL)/context.h $(DUNGEON_H) \
@@ -547,8 +547,8 @@ default: $(GAMEFILE)
util: $(O)utility.tag
$(O)utility.tag: $(INCL)/date.h $(INCL)/trap.h $(INCL)/onames.h \
$(INCL)/pm.h $(TILEUTIL)
$(O)utility.tag: $(INCL)/date.h $(INCL)/trap.h $(INCL)/objects.h \
$(TILEUTIL)
$(subst /,\,echo utilities made > $@)
tileutil: $(U)gif2txt.exe $(U)txt2ppm.exe

View File

@@ -50,8 +50,8 @@ the file NewInstall.unx.
6. Edit the top sections of the src and util Makefiles. (If you are doing
a full recompile, or if you got your files from someplace besides the
official distribution, type 'touch makedefs.c' to make sure certain files
(onames.h, pm.h) get remade instead of relying on the potentially
troublesome timestamps.) Then type 'make' in src and go get a cup of
get remade instead of relying on the potentially troublesome timestamps.)
Then type 'make' in src and go get a cup of
coffee or take a nap, depending on the speed of your system. You should
now have created the game executable.

View File

@@ -464,7 +464,7 @@ CONFIG_H = ../src/config.h-t
HACK_H = ../src/hack.h-t
# all .c that are part of the main NetHack program and are not operating- or
# windowing-system specific
# windowing-system specific. Do not include date.c in this list.
HACKCSRC = allmain.c alloc.c apply.c artifact.c attrib.c ball.c bones.c \
botl.c cmd.c dbridge.c decl.c detect.c dig.c display.c dlb.c do.c \
do_name.c do_wear.c dog.c dogmove.c dokick.c dothrow.c drawing.c \
@@ -514,7 +514,7 @@ VERSOURCES = $(HACKCSRC) $(SYSSRC) $(WINSRC) $(CHAINSRC) $(GENCSRC)
CSOURCES = $(HACKCSRC) $(SYSCSRC) $(WINCSRC) $(CHAINSRC) $(GENCSRC)
# all .h files except date.h, onames.h, and pm.h which would
# all .h files except date.h, which would
# cause dependency loops if run through "make depend"
# and dgn_file.h, special level & dungeon files.
#
@@ -522,19 +522,22 @@ HACKINCL = align.h artifact.h artilist.h attrib.h botl.h \
color.h config.h config1.h context.h coord.h decl.h \
display.h dlb.h dungeon.h engrave.h extern.h flag.h fnamesiz.h \
func_tab.h global.h warnings.h hack.h lint.h mextra.h mfndpos.h \
micro.h mkroom.h \
monattk.h mondata.h monflag.h monst.h obj.h objclass.h \
optlist.h patchlevel.h pcconf.h permonst.h prop.h rect.h \
region.h sym.h defsym.h rm.h sp_lev.h spell.h sys.h system.h \
tcap.h timeout.h tradstdc.h trap.h unixconf.h vision.h vmsconf.h \
wintty.h wincurs.h winX.h winprocs.h wintype.h you.h youprop.h
micro.h mkroom.h monattk.h mondata.h monflag.h monst.h monsters.h \
obj.h objects.h objclass.h optlist.h patchlevel.h pcconf.h \
permonst.h prop.h rect.h region.h sym.h defsym.h rm.h sp_lev.h \
spell.h sys.h system.h tcap.h timeout.h tradstdc.h trap.h unixconf.h \
vision.h vmsconf.h wintty.h wincurs.h winX.h winprocs.h wintype.h \
you.h youprop.h
HSOURCES = $(HACKINCL) date.h onames.h pm.h dgn_file.h
HSOURCES = $(HACKINCL) dgn_file.h
# the following .o's _must_ be made before any others (for makedefs)
FIRSTOBJ = monst.o objects.o
HOSTOBJ = $(FIRSTOBJ) alloc.o drawing.o
#
# $(TARGETPFX)date.o is not included in this list
#
HOBJ = $(TARGETPFX)allmain.o $(TARGETPFX)alloc.o \
$(TARGETPFX)apply.o $(TARGETPFX)artifact.o $(TARGETPFX)attrib.o \
$(TARGETPFX)ball.o $(TARGETPFX)bones.o $(TARGETPFX)botl.o \
@@ -576,6 +579,9 @@ HOBJ = $(TARGETPFX)allmain.o $(TARGETPFX)alloc.o \
$(TARGETPFX)write.o $(TARGETPFX)zap.o \
$(REGEXOBJ) $(RANDOBJ) $(SYSOBJ) $(WINOBJ) $(HINTOBJ) \
$(TARGETPFX)version.o
#
DATE_O = $(TARGETPFX)date.o
# the .o files from the HACKCSRC, SYSSRC, and WINSRC lists
# first target is also the default target for 'make' without any arguments
@@ -588,40 +594,40 @@ pregame:
$(GAME): pregame $(SYSTEM)
@echo "$(GAME) is up to date."
Sysunix: $(HOSTOBJ) $(HOBJ) $(BUILDMORE) Makefile
Sysunix: $(HOSTOBJ) $(HOBJ) $(DATE_O) $(BUILDMORE) Makefile
@echo "Linking $(GAME)."
$(AT)$(TARGET_LINK) $(TARGET_LFLAGS) -o $(GAMEBIN) \
$(HOBJ) $(WINLIB) $(TARGET_LIBS) $(LUALIB)
$(HOBJ) $(DATE_O) $(WINLIB) $(TARGET_LIBS) $(LUALIB)
@touch Sysunix
Sys3B2: $(HOSTOBJ) $(HOBJ) $(BUILDMORE) Makefile
Sys3B2: $(HOSTOBJ) $(HOBJ) $(DATE_O) $(BUILDMORE) Makefile
@echo "Linking $(GAME)."
$(AT)$(TARGET_LINK) $(TARGET_LFLAGS) -o $(GAMEBIN) \
$(HOBJ) $(WINLIB) $(LUALIB) -lmalloc
$(HOBJ) $(DATE_O) $(WINLIB) $(LUALIB) -lmalloc
@touch Sys3B2
Sysatt: $(HOSTOBJ) $(HOBJ) $(BUILDMORE) Makefile
Sysatt: $(HOSTOBJ) $(HOBJ) $(DATE_O) $(BUILDMORE) Makefile
@echo "Loading $(GAME)."
$(AT)$(LD) $(TARGET_LFLAGS) /lib/crt0s.o /lib/shlib.ifile -o $(GAMEBIN) \
$(HOSTOBJ) $(HOBJ) $(LUALIB)
$(HOSTOBJ) $(HOBJ) $(DATE_O) $(LUALIB)
@touch Sysatt
Systos: $(HOSTOBJ) $(HOBJ) $(BUILDMORE) Makefile
Systos: $(HOSTOBJ) $(HOBJ) $(DATE_O) $(BUILDMORE) Makefile
@echo "Linking $(GAME)."
$(AT)$(TARGET_LINK) $(TARGET_LFLAGS) -o $(GAMEBIN) \
$(HOBJ) $(WINLIB) $(LUALIB)
$(HOBJ) $(DATE_O) $(WINLIB) $(LUALIB)
@touch Systos
SysV-AT: DUMB.Setup $(HOSTOBJ) $(HOBJ) $(BUILDMORE) Makefile
SysV-AT: DUMB.Setup $(HOSTOBJ) $(HOBJ) $(DATE_O) $(BUILDMORE) Makefile
@echo "Linking $(GAME)."
$(AT)$(TARGET_LINK) $(TARGET_LFLAGS) -o $(GAMEBIN) \
$(HOBJ) $(WINLIB) $(LUALIB)
$(HOBJ) $(DATE_O) $(WINLIB) $(LUALIB)
@touch SysV-AT
SysBe: $(HOSTOBJ) $(HOBJ) $(BUILDMORE) Makefile
SysBe: $(HOSTOBJ) $(HOBJ) $(DATE_O) $(BUILDMORE) Makefile
@echo "Linking $(GAME)."
$(AT)$(TARGET_LINK) $(TARGET_LFLAGS) -o $(GAME) \
$(HOBJ) $(WINLIB) $(TARGET_LIBS) $(LUALIB)
$(HOBJ) $(DATE_O) $(WINLIB) $(TARGET_LIBS) $(LUALIB)
@xres -o $(GAME) ../win/BeOS/nethack.rsrc
@mimeset -f $(GAME)
@touch SysBe
@@ -696,11 +702,12 @@ qt_yndlg.moc : ../win/Qt/qt_yndlg.h
# build monst.o and objects.o before executing '$(MAKE) makedefs'
$(MAKEDEFS): $(FIRSTOBJ) \
../util/makedefs.c ../src/mdlib.c $(CONFIG_H) \
../include/permonst.h \
../include/objclass.h ../include/sym.h ../include/defsym.h \
../include/artilist.h ../include/dungeon.h ../include/obj.h \
../include/monst.h ../include/you.h ../include/flag.h \
../include/dlb.h ../include/patchlevel.h
../include/permonst.h ../include/monsters.h \
../include/objclass.h ../include/objects.h ../include/sym.h \
../include/defsym.h ../include/artilist.h \
../include/dungeon.h ../include/obj.h ../include/monst.h \
../include/you.h ../include/flag.h ../include/dlb.h \
../include/patchlevel.h
@( cd ../util ; $(MAKE) makedefs )
# Source files created by 'makedefs' at build time.
@@ -711,18 +718,24 @@ $(MAKEDEFS): $(FIRSTOBJ) \
# process of building it for foo.h.)
../include/onames.h: $(MAKEDEFS)
@( cd ../util ; $(MAKE) ../include/onames.h )
../include/pm.h: $(MAKEDEFS) ../include/onames.h
../include/pm.h: $(MAKEDEFS)
@( cd ../util ; $(MAKE) ../include/pm.h )
# Created at build time for configurations which support tiles,
# but not by makedefs so not connected to the others.
tile.c: ../win/share/tilemap.c $(HACK_H)
@( cd ../util ; $(MAKE) ../src/tile.c )
../win/gnome/gn_rip.h: ../win/X11/rip.xpm
cp ../win/X11/rip.xpm ../win/gnome/gn_rip.h
$(TARGETPFX)sfstruct.o: sfstruct.c $(HACK_H)
# date.c should be recompiled any time any of the source or include code
# is modified.
$(TARGETPFX)date.o: date.c $(HACK_H) $(HACKCSRC) $(HOBJ)
$(TARGET_CC) $(TARGET_CFLAGS) $(GITHASH) $(GITBRANCH) -c -o $@ date.c
# date.h should be remade any time any of the source or include code
# is modified. Unfortunately, this would make the contents of this
# file far more complex. Since "hack.h" depends on most of the include
@@ -731,9 +744,7 @@ $(TARGETPFX)sfstruct.o: sfstruct.c $(HACK_H)
# Do NOT include ../dat/gitinfo.txt as either a prerequisite or target.
# 'makedefs -v' processes it when present and ignores it if not.
#
# hack.h depends on makedefs' output, so we know makedefs will be
# up to date before being executed
../include/date.h: $(VERSOURCES) $(HACK_H)
../include/date.h: ../util/makedefs $(VERSOURCES) $(HACK_H)
-$(SHELL) ../sys/unix/gitinfo.sh $(GITINFO) #before 'makedefs -v'
../util/makedefs -v
@@ -800,14 +811,14 @@ $(HACK_H): ../include/hack.h $(CONFIG_H) ../include/lint.h ../include/align.h \
../include/dungeon.h ../include/mkroom.h \
../include/objclass.h ../include/youprop.h ../include/prop.h \
../include/permonst.h ../include/monattk.h \
../include/monflag.h ../include/mondata.h ../include/pm.h \
../include/monflag.h ../include/mondata.h \
../include/wintype.h ../include/context.h \
../include/sym.h ../include/defsym.h ../include/rm.h \
../include/botl.h ../include/rect.h ../include/region.h \
../include/decl.h ../include/quest.h ../include/spell.h \
../include/color.h ../include/obj.h ../include/engrave.h \
../include/you.h ../include/attrib.h ../include/monst.h \
../include/mextra.h ../include/skills.h ../include/onames.h \
../include/mextra.h ../include/skills.h ../include/monsters.h \
../include/timeout.h ../include/trap.h ../include/flag.h \
../include/vision.h ../include/display.h ../include/winprocs.h \
../include/sys.h
@@ -1097,8 +1108,9 @@ $(TARGETPFX)mondata.o: mondata.c $(HACK_H)
$(TARGETPFX)monmove.o: monmove.c $(HACK_H) ../include/mfndpos.h \
../include/artifact.h
$(TARGETPFX)monst.o: monst.c $(CONFIG_H) ../include/permonst.h \
../include/align.h ../include/monattk.h ../include/monflag.h \
../include/sym.h ../include/defsym.h ../include/color.h
../include/monsters.h ../include/align.h ../include/monattk.h \
../include/monflag.h ../include/sym.h ../include/defsym.h \
../include/color.h
$(TARGETPFX)mplayer.o: mplayer.c $(HACK_H)
$(TARGETPFX)mthrowu.o: mthrowu.c $(HACK_H)
$(TARGETPFX)muse.o: muse.c $(HACK_H)

View File

@@ -179,7 +179,7 @@ CALLOC = ../src/alloc.c panic.c
OALLOC = $(OBJDIR)/alloc.o panic.o
# object files for makedefs
MAKEOBJS = makedefs.o $(OMONOBJ)
MAKEOBJS = makedefs.o $(OMONOBJ) $(OBJDIR)/date.o
# object files for recovery utility
RECOVOBJS = recover.o
@@ -209,17 +209,19 @@ makedefs: $(MAKEOBJS) mdgrep.h
makedefs.o: makedefs.c ../src/mdlib.c $(CONFIG_H) ../include/permonst.h \
../include/objclass.h ../include/sym.h ../include/defsym.h \
../include/artilist.h ../include/dungeon.h ../include/obj.h \
../include/monst.h ../include/you.h ../include/flag.h \
../include/dlb.h ../include/patchlevel.h
../include/monst.h ../include/monsters.h ../include/objects.h \
../include/you.h ../include/flag.h ../include/dlb.h \
../include/patchlevel.h
$(CC) $(CFLAGS) -c makedefs.c -o $@
# Don't require perl to build; that is why mdgrep.h is spelled wrong below.
mdgreph: mdgrep.pl
perl mdgrep.pl
../include/onames.h: makedefs
# These are for reference purposes only. They aren't required in the build.
../include/onames.h: makedefs ../include/objects.h
./makedefs -o
../include/pm.h: makedefs
../include/pm.h: makedefs ../include/monsters.h
./makedefs -p
lintdefs:

View File

@@ -239,7 +239,6 @@
3186A37421A4B0FA0052BF02 /* attrib.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = attrib.h; path = ../../include/attrib.h; sourceTree = "<group>"; };
3186A37521A4B0FA0052BF02 /* patchlevel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = patchlevel.h; path = ../../include/patchlevel.h; sourceTree = "<group>"; };
3186A37621A4B0FA0052BF02 /* wincurs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = wincurs.h; path = ../../include/wincurs.h; sourceTree = "<group>"; };
3186A37721A4B0FA0052BF02 /* pm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = pm.h; path = ../../include/pm.h; sourceTree = "<group>"; };
3186A37921A4B0FA0052BF02 /* monattk.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = monattk.h; path = ../../include/monattk.h; sourceTree = "<group>"; };
3186A37A21A4B0FA0052BF02 /* integer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = integer.h; path = ../../include/integer.h; sourceTree = "<group>"; };
3186A37B21A4B0FA0052BF02 /* region.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = region.h; path = ../../include/region.h; sourceTree = "<group>"; };
@@ -254,7 +253,6 @@
3186A38721A4B0FB0052BF02 /* color.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = color.h; path = ../../include/color.h; sourceTree = "<group>"; };
3186A38821A4B0FB0052BF02 /* artifact.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = artifact.h; path = ../../include/artifact.h; sourceTree = "<group>"; };
3186A38A21A4B0FB0052BF02 /* system.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = system.h; path = ../../include/system.h; sourceTree = "<group>"; };
3186A38B21A4B0FC0052BF02 /* onames.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = onames.h; path = ../../include/onames.h; sourceTree = "<group>"; };
3186A38E21A4B0FC0052BF02 /* dlb.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = dlb.h; path = ../../include/dlb.h; sourceTree = "<group>"; };
3186A38F21A4B0FC0052BF02 /* monflag.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = monflag.h; path = ../../include/monflag.h; sourceTree = "<group>"; };
3186A39121A4B0FC0052BF02 /* micro.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = micro.h; path = ../../include/micro.h; sourceTree = "<group>"; };
@@ -687,11 +685,9 @@
3186A39B21A4B0FD0052BF02 /* windconf.h */,
3186A39521A4B0FC0052BF02 /* obj.h */,
3186A3A821A4B0FD0052BF02 /* objclass.h */,
3186A38B21A4B0FC0052BF02 /* onames.h */,
3186A37521A4B0FA0052BF02 /* patchlevel.h */,
3186A38121A4B0FB0052BF02 /* pcconf.h */,
3186A38321A4B0FB0052BF02 /* permonst.h */,
3186A37721A4B0FA0052BF02 /* pm.h */,
3186A37F21A4B0FA0052BF02 /* prop.h */,
3186A39E21A4B0FD0052BF02 /* quest.h */,
3186A37C21A4B0FA0052BF02 /* rect.h */,

View File

@@ -139,6 +139,16 @@ 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 \

View File

@@ -139,6 +139,16 @@ 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 \

View File

@@ -112,6 +112,10 @@ main(int argc, char *argv[])
if (argcheck(argc, argv, ARG_VERSION) == 2)
exit(EXIT_SUCCESS);
#ifndef NODUMPENUMS
if (argcheck(argc, argv, ARG_DUMPENUMS) == 2)
exit(EXIT_SUCCESS);
#endif
if (argcheck(argc, argv, ARG_SHOWPATHS) == 2) {
#ifdef CHDIR
chdirx((char *) 0, 0);

View File

@@ -172,7 +172,7 @@ HACKCSRC = allmain.c alloc.c apply.c artifact.c attrib.c ball.c bones.c \
# .c files for this version (for date.h)
VERSOURCES = $(HACKCSRC) $(SYSSRC) $(WINSRC) $(RANDSRC) $(GENCSRC)
# all .h files except date.h, onames.h, pm.h, which would
# all .h files except date.h which would
# cause dependency loops if run through "make depend"
#
HACKINCL = align.h artifact.h artilist.h attrib.h color.h \
@@ -386,7 +386,7 @@ spotless : clean
# config.h timestamp
$(CONFIG_H) : $(INC)config.h $(INC)config1.h $(INC)tradstdc.h $(INC)global.h \
$(INC)coord.h $(INC)vmsconf.h $(INC)system.h $(INC)unixconf.h \
$(INC)micro.h $(INC)pcconf.h $(INC)windconf.h
$(INC)micro.h $(INC)pcconf.h $(INC)windconf.h $(INC)objects.h
$(TOUCH) $(CONFIG_H)
# hack.h timestamp
$(HACK_H) : $(INC)hack.h $(CONFIG_H) $(INC)align.h \
@@ -398,7 +398,7 @@ $(HACK_H) : $(INC)hack.h $(CONFIG_H) $(INC)align.h \
$(INC)spell.h $(INC)color.h $(INC)obj.h \
$(INC)you.h $(INC)attrib.h $(INC)monst.h \
$(INC)mextra.h $(INC)skills.h \
$(INC)onames.h $(INC)timeout.h $(INC)trap.h \
$(INC)monsters.h $(INC)timeout.h $(INC)trap.h \
$(INC)flag.h $(INC)rm.h $(INC)vision.h \
$(INC)display.h $(INC)engrave.h $(INC)rect.h $(INC)region.h \
$(INC)winprocs.h $(INC)wintty.h $(INC)sys.h

View File

@@ -239,9 +239,9 @@ Setting Up
If you are recompiling after patching your sources, or if you got
your files from somewhere other than the official distribution,
"touch makedefs.c" to ensure that certain files (onames.h and pm.h)
are remade, lest potentially troublesome timestamps fool your make
(or nmake) utility.
"touch makedefs.c" to ensure that certain files are remade,
lest potentially troublesome timestamps fool your make (or nmake)
utility.
Compiling

View File

@@ -36,12 +36,13 @@
#
# There are currently 4 decisions that you can choose to make.
# None of the 4 decisions are absolutely required because defaults are in place:
# 1. Where do you want your build to end up?
# 2. Do you want debug information in the executable?
# 3. Do you want to explicitly override auto-detection of a 32-bit or 64-bit target?
# 4. Do you want to include any optional interfaces in the port?
# 4a) curses
# 4b) Qt
# 1. Do you have git commands in your path and NetHack in a git repository?
# 2. Where do you want your build results to end up?
# 3. Do you want debug information in the executable?
# 4. Do you want to explicitly override auto-detection of a 32-bit or 64-bit target?
# 5. Do you want to include any optional interfaces in the port?
# 5a) curses
# 5b) Qt
#
# Mandatory LUA source Location
#
@@ -277,11 +278,53 @@ O = $(OBJ)/
U = $(UTIL)/
HACKINCL = $(INCL)/align.h $(INCL)/artifact.h $(INCL)/artilist.h \
$(INCL)/attrib.h $(INCL)/botl.h $(INCL)/color.h $(INCL)/config.h \
$(INCL)/config1.h $(INCL)/context.h $(INCL)/coord.h $(INCL)/decl.h \
$(INCL)/display.h $(INCL)/dlb.h $(INCL)/dungeon.h $(INCL)/engrave.h \
$(INCL)/extern.h $(INCL)/flag.h $(INCL)/fnamesiz.h $(INCL)/func_tab.h \
$(INCL)/global.h $(INCL)/warnings.h $(INCL)/hack.h $(INCL)/lint.h \
$(INCL)/mextra.h $(INCL)/mfndpos.h $(INCL)/micro.h $(INCL)/mkroom.h \
$(INCL)/monattk.h $(INCL)/mondata.h $(INCL)/monflag.h $(INCL)/monst.h \
$(INCL)/monsters.h $(INCL)/obj.h $(INCL)/objects.h $(INCL)/objclass.h \
$(INCL)/optlist.h $(INCL)/patchlevel.h $(INCL)/pcconf.h \
$(INCL)/permonst.h $(INCL)/prop.h $(INCL)/rect.h $(INCL)/region.h \
$(INCL)/sym.h $(INCL)/defsym.h $(INCL)/rm.h $(INCL)/sp_lev.h \
$(INCL)/spell.h $(INCL)/sys.h $(INCL)/system.h $(INCL)/tcap.h \
$(INCL)/timeout.h $(INCL)/tradstdc.h $(INCL)/trap.h \
$(INCL)/unixconf.h $(INCL)/vision.h $(INCL)/vmsconf.h \
$(INCL)/wintty.h $(INCL)/wincurs.h $(INCL)/winX.h \
$(INCL)/winprocs.h $(INCL)/wintype.h $(INCL)/you.h \
$(INCL)/youprop.h
# all .c that are part of the main NetHack program and are not operating- or
# windowing-system specific
HACKCSRC = allmain.c alloc.c apply.c artifact.c attrib.c ball.c bones.c \
botl.c cmd.c dbridge.c decl.c detect.c dig.c display.c dlb.c do.c \
do_name.c do_wear.c dog.c dogmove.c dokick.c dothrow.c drawing.c \
dungeon.c eat.c end.c engrave.c exper.c explode.c extralev.c \
files.c fountain.c hack.c hacklib.c \
insight.c invent.c isaac64.c light.c \
lock.c mail.c makemon.c mcastu.c mdlib.c mhitm.c \
mhitu.c minion.c mklev.c mkmap.c mkmaze.c mkobj.c mkroom.c mon.c \
mondata.c monmove.c monst.c mplayer.c mthrowu.c muse.c music.c \
nhlua.c nhlsel.c nhlobj.c o_init.c objects.c objnam.c \
options.c pager.c pickup.c pline.c polyself.c potion.c pray.c \
priest.c quest.c questpgr.c read.c rect.c region.c restore.c \
rip.c rnd.c role.c rumors.c save.c sfstruct.c \
shk.c shknam.c sit.c sounds.c \
sp_lev.c spell.c steal.c steed.c symbols.c sys.c teleport.c \
timeout.c topten.c track.c trap.c u_init.c \
uhitm.c vault.c version.c vision.c weapon.c were.c wield.c \
windows.c wizard.c worm.c worn.c write.c zap.c
#
# Utility Objects.
#
MAKEDEFSOBJS = $(O)makedefs.o $(O)monst.o $(O)objects.o
MAKEDEFSOBJS = $(O)makedefs.o $(O)monst.o $(O)objects.o \
$(O)date.o
RECOVOBJS = $(O)recover.o
@@ -491,21 +534,31 @@ endif
# Header file macros
#==========================================
ifdef GIT_HASH
GITHASH = -DNETHACK_GIT_SHA=\"$(GIT_HASH)\"
endif
ifdef GIT_BRANCH
GITBRANCH = -DNETHACK_GIT_BRANCH=\"$(GIT_BRANCH)\"
endif
CONFIG_H = $(INCL)/config.h $(INCL)/patchlevel.h \
$(INCL)/config1.h $(INCL)/tradstdc.h \
$(INCL)/global.h $(INCL)/fnamesiz.h $(INCL)/coord.h \
$(INCL)/vmsconf.h $(INCL)/system.h $(INCL)/unixconf.h \
$(INCL)/micro.h $(INCL)/pcconf.h $(INCL)/windconf.h
$(INCL)/micro.h $(INCL)/pcconf.h $(INCL)/windconf.h \
$(INCL)/objects.h
HACK_H = $(INCL)/hack.h $(CONFIG_H) $(INCL)/align.h $(INCL)/context.h \
$(INCL)/dungeon.h $(INCL)/sym.h $(INCL)/defsym.h \
$(INCL)/mkroom.h $(INCL)/objclass.h $(INCL)/youprop.h \
$(INCL)/prop.h $(INCL)/permonst.h $(INCL)/monattk.h \
$(INCL)/monflag.h $(INCL)/mondata.h $(INCL)/pm.h \
$(INCL)/monflag.h $(INCL)/mondata.h $(INCL)/monsters.h \
$(INCL)/wintype.h $(INCL)/decl.h $(INCL)/quest.h \
$(INCL)/spell.h $(INCL)/color.h $(INCL)/obj.h \
$(INCL)/objects.h \
$(INCL)/you.h $(INCL)/attrib.h $(INCL)/monst.h $(INCL)/lint.h \
$(INCL)/mextra.h $(INCL)/skills.h $(INCL)/onames.h \
$(INCL)/mextra.h $(INCL)/skills.h \
$(INCL)/timeout.h $(INCL)/trap.h $(INCL)/flag.h \
$(INCL)/rm.h $(INCL)/vision.h $(INCL)/display.h \
$(INCL)/engrave.h $(INCL)/rect.h $(INCL)/region.h \
@@ -805,8 +858,7 @@ recover: $(U)recover.exe
$(O)sp_lev.tag: $(O)utility.tag
$(subst /,\,echo sp_levs done > $(O)sp_lev.tag)
$(O)utility.tag: $(INCL)/date.h $(INCL)/onames.h $(INCL)/pm.h \
$(TILEUTIL16)
$(O)utility.tag: $(TILEUTIL16)
$(subst /,\,@echo utilities made >$@)
@echo utilities made.
@@ -840,11 +892,12 @@ gamedir.tag:
test -d $(GAMEDIR) && echo directory created > $@
$(GAMEDIR)/NetHack.exe : gamedir.tag $(PDCLIB) $(O)tile.o $(O)consoletty.o $(O)guistub.o \
$(ALLOBJ) $(TTYOBJ) $(GUIOBJ) $(O)conres.o $(KEYDLLS) \
$(ALLOBJ) $(TTYOBJ) $(O)date.o $(GUIOBJ) $(O)conres.o $(KEYDLLS) \
$(LUATARGETS)
@echo Linking $@...
$(link) $(lflags) -o$@ $(ALLOBJ) $(TTYOBJ) $(O)consoletty.o $(O)tile.o \
$(O)guistub.o $(O)conres.o $(PDCLIB) $(LUALIB) $(conlibs) -static -lstdc++
$(O)guistub.o $(O)date.o $(O)conres.o $(PDCLIB) $(LUALIB) \
$(conlibs) -static -lstdc++
$(subst /,\,@if exist $(O)install.tag del $(O)install.tag)
# NetHackW
@@ -860,7 +913,8 @@ $(GAMEDIR)/NetHackW.exe : gamedir.tag $(PDCLIB) $(O)tile.o $(O)ttystub.o \
$(ALLOBJ) $(TTYOBJ) $(GUIOBJ) $(O)winres.o $(KEYDLLS) \
$(LUATARGETS)
@echo Linking $@...
$(link) $(lflags) -mwindows -o$@ $(ALLOBJ) $(GUIOBJ) $(O)tile.o $(O)ttystub.o \
$(link) $(lflags) -mwindows -o$@ $(ALLOBJ) $(GUIOBJ) $(O)tile.o \
$(O)ttystub.o $(O)date.o \
$(O)winres.o $(PDCLIB) $(guilibs) $(LUALIB) -static -lstdc++
$(subst /,\,@if exist $(O)install.tag del $(O)install.tag)
endif
@@ -922,9 +976,25 @@ $(O)makedefs.o: $(CONFIG_H) $(INCL)/monattk.h $(INCL)/monflag.h \
$(U)makedefs.c $(SRC)\mdlib.c
$(cc) $(CFLAGSU) -o$@ $(U)makedefs.c
ifeq "$(GIT_AVAILABLE)" "1"
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
endif
$(O)date.o: $(HACKINCL) $(HACKSRC) $(HACKOBJ) $(ALLOBJ)
$(cc) $(CFLAGS) $(GITHASH) $(GITBRANCH) -o$@ $(SRC)/date.c
#
# date.h should be remade every time any of the source or include
# files is modified.
# if you are making date.h for reference purposes (it isn't required
# for the build anymore), it should be remade every time any of the
# source or include files is modified.
#
$(INCL)/date.h $(OPTIONS_FILE): $(U)makedefs.exe
@@ -1453,7 +1523,7 @@ $(O)termcap.o: ../win/tty/termcap.c $(HACK_H) $(INCL)/tcap.h
$(O)topl.o: ../win/tty/topl.c $(HACK_H) $(INCL)/tcap.h
$(cc) $(CFLAGS) -o$@ ../win/tty/topl.c
$(O)wintty.o: ../win/tty/wintty.c $(HACK_H) $(INCL)/dlb.h \
$(INCL)/date.h $(INCL)/tcap.h
$(INCL)/tcap.h
$(cc) $(CFLAGS) -o$@ ../win/tty/wintty.c
#$(O)Window.o: ../win/X11/Window.c $(INCL)/xwindowp.h $(INCL)/xwindow.h \
# $(CONFIG_H)
@@ -1702,7 +1772,7 @@ $(O)trap.o: trap.c $(HACK_H)
$(O)u_init.o: u_init.c $(HACK_H)
$(O)uhitm.o: uhitm.c $(HACK_H)
$(O)vault.o: vault.c $(HACK_H)
$(O)version.o: version.c $(HACK_H) $(INCL)/date.h
$(O)version.o: version.c $(HACK_H)
$(O)vision.o: vision.c $(HACK_H)
$(O)weapon.o: weapon.c $(HACK_H)
$(O)were.o: were.c $(HACK_H)

View File

@@ -1,5 +1,5 @@
# NetHack 3.7 Makefile.msc
# Copyright (c) NetHack PC Development Team 1993-2020
# Copyright (c) NetHack PC Development Team 1993-2021
#
#==============================================================================
# Build Tools Environment
@@ -65,12 +65,14 @@
# none of the 5 decisions are absolutely required because defaults
# are in place:
#
# 1. Where do you want your build results to end up?
# 2. Do you want to include the optional curses port?
# 3. Do you want to include compressed savefile support to
# 1. Do you have git commands in your path and NetHack in a
# git repository?
# 2. Where do you want your build results to end up?
# 3. Do you want to include the optional curses port?
# 4. Do you want to include compressed savefile support to
# transfer compressed savefiles between platforms?
# 4. Do you want debug information in the executable?
# 5. Do you want to explicitly override auto-detection of
# 5. Do you want debug information in the executable?
# 6. Do you want to explicitly override auto-detection of
# a 32-bit or 64-bit target?
#
# Mandatory Lua source Location (not optional)
@@ -82,16 +84,24 @@
#
#------------------------------------------------------------------------------
#==============================================================================
#
#------------------------------------------------------------------------------
# 1. Where do you want the game to be built (which folder)?
# 1. Do you have git commands available and NetHack in a git repository.
# If not, such as if you obtained the NetHack sources in a zip file download,
# set GIT_AVAILABLE = 0
#
GIT_AVAILABLE = 1
#
#------------------------------------------------------------------------------
# 2. Where do you want the game to be built (which folder)?
#
GAMEDIR = ..\binary # Default game build directory
#
#------------------------------------------------------------------------------
# OPTIONAL - Curses window port support
#
# 2. Uncomment these and set them appropriately if you want to
# 3. Uncomment these and set them appropriately if you want to
# include curses port support alongside TTY support in your
# NetHack.exe binary.
#
@@ -100,24 +110,24 @@ GAMEDIR = ..\binary # Default game build directory
# of your PDCurses C files.
#
#ADD_CURSES=Y
#PDCURSES_TOP=..\lib\pdcursesmod
#PDCURSES_TOP=..\lib\pdcurses
#
#------------------------------------------------------------------------------
# OPTIONAL - zlib support (to allow compressed savefile exchange across platforms
#
# 3. Location of zlib sources
# 4. Location of zlib sources
#
#
#ADD_ZLIB=Y
#ZLIBTOP=..\lib\zlib
#
#------------------------------------------------------------------------------
# 4. Do you want debug information available to the executable?
# 5. Do you want debug information available to the executable?
#
DEBUGINFO = Y
#
#------------------------------------------------------------------------------
# 5. This Makefile will attempt to auto-detect your selected target architecture
# 6. This Makefile will attempt to auto-detect your selected target architecture
# based on Visual Studio command prompt configuration settins etc.
# However, if you want to manually override generation of a
# 32-bit or 64-bit build target, you can uncomment the apppropriate
@@ -260,13 +270,55 @@ CROSSCOMPILE_TARGET=
CROSSCOMPILE=
!ENDIF
HACKINCL = $(INCL)\align.h $(INCL)\artifact.h $(INCL)\artilist.h \
$(INCL)\attrib.h $(INCL)\botl.h $(INCL)\color.h $(INCL)\config.h \
$(INCL)\config1.h $(INCL)\context.h $(INCL)\coord.h $(INCL)\decl.h \
$(INCL)\display.h $(INCL)\dlb.h $(INCL)\dungeon.h $(INCL)\engrave.h \
$(INCL)\extern.h $(INCL)\flag.h $(INCL)\fnamesiz.h $(INCL)\func_tab.h \
$(INCL)\global.h $(INCL)\warnings.h $(INCL)\hack.h $(INCL)\lint.h \
$(INCL)\mextra.h $(INCL)\mfndpos.h $(INCL)\micro.h $(INCL)\mkroom.h \
$(INCL)\monattk.h $(INCL)\mondata.h $(INCL)\monflag.h $(INCL)\monst.h \
$(INCL)\monsters.h $(INCL)\obj.h $(INCL)\objects.h $(INCL)\objclass.h \
$(INCL)\optlist.h $(INCL)\patchlevel.h $(INCL)\pcconf.h \
$(INCL)\permonst.h $(INCL)\prop.h $(INCL)\rect.h $(INCL)\region.h \
$(INCL)\sym.h $(INCL)\defsym.h $(INCL)\rm.h $(INCL)\sp_lev.h \
$(INCL)\spell.h $(INCL)\sys.h $(INCL)\system.h $(INCL)\tcap.h \
$(INCL)\timeout.h $(INCL)\tradstdc.h $(INCL)\trap.h \
$(INCL)\unixconf.h $(INCL)\vision.h $(INCL)\vmsconf.h \
$(INCL)\wintty.h $(INCL)\wincurs.h $(INCL)\winX.h \
$(INCL)\winprocs.h $(INCL)\wintype.h $(INCL)\you.h \
$(INCL)\youprop.h
# all .c that are part of the main NetHack program and are not operating- or
# windowing-system specific
HACKCSRC = allmain.c alloc.c apply.c artifact.c attrib.c ball.c bones.c \
botl.c cmd.c dbridge.c decl.c detect.c dig.c display.c dlb.c do.c \
do_name.c do_wear.c dog.c dogmove.c dokick.c dothrow.c drawing.c \
dungeon.c eat.c end.c engrave.c exper.c explode.c extralev.c \
files.c fountain.c hack.c hacklib.c \
insight.c invent.c isaac64.c light.c \
lock.c mail.c makemon.c mcastu.c mdlib.c mhitm.c \
mhitu.c minion.c mklev.c mkmap.c mkmaze.c mkobj.c mkroom.c mon.c \
mondata.c monmove.c monst.c mplayer.c mthrowu.c muse.c music.c \
nhlua.c nhlsel.c nhlobj.c o_init.c objects.c objnam.c \
options.c pager.c pickup.c pline.c polyself.c potion.c pray.c \
priest.c quest.c questpgr.c read.c rect.c region.c restore.c \
rip.c rnd.c role.c rumors.c save.c sfstruct.c \
shk.c shknam.c sit.c sounds.c \
sp_lev.c spell.c steal.c steed.c symbols.c sys.c teleport.c \
timeout.c topten.c track.c trap.c u_init.c \
uhitm.c vault.c version.c vision.c weapon.c were.c wield.c \
windows.c wizard.c worm.c worn.c write.c zap.c
#
# Utility Objects.
#
MAKESRC = $(U)makedefs.c
MAKEDEFSOBJS = $(O)makedefs.o $(O)monst$(HOST).o $(O)objects$(HOST).o
MAKEDEFSOBJS = $(O)makedefs.o $(O)monst$(HOST).o $(O)objects$(HOST).o \
$(O)date.o
RECOVOBJS = $(O)recover.o
@@ -333,6 +385,14 @@ TTYOBJ = $(O)topl.o $(O)getline.o $(O)wintty.o
MDLIB = $(O)mdlib.o
!IFDEF GIT_HASH
GITHASH = -DNETHACK_GIT_SHA=\"$(GIT_HASH)\"
!ENDIF
!IFDEF GIT_BRANCH
GITBRANCH = -DNETHACK_GIT_BRANCH=\"$(GIT_BRANCH)\"
!ENDIF
!IFNDEF ADD_CURSES
CURSESOBJ=
!ELSE
@@ -490,14 +550,14 @@ HACK_H = $(INCL)\hack.h $(CONFIG_H) $(INCL)\lint.h $(INCL)\align.h \
$(INCL)\dungeon.h $(INCL)\mkroom.h \
$(INCL)\objclass.h $(INCL)\youprop.h $(INCL)\prop.h \
$(INCL)\permonst.h $(INCL)\monattk.h \
$(INCL)\monflag.h $(INCL)\mondata.h $(INCL)\pm.h \
$(INCL)\monflag.h $(INCL)\mondata.h \
$(INCL)\wintype.h $(INCL)\context.h \
$(INCL)\sym.h $(INCL)\defsym.h $(INCL)\rm.h \
$(INCL)\botl.h $(INCL)\rect.h \
$(INCL)\region.h $(INCL)\decl.h $(INCL)\quest.h \
$(INCL)\spell.h $(INCL)\color.h $(INCL)\obj.h \
$(INCL)\you.h $(INCL)\attrib.h $(INCL)\monst.h \
$(INCL)\mextra.h $(INCL)\skills.h $(INCL)\onames.h \
$(INCL)\mextra.h $(INCL)\skills.h \
$(INCL)\timeout.h $(INCL)\trap.h $(INCL)\flag.h \
$(INCL)\vision.h $(INCL)\display.h $(INCL)\engrave.h \
$(INCL)\winprocs.h $(INCL)\sys.h $(INCL)\wintty.h
@@ -918,7 +978,7 @@ GAMEOBJ=$(GAMEOBJ:^ =^
$(GAMEDIR)\NetHack.exe : $(O)gamedir.tag $(O)tile.o $(O)consoletty.o $(O)guistub.o \
$(ALLOBJ) $(TTYOBJ) $(O)console.res $(KEYDLLS) \
$(ALLOBJ) $(TTYOBJ) $(O)date.o $(O)console.res $(KEYDLLS) \
$(LUATARGETS) $(PDCLIB)
@if not exist $(GAMEDIR)\*.* mkdir $(GAMEDIR)
@echo Linking $(@:\=/)
@@ -930,6 +990,7 @@ $(GAMEDIR)\NetHack.exe : $(O)gamedir.tag $(O)tile.o $(O)consoletty.o $(O)guistub
$(O)consoletty.o
$(O)tile.o
$(O)guistub.o
$(O)date.o
$(O)console.res
<<
@if exist $(O)install.tag del $(O)install.tag
@@ -943,7 +1004,7 @@ $(GAMEDIR)\NetHack.exe : $(O)gamedir.tag $(O)tile.o $(O)consoletty.o $(O)guistub
# objs: $(GAMEOBJ) $(GUIOBJ) $(O)tile.o $(O)ttystub.o
$(GAMEDIR)\NetHackW.exe : $(O)gamedir.tag $(O)tile.o $(O)ttystub.o \
$(ALLOBJ) $(GUIOBJ) $(O)NetHackW.res \
$(ALLOBJ) $(GUIOBJ) $(O)date.o $(O)NetHackW.res \
$(O)gamedir.tag $(KEYDLLS) \
$(LUATARGETS)
@if not exist $(GAMEDIR)\*.* mkdir $(GAMEDIR)
@@ -955,6 +1016,7 @@ $(GAMEDIR)\NetHackW.exe : $(O)gamedir.tag $(O)tile.o $(O)ttystub.o \
$(GUIOBJ)
$(O)tile.o
$(O)ttystub.o
$(O)date.o
$(O)NetHackW.res
<<
@@ -1050,8 +1112,7 @@ recover: $(U)recover.exe
$(O)sp_lev.tag:
echo sp_levs done > $(O)sp_lev.tag
$(O)utility.tag: $(INCL)\nhlua.h $(INCL)\date.h $(INCL)\onames.h $(INCL)\pm.h \
$(U)tile2bmp.exe
$(O)utility.tag: $(INCL)\nhlua.h $(U)tile2bmp.exe $(U)makedefs.exe
@echo utilities made >$@
@echo utilities made.
@@ -1104,6 +1165,34 @@ $(O)makedefs.o: $(U)makedefs.c $(SRC)\mdlib.c $(CONFIG_H) $(INCL)\permonst.h \
@$(cc) -DENUM_PM $(cflagsBuild) $(CROSSCOMPILE) -Fo$@ $(U)makedefs.c
# @$(cc) -DENUM_PM $(cflagsBuild) $(CROSSCOMPILE) /EP -Fo$@ $(U)makedefs.c >makedefs.c.preprocessed
#
# This is awful, but it allows the GITHASH and GITBRANCH macros to be
# defined and utilized, using only build-in Windows and nmake commands,
# as well as the necessary git commands.
#
# We build a temporary Makefile on-the-fly for compiling date.c and
# invoke nmake again.
#
$(O)date.o: $(HACKINCL) $(HACKSRC) $(HACKOBJ) $(ALLOBJ)
!IF "$(GIT_AVAILABLE)" == "1"
@git rev-parse --verify HEAD 2>&1 >$(O)date1.tmp
@git rev-parse --abbrev-ref HEAD 2>&1 >$(O)date2.tmp
@echo.>date.nmk
@echo OBJ = $(OBJ)>>date.nmk
@echo O = ^$(OBJ)^^^\>>date.nmk
@echo cc = $(cc)>>date.nmk
@echo cflagsBuild = $(cflagsBuild) ^\>>date.nmk
@for /F "usebackq" %%A IN ("$(O)date1.tmp") DO @echo. -DNETHACK_GIT_SHA=\"%%A\" ^\>>date.nmk
@for /F "usebackq" %%A IN ("$(O)date2.tmp") DO @echo. -DNETHACK_GIT_BRANCH=\"%%A\">>date.nmk
@echo.>>date.nmk
@echo default: ^$(O)date.o>>date.nmk
@echo.>>date.nmk
@echo ^$(O)date.o: >>date.nmk
@echo. ^$(cc) ^$(cflagsBuild) -Fo^$@ date.c>>date.nmk
@echo.>>date.nmk
@$(MAKE) /NOLOGO /A -f date.nmk
!ENDIF
#
# date.h should be remade every time any of the source or include
# files is modified.
@@ -1349,7 +1438,7 @@ $(O)tilete32.o: $(WSHR)\tiletext.c $(CONFIG_H) $(TILE_H)
#==========================================
$(U)gif2txt.exe: $(GIFREADERS_HOST) $(TEXT_IO)
@echo Linking $(@:\=/)
@echo Linking $(@:\=/)
@$(link) $(lflagsBuild) /PDB:"$(O)$(@B).PDB" /MAP:"$(O)$(@B).MAP" -out:$@ @<<$(@B).lnk
$(GIFREADERS_HOST:^ =^
)
@@ -1358,7 +1447,7 @@ $(U)gif2txt.exe: $(GIFREADERS_HOST) $(TEXT_IO)
<<
$(U)gif2tx32.exe: $(GIFREADERS32_HOST) $(TEXT_IO32)
@echo Linking $(@:\=/)
@echo Linking $(@:\=/)
@$(link) $(lflagsBuild) /PDB:"$(O)$(@B).PDB" /MAP:"$(O)$(@B).MAP" -out:$@ @<<$(@B).lnk
$(GIFREADERS32_HOST:^ =^
)
@@ -1367,7 +1456,7 @@ $(U)gif2tx32.exe: $(GIFREADERS32_HOST) $(TEXT_IO32)
<<
$(U)txt2ppm.exe: $(PPMWRITERS) $(TEXT_IO)
@echo Linking $(@:\=/)
@echo Linking $(@:\=/)
@$(link) $(lflagsBuild) /PDB:"$(O)$(@B).PDB" /MAP:"$(O)$(@B).MAP" -out:$@ @<<$(@B).lnk
$(PPMWRITERS:^ =^
)
@@ -1380,7 +1469,7 @@ $(SRC)\tiles.bmp: $(U)tile2bmp.exe $(TILEFILES)
@$(U)tile2bmp $@
$(U)tile2bmp.exe: $(O)tile2bmp.o $(TEXT_IO)
@echo Linking $(@:\=/)
@echo Linking $(@:\=/)
@$(link) $(lflagsBuild) /PDB:"$(O)$(@B).PDB" /MAP:"$(O)$(@B).MAP" -out:$@ @<<$(@B).lnk
$(O)tile2bmp.o
$(TEXT_IO:^ =^
@@ -1388,7 +1477,7 @@ $(U)tile2bmp.exe: $(O)tile2bmp.o $(TEXT_IO)
<<
$(U)til2bm32.exe: $(O)til2bm32.o $(TEXT_IO32)
@echo Linking $(@:\=/)
@echo Linking $(@:\=/)
@$(link) $(lflagsBuild) /PDB:"$(O)$(@B).PDB" /MAP:"$(O)$(@B).MAP" -out:$@ @<<$(@B).lnk
$(O)til2bm32.o
$(TEXT_IO32:^ =^
@@ -1420,10 +1509,10 @@ $(O)tile2x11.o: $(X11)\tile2x11.c $(HACK_H) $(TILE_H) $(INCL)\tile2x11.h
$(SRC)\x11tiles: $(U)tile2x11.exe $(WSHR)\monsters.txt $(WSHR)\objects.txt \
$(WSHR)\other.txt \
$(WSHR)\monsters.txt
$(WSHR)\monsters.txt
$(U)tile2x11 $(WSHR)\monsters.txt $(WSHR)\objects.txt \
$(WSHR)\other.txt \
-grayscale $(WSHR)\monsters.txt
-grayscale $(WSHR)\monsters.txt
#===============================================================================
# PDCurses
@@ -1587,11 +1676,13 @@ $(O)monst.o: monst.c $(CONFIG_H) $(INCL)\permonst.h $(INCL)\align.h \
$(O)objects_host.o: objects.c $(CONFIG_H) $(INCL)\obj.h $(INCL)\objclass.h \
$(INCL)\prop.h $(INCL)\skills.h $(INCL)\color.h
@$(cc) $(cflagsBuild) $(CROSSCOMPILE) $(CROSSCOMPILE_TARGET) -Fo$@ objects.c
@$(cc) $(cflagsBuild) $(CROSSCOMPILE) $(CROSSCOMPILE_TARGET) /EP $(@B).c > $(O)$(@B).c.preproc
@$(cc) $(cflagsBuild) $(CROSSCOMPILE) $(CROSSCOMPILE_TARGET) -Fo$@ $(@B).c
$(O)objects.o: objects.c $(CONFIG_H) $(INCL)\obj.h $(INCL)\objclass.h \
$(INCL)\prop.h $(INCL)\skills.h $(INCL)\color.h
@$(cc) $(cflagsBuild) -Fo$@ objects.c
@$(cc) $(cflagsBuild) /EP $(@B).c > $(O)$(@B).c.preproc
@$(cc) $(cflagsBuild) -Fo$@ $(@B).c
$(O)alloc_host.o: alloc.c $(CONFIG_H)
@$(cc) $(cflagsBuild) $(CROSSCOMPILE) $(CROSSCOMPILE_TARGET) -Fo$@ alloc.c
@@ -1948,6 +2039,8 @@ $(O)wc_chainout.o: ..\win\chain\wc_chainout.c $(HACK_H)
$(O)wc_trace.o: ..\win\chain\wc_trace.c $(HACK_H) $(INCL)\func_tab.h
# @$(cc) $(cflagsBuild) -Fo$@ ..\win\chain\wc_trace.c
$(O)allmain.o: allmain.c $(HACK_H)
@$(cc) $(cflagsBuild) /EP $(@B).c > $(O)$(@B).c.preproc
@$(cc) $(cflagsBuild) -Fo$@ $(@B).c
$(O)alloc.o: alloc.c $(CONFIG_H)
$(O)apply.o: apply.c $(HACK_H)
$(O)artifact.o: artifact.c $(HACK_H) $(INCL)\artifact.h $(INCL)\artilist.h
@@ -2064,7 +2157,7 @@ $(O)trap.o: trap.c $(HACK_H)
$(O)u_init.o: u_init.c $(HACK_H)
$(O)uhitm.o: uhitm.c $(HACK_H)
$(O)vault.o: vault.c $(HACK_H)
$(O)version.o: version.c $(HACK_H) $(INCL)\dlb.h $(INCL)\date.h
$(O)version.o: version.c $(HACK_H) $(INCL)\dlb.h
@$(cc) $(cflagsBuild) $(CROSSCOMPILE) $(CROSSCOMPILE_TARGET) -Fo$@ version.c
$(O)vision.o: vision.c $(HACK_H)
$(O)weapon.o: weapon.c $(HACK_H)

View File

@@ -219,10 +219,8 @@
<ClInclude Include="$(IncDir)windconf.h" />
<ClInclude Include="$(IncDir)obj.h" />
<ClInclude Include="$(IncDir)objclass.h" />
<ClInclude Include="$(IncDir)onames.h" />
<ClInclude Include="$(IncDir)patchlevel.h" />
<ClInclude Include="$(IncDir)permonst.h" />
<ClInclude Include="$(IncDir)pm.h" />
<ClInclude Include="$(IncDir)prop.h" />
<ClInclude Include="$(IncDir)quest.h" />
<ClInclude Include="$(IncDir)rect.h" />

View File

@@ -244,12 +244,10 @@
<ClInclude Include="$(IncDir)windconf.h" />
<ClInclude Include="$(IncDir)obj.h" />
<ClInclude Include="$(IncDir)objclass.h" />
<ClInclude Include="$(IncDir)onames.h" />
<ClInclude Include="$(IncDir)optlist.h" />
<ClInclude Include="$(IncDir)patchlevel.h" />
<ClInclude Include="$(IncDir)pcconf.h" />
<ClInclude Include="$(IncDir)permonst.h" />
<ClInclude Include="$(IncDir)pm.h" />
<ClInclude Include="$(IncDir)prop.h" />
<ClInclude Include="$(IncDir)quest.h" />
<ClInclude Include="$(IncDir)rect.h" />

View File

@@ -6,8 +6,6 @@
<Defs Include = "$(IncDir)date.h"/>
<!-- -o -->
<Defs Include = "$(IncDir)onames.h"/>
<!-- -p -->
<Defs Include = "$(IncDir)pm.h"/>
<!-- -r -->
<Defs Include = "$(DatDir)rumors"/>
<!-- -s -->

View File

@@ -55,9 +55,7 @@
<ClInclude Include="$(IncDir)windconf.h" />
<ClInclude Include="$(IncDir)obj.h" />
<ClInclude Include="$(IncDir)objclass.h" />
<ClInclude Include="$(IncDir)onames.h" />
<ClInclude Include="$(IncDir)permonst.h" />
<ClInclude Include="$(IncDir)pm.h" />
<ClInclude Include="$(IncDir)prop.h" />
<ClInclude Include="$(IncDir)quest.h" />
<ClInclude Include="$(IncDir)rect.h" />

View File

@@ -648,6 +648,11 @@ process_options(int argc, char * argv[])
reveal_paths();
nethack_exit(EXIT_SUCCESS);
}
#ifndef NODUMPENUMS
if (argcheck(argc, argv, ARG_DUMPENUMS) == 2) {
nethack_exit(EXIT_SUCCESS);
}
#endif
if (argcheck(argc, argv, ARG_DEBUG) == 1) {
argc--;
argv++;

View File

@@ -539,9 +539,4 @@ xexit(int retcd)
/*NOTREACHED*/
}
#ifdef AMIGA
#include "date.h"
const char amiga_version_string[] = AMIGA_VERSION_STRING;
#endif
/*dlb_main.c*/

View File

@@ -108,7 +108,10 @@ static const char
*Dont_Edit_Code =
"/* This source file is generated by 'makedefs'. Do not edit. */\n",
*Dont_Edit_Data =
"#\tThis data file is generated by 'makedefs'. Do not edit. \n";
"#\tThis data file is generated by 'makedefs'. Do not edit. \n",
*Reference_file =
"/* This file is generated by 'makedefs' for reference purposes only. */\n"
"/* It is no longer used in the NetHack build. */\n";
static struct version_info version;
@@ -451,7 +454,7 @@ do_ext_makedefs(int argc, char **argv)
delim[0] = '\0';
if (argv[0])
strcpy(delim, argv[0]);
Fprintf(stdout, "%s", version_string(buf, delim));
Fprintf(stdout, "%s", mdlib_version_string(buf, delim));
exit(EXIT_SUCCESS);
}
IS_OPTION("debug") {
@@ -1105,7 +1108,7 @@ do_date(void)
/* NB: We've moved on from SCCS, but this way this line
* won't get clobbered when downstream projects import
* this file into something more modern. */
Fprintf(ofp, "%s", Dont_Edit_Code);
Fprintf(ofp, "%s", Reference_file);
(void) time(&clocktim);
#ifdef REPRODUCIBLE_BUILD
@@ -1226,11 +1229,11 @@ do_date(void)
#endif /* !__EMSCRIPTEN__ */
Fprintf(ofp, "\n");
Fprintf(ofp, "#define VERSION_STRING \"%s\"\n", version_string(buf, "."));
Fprintf(ofp, "#define VERSION_STRING \"%s\"\n", mdlib_version_string(buf, "."));
Fprintf(ofp, "#define VERSION_ID \\\n \"%s\"\n",
version_id_string(buf, cbuf));
version_id_string(buf, sizeof buf, cbuf));
Fprintf(ofp, "#define COPYRIGHT_BANNER_C \\\n \"%s\"\n",
bannerc_string(buf, cbuf));
bannerc_string(buf, sizeof buf, cbuf));
if (get_gitinfo(githash, gitbranch)) {
Fprintf(ofp, "#define NETHACK_GIT_SHA \"%s\"\n", githash);
Fprintf(ofp, "#define NETHACK_GIT_BRANCH \"%s\"\n", gitbranch);
@@ -1947,7 +1950,7 @@ do_permonst(void)
perror(filename);
exit(EXIT_FAILURE);
}
Fprintf(ofp, "%s", Dont_Edit_Code);
Fprintf(ofp, "%s", Reference_file);
Fprintf(ofp, "#ifndef PM_H\n#define PM_H\n");
if (use_enum) {
@@ -2030,7 +2033,7 @@ do_objs(void)
perror(filename);
exit(EXIT_FAILURE);
}
Fprintf(ofp, "%s", Dont_Edit_Code);
Fprintf(ofp, "%s", Reference_file);
Fprintf(ofp, "#ifndef ONAMES_H\n#define ONAMES_H\n\n");
for (i = 0; !i || objects[i].oc_class != ILLOBJ_CLASS; i++) {

View File

@@ -444,11 +444,6 @@ exepath(char *str)
}
#endif /* EXEPATH */
#ifdef AMIGA
#include "date.h"
const char amiga_version_string[] = AMIGA_VERSION_STRING;
#endif
#ifdef WIN_CE
void
nhce_message(FILE *f, const char *str, ...)

View File

@@ -1,3 +1,4 @@
/* vim:set cin ft=c sw=4 sts=4 ts=8 et ai cino=Ls\:0t0(0 : -*- mode:c;fill-column:80;tab-width:8;c-basic-offset:4;indent-tabs-mode:nil;c-file-style:"k&r" -*-*/
/* NetHack 3.7 cursmain.c */
/* Copyright (c) Karl Garrison, 2010. */
@@ -189,14 +190,22 @@ curses_init_nhwindows(int *argcp UNUSED,
# ifdef VERSION_STRING
sprintf(window_title, "%s %s", DEF_GAME_NAME, VERSION_STRING);
# else
sprintf(window_title, "%s", DEF_GAME_NAME);
if (nomakedefs.version_string)
sprintf(window_title, "%s %s", DEF_GAME_NAME,
nomakedefs.version_string);
else
sprintf(window_title, "%s", DEF_GAME_NAME);
# endif
/* VERSION_STRING */
# else
# ifdef VERSION_STRING
sprintf(window_title, "%s %s", "NetHack", VERSION_STRING);
# else
sprintf(window_title, "%s", "NetHack");
if (nomakedefs.version_string)
sprintf(window_title, "%s %s", "NetHack",
nomakedefs.version_string);
else
sprintf(window_title, "%s", "NetHack");
# endif
/* VERSION_STRING */
# endif/* DEF_GAME_NAME */

View File

@@ -9,10 +9,10 @@
*/
#include "config.h"
#include "pm.h"
#include "onames.h"
/* #include "onames.h" */
#include "permonst.h"
#include "objclass.h"
/* #include "pm.h" */
#include "sym.h"
#include "rm.h"
#include "display.h"

View File

@@ -4,11 +4,7 @@
#include "winMS.h"
#include <commdlg.h>
#if !defined(CROSSCOMPILE)
#include "date.h"
#else
#include "config.h"
#endif
#if !defined(PATCHLEVEL_H)
#include "patchlevel.h"
#endif
@@ -1071,7 +1067,7 @@ About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
Sprintf(buf, "%s\n%s\n%s\n%s",
COPYRIGHT_BANNER_A, COPYRIGHT_BANNER_B,
COPYRIGHT_BANNER_C, COPYRIGHT_BANNER_D);
nomakedefs.copyright_banner_c, COPYRIGHT_BANNER_D);
SetDlgItemText(hDlg, IDC_ABOUT_COPYRIGHT,
NH_A2W(buf, wbuf, sizeof(wbuf)));

View File

@@ -8,11 +8,7 @@
#include "mhsplash.h"
#include "mhmsg.h"
#include "mhfont.h"
#if !defined(CROSSCOMPILE)
#include "date.h"
#else
#include "config.h"
#endif
#if !defined(VERSION_MAJOR)
#include "patchlevel.h"
#endif
@@ -149,7 +145,7 @@ mswin_display_splash_window(BOOL show_ver)
/* Fill the text control */
strbuf_reserve(&strbuf, BUFSIZ);
Sprintf(strbuf.str, "%s\n%s\n%s\n%s\n\n", COPYRIGHT_BANNER_A,
COPYRIGHT_BANNER_B, COPYRIGHT_BANNER_C, COPYRIGHT_BANNER_D);
COPYRIGHT_BANNER_B, nomakedefs.copyright_banner_c, COPYRIGHT_BANNER_D);
if (show_ver) {
/* Show complete version information */