Expand the use of the sys/unix Makefiles to be used for both normal
local builds and installs, as well as cross-compiles for other
platforms/targets.
Up until now, the primary unix Makefiles have treated util/host-side
component compiles, links and target object files just the same as
the game component compiles, links, and target object files.
Unfortunately, that meant that cross-compile effort typically had
to re-invent Makefiles specific to the cross-compile, creating a
maintenance burden and deviation from the typical local unix build
and providing a daunting obstacle to those that want to establish
build for a target environment/platform.
This change distinguishes between util/host-side component builds,
links, and component builds and targets object files destined for
the game (and other target platforms) in the Makefiles.
In theory, this will ease the effort for people that want to try to
resurrect NetHack perhaps on an old platform where it is no longer
viable to build NetHack-3.7 on the platform itself using old, outdated
compile tools, possibly with an old, outdated C dialect.
Some details:
- Game-related targets in the Makefiles (as opposed to util/host-side
targets that will be executed on the host), which could be destined
for another platform in a cross-compile scenario are prefixed with
$(TARGETPFX) so that they are distinguished.
The default scenario where no cross-compiler is involved, is to
define TARGETPFX to nothing, and therefore meant to have no effect.
- Game-related compile and link commands in the Makefiles and their
associated command line flags are distinguished from util/host-side
compile and link commands in the Makefiles by using $(TARGET_CC),
$(TARGET_CFLAGS), $(TARGET_LINK), $(TARGET_LFLAGS), $(TARGET_CXX),
$(TARGET_CXXFLAGS), $(TARGET_LIBS).
Those are used in the Makefile in place of $(CC), $(CFLAGS), $(LINK),
$(LFLAGS), $(CXX), $(CXXFLAGS), $(LIBS).
The default scenario where no cross-compiler is involved, defines
the TARGET_ version of those Makefile variables to match their
typical non-TARGET_ ounterparts.
- The dependency lists in the Makefiles includes the $(TARGETPFX)
prefix for stuff that would potentially be produced from a
cross-compile build.
- It adds pregame targets and $(PREGAME) variable, so that hints files
can add some additional stuff if required for a cross-compile
scenario.
The default scenario where no cross-compiler is involved doesn't
do anything for $(PREGAME).
- It adds $(BUILDMORE) target and variable, so that hints files
can add some additional things to be built for a cross-compile
scenario.
- It adds a "package" target and $(PACKAGE) variable, so that hints files
can add steps for the target platform in a cross-compile
scenario.
The "install" target assumes local build and placement and
isn't really applicable to a cross-compile scenario where the results
really just need to be bundled up for transport to the target platform.
- Also, this adds a pair of include files that can be updated with some
cross-compile recipes as they evolve. They are named "cross-pre.2020"
(for stuff to be included in the PRE section) and "cross-post.2020"
for stuff to be included in the POST section via sys/unix/setup.sh.
Those are included in sys/unix/hints/linux.2020 and
sys/unix/hints/macOS.2020 hints files.
Also remove redundant prototype of has_color in wintty.h now that
it is in extern.h.
has_color() became an actual function when an array of color capabilities
got added to the windowport interface a while back (it checks that array).
Some port of yacc was generating '#include <stdlib.h>' before our
'#include "config.h" and needed a specific define from config1.h to
be supplied on the command line to avoid conflicting contents within
that header file, but then config1.h drew complaints about redefining
the macro. Guard against that.
Suppress Isaac64 on VAX were there isn't an easy way to do 64-bit
arithmetic. (Hard way isn't worth it for just an alternate RNG.)
Eliminate or suppress some diagnostics:
1) In strict ANSI mode, DEC C was reporting that '$' in identifier is
an extension (one time for each file in sys/vms/*.c). (It doesn't do
that for the default 'relaxed ANSI' mode.)
2) DEC C uses WIDENED_PROTOTYPES but widens uchar (unsigned char)
differently depending upon the mode it is operating in. (Applies to
Unix as well as VMS; based on documentation rather than testing.)
Update the comment in tradstdc.h about WIDENED vs UNWIDENED_PROTOTYPES.
An old comment in config1.h about a problem with the earliest version
of DEC C was probably based on an incorrect assumption of what was
really going, but I have no way to go back in time to verify that....
I did my best to exempt some of the bigger aligned blocks from the reformatting
using the /* clang-format off */ and /* clang-format on */ tags. Probably some
that shouldn't have been formatted were anyway; if you encounter them, please
fix.
The clang-format tags were left in on the basis that it's much easier to prune
those out later than to put them back in, and it means that, modulo my custom
version of clang-format, I should be able to run clang-format on the source tree
again without changing anything, now that Pat has fixed the VA_DECL issues.
I hadn't tried the build script vmsbuild.com in a long time....
vmsbuild.com wasn't compiling src/sys.c;
vmsbuild.com and Makefile.src+Makefile.utl had some linking discrepancies;
Makefile.top, Makefile.dat, Makefile.doc - replace old SCCS id/date/rev
comment with current cvs one (done for .src & .utl a month or so back);
config1.h - running DEC C in VAX C compatability mode to test linking
yielded a diagnostic about signed in the schar typedef for every file.
MAC is defined for MacOS 9 but not for 10 (and it shouldn't be). Add a MACOSX
define and use it in eat.c to pick up the joke meant for all Mac systems.
Reported on RH 7.2 and 8.0. Compilation failed because system headers that
needed _GNU_SOURCE on these Redhat versions got included before it was
defined. To ensure _GNU_SOURCE is defined, added an autodetect for it to
config1.h and removed the need to set it in unixres.c. __linux__ is also
checked elsewhere.
- B1026 [confirmed] win32: setting multiple options
- bugfix: menu: set focus to the item and make it visible when it is
selected with accelerator key.
- increased menu font size by 1 point
- layout the main window on WM_MOVE message so the menu windows stays with
the main window (it was not changing the location before)
- got rid of WinCE specific define (ARM)
- handle all keyboard input via WM_KEYDOWN instead WM_CHAR
Files affected: config1.h mhmsg.h mhmain.c mhmenu.c mswproc.c resource.h
winhack.rc
Notes:
That overrides Yitzhak's mhmenu patch - I don't like the menu prompt on the
title bar since it can be null and in most cases it is. It looks much better
as a header column in the list and is displayed only if present.
I moved ARM-related (processor) defines to wceconf.h You cannot undef ARM
before windows.h is processed - ARM version won't compile.
.rc files are generated by IDE - you cannot edit them directly or your
changes will be gone next time the file is saved. If anything needs to be
added to winhack.rc file manually it has to be marked by the following
defines or via menu option View->Resource Includes:
#define APSTUDIO_READONLY_SYMBOLS
...
#undef APSTUDIO_READONLY_SYMBOLS
* Updated preprocessor conditionals for the MPW compilers.
* Use new system call names provided for in the latest Apple
Universal Headers.
* Tune up some of the includes for CodeWarrior.
* Define YY_NEVER_INTERACTIVE for the dungeon and level compilers.
* Remove pointless debugging code.