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:
@@ -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*/
|
||||
|
||||
@@ -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++) {
|
||||
|
||||
@@ -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, ...)
|
||||
|
||||
Reference in New Issue
Block a user