rename sys/windows/Makefile.mingw32 to GNUmakefile

GNU make looks first for a file called GNUmakefile, ahead of
looking for Makefile and then makefile.

Renaming sys/windows/Makefile.mingw32 to sys/windows/GNUmakefile
allows:

o src/GNUmakefile (for use by GNU make) and src/Makefile (for use
  Microsoft nmake) to both reside in the src folder during build.

o src/GNUmakefile will be used by GNU make, without having to
  explicitly specify "-f GNUmakefile" on the GNU make command line.

o src/Makefile will be used by Microsoft nmake, without having to
  explicitly specify "-f Makefile" on the Microsoft nmake command line.

For the gcc build, the movemement of sys/windows/GNUmakefile needs
to be copied to src/GNUmakefile as part of the build process (see
sys/windows/build-msys2.txt).

For the Microsoft Visual Studio command line build with nmake,
sys/windows/Makefile.nmake needs to be copied to src/Makefile as
part of the build process (see sys/windows/build-nmake.txt).

They are both copied to the src folder from their respective
repository source file names when the nhsetup.bat file is used.
This commit is contained in:
nhmall
2024-12-02 19:04:08 -05:00
parent 1301234039
commit fec6320e68
12 changed files with 45 additions and 44 deletions

View File

@@ -164,10 +164,10 @@ steps:
export
cd ../src
pwd
cp ../sys/windows/Makefile.mingw32* .
mingw32-make -f Makefile.mingw32 CI_COMPILER=1 GIT=1 MSYSTEM=$MSYSTEM LUA_VERSION=$LUA_VERSION clean
mingw32-make -f Makefile.mingw32 CI_COMPILER=1 GIT=1 MSYSTEM=$MSYSTEM LUA_VERSION=$LUA_VERSION depend
mingw32-make -f Makefile.mingw32 CI_COMPILER=1 GIT=1 MSYSTEM=$MSYSTEM LUA_VERSION=$LUA_VERSION
cp ../sys/windows/GNUmakefile* .
mingw32-make -f GNUmakefile CI_COMPILER=1 GIT=1 MSYSTEM=$MSYSTEM LUA_VERSION=$LUA_VERSION clean
mingw32-make -f GNUmakefile CI_COMPILER=1 GIT=1 MSYSTEM=$MSYSTEM LUA_VERSION=$LUA_VERSION depend
mingw32-make -f GNUmakefile CI_COMPILER=1 GIT=1 MSYSTEM=$MSYSTEM LUA_VERSION=$LUA_VERSION
condition: eq( variables.toolchain, 'mingw' )
workingDirectory: $(Agent.BuildDirectory)/$(netHackPath)/src
displayName: 'MinGW Build'

View File

@@ -2863,9 +2863,8 @@ use %lu, not %d, in format string in timer_sanity_check() (pr #617 by argrath)
bad cast making sp_lev chameleon light source (pr #625 by entrez)
add Ray Chason's adaptation of nethack's Qt5 interface to work with Qt6 (issue
#525 followup comment by chasonr)
mingw32 build updates and replacement of sys/windows/Makefile.gcc with new
sys/windows/Makefile.mingw32 and sys/windows/Makefile.mingw32.depend
(pr #661 by feiyunw)
mingw32 build updates to replace contents of sys/windows/GNUmakefile and new
sys/windows/GNUmakefile.depend (pr #661 by feiyunw)
mark various pointers to const char as const pointers (pr #624 by argrath)
function fill_special_room() in sp_lev.c was dereferencing a pointer
argument prior to a subsequent check for a NULL pointer that

View File

@@ -508,8 +508,8 @@ use the following guidelines:
Windows with Visual studio nmake at the command
line.
sys/windows/Makefile.mingw32
sys/windows/Makefile.mingw32.depend
sys/windows/GNUmakefile
sys/windows/GNUmakefile.depend
Will require updates in order to build on
Windows with mingw32 or MSYS2 using GNU make at

View File

@@ -107,11 +107,6 @@ extern char *windows_exepath(void);
#ifdef strcasecmp
#undef strcasecmp
/* https://sourceforge.net/p/mingw-w64/wiki2/gnu%20printf/ */
#ifdef __USE_MINGW_ANSI_STDIO
#undef __USE_MINGW_ANSI_STDIO
#endif
/* with UCRT, we don't define this to 1 */
#define __USE_MINGW_ANSI_STDIO 0
#endif
/* extern int getlock(void); */
#endif /* __GNUC__ */

6
src/.gitattributes vendored
View File

@@ -1,8 +1,8 @@
* NH_filestag=(file%s_for_all_versions)
..files NH_filegenerated=Makefile,Makefile.mingw32,qt_kde0.moc,qt_main.moc,qt_map.moc,qt_menu.moc,qt_msg.moc,qt_plsel.moc,qt_set.moc,qt_stat.moc,qt_xcmd.moc,qt_yndlg.moc,tile.c,monstr.c
..files NH_filegenerated=Makefile,GNUmakefile,qt_kde0.moc,qt_main.moc,qt_map.moc,qt_menu.moc,qt_msg.moc,qt_plsel.moc,qt_set.moc,qt_stat.moc,qt_xcmd.moc,qt_yndlg.moc,tile.c,monstr.c
Makefile.mingw32 NH_filesgentag=(file%s_for_win32_that_are_moved_into_src_at_compile_time)
Makefile NH_filesgentag=>Makefile.mingw32
GNUmakefile NH_filesgentag=(file%s_for_win32_that_are_moved_into_src_at_compile_time)
Makefile NH_filesgentag=>GNUmakefile
qt_kde0.moc NH_filesgentag=(file%s_generated_by_'moc'_for_Qt_interface_at_compile_time)
qt_main.moc NH_filesgentag=>qt_kde0.moc

4
src/.gitignore vendored
View File

@@ -28,6 +28,6 @@ objutil/*
objlua/*
objpdc/*
bundle/*
Makefile.mingw32
Makefile.mingw32.depend
GNUmakefile
GNUmakefile.depend
.*.c

View File

@@ -1,11 +1,11 @@
# NetHack 3.7 Makefile.mingw32
# NetHack 3.7 GNUmakefile
# Copyright (c) 2022 by Feiyun Wang
#-Copyright (c) 2022 by Michael Allison
# NetHack may be freely redistributed. See license for details.
#
#==============================================================================
#
# Win32 Compilers Tested with this Makefile.mingw32:
# Win32 Compilers Tested with this GNUmakefile:
# mingw-w64
# from:
# https://sourceforge.net/p/mingw-w64/wiki2/GeneralUsageInstructions/
@@ -430,7 +430,7 @@ CLEAN_FILE += $(LUATARGETS) $(LUAOBJS) $(OLUA)/lua.o $(OLUA)/luac.o
NHLUAH = $(INCL)/nhlua.h
$(NHLUAH):
echo "/* nhlua.h - generated by Makefile.mingw32 */" > $@
echo "/* nhlua.h - generated by GNUmakefile */" > $@
@echo "#include \"$(LUASRC)/lua.h\"" >> $@
@echo "LUA_API int (lua_error) (lua_State *L) NORETURN;" >>$@
@echo "#include \"$(LUASRC)/lualib.h\"" >> $@
@@ -1296,6 +1296,6 @@ clean:
@$(foreach dir, $(CLEAN_DIR), \
if [ -d $(dir) ] ; then rmdir -p --ignore $(dir) ; fi ; )
-include Makefile.mingw32.depend
-include GNUmakefile.depend
-include .depend
# end of file

View File

@@ -2,12 +2,12 @@
cce = gcc -E -MM -MT "$(@:d=o) $@"
# Copy all $(cc) commands w/ their targets from Makefile.mingw32, 3rd party code unnecessary
# Copy all $(cc) commands w/ their targets from GNUmakefile, 3rd party code unnecessary
# Replace .o w/ .d, $(cc) w/ $(cce)
# Check extraordinary "OBJ): " and handle them properly
# Check all CLEAN_FILE lines, add obj files to $(OBJS4DEP)
# Run
# mingw32-make depend
# make depend
$(HL)/%.d: $(SRC)/%.c | $(HL)
$(cce) $(CFLAGSU) $< -o$@

View File

@@ -92,9 +92,11 @@ I. Dispelling the Myths:
as it looks, however it will behoove you to read this entire section
through before beginning the task.
We have provided Makefile.mingw32 in
sys/windows/Makefile.mingw32, which you use from the bash Windows command
shell included with MSYS2.
We have provided GNUmakefile in sys/windows/GNUmakefile, which you use
from the bash Windows command shell included with MSYS2. It is called
GNUmakefile because that is the first name searched for by the GNU
make utility thus preventing conflict with the Makefile used by the
Microsoft nmake utility.
II. To compile your copy of NetHack on a Windows machine using MSYS2:
@@ -106,7 +108,7 @@ Setting Up
2. Execute the following command to place copies of the Makefiles in
the src subfolder.
cp sys/windows/Makefile.mingw32* src
cp sys/windows/GNUmakefile* src
3. Change your current directory to the src subfolder of the nethack
source tree. The following command assumes you are still in the
@@ -120,10 +122,12 @@ Compiling
Your current directory should be the NetHack src directory.
Issue these following commands:
make -f Makefile.mingw32 clean
make -f Makefile.mingw32 depend
make -f Makefile.mingw32
Issue these following commands, which will find and use GNUmakefile
by default:
make clean
make depend
make
If all goes well, intermediate NetHack files will be placed in the
binary subfolder of the NetHack tree, and the final NetHack package
@@ -132,10 +136,8 @@ Compiling
Notes:
1. To rebuild NetHack after changing something, change your current directory
to src and issue the appropriate command for your compiler:
For gcc:
make -f Makefile.mingw32
to src and issue the following command:
make
2. An alternative to MSYS2 may be MinGW-w64 - winlibs standalone build.
That has not been tested by us at time of writing.

View File

@@ -47,10 +47,10 @@ echo ..\..\src\Makefile-orig
copy /Y Makefile.nmake ..\..\src\Makefile >nul
echo Microsoft nmake Makefile.nmake copy to ..\..\src\Makefile completed.
echo Copying mingw-w64 Makefile.mingw32 to ..\..\src\Makefile.mingw32
copy /Y Makefile.mingw32 ..\..\src\Makefile.mingw32 >nul
echo Copying mingw-w64 Makefile.mingw32.depend to ..\..\src\Makefile.mingw32.depend
copy /Y Makefile.mingw32.depend ..\..\src\Makefile.mingw32.depend >nul
echo Copying mingw-w64 GNUmakefile to ..\..\src\GNUmakefile
copy /Y GNUmakefile ..\..\src\GNUmakefile >nul
echo Copying mingw-w64 GNUmakefile.depend to ..\..\src\GNUmakefile.depend
copy /Y GNUmakefile.depend ..\..\src\GNUmakefile.depend >nul
echo mingw-w64 Makefile copies to ..\..\src completed.
echo Done copying files.

View File

@@ -33,7 +33,7 @@ NetHack 3.7 and above.
Windows build instructions:
By default, the Makefile.msc and Makefile.mingw32 are set up to build
By default, the Makefile.nmake and GNUmakefile are set up to build
curses from the submodules/pdcurses submodules folder (assumes you
obtained your NetHack sources via cloning a git repository),
If you obtained your NetHack by another means, such as a zip download,

View File

@@ -65,6 +65,11 @@
* ***********************************************************
*/
void safe_dismiss_nhwindow(winid);
void safe_putstr(winid, int, const char *);
void win_safe_init(int);
void safe_number_pad(int);
struct window_procs safe_procs = {
WPID(safestartup),
(0
@@ -225,7 +230,7 @@ safe_curs(winid window UNUSED, int x UNUSED, int y UNUSED)
}
void
safe_putstr(winid window, int attr, const char *str)
safe_putstr(winid window UNUSED, int attr UNUSED, const char *str UNUSED)
{
return;
}
@@ -424,7 +429,7 @@ safe_get_ext_cmd(void)
}
void
safe_number_pad(int mode)
safe_number_pad(int mode UNUSED)
{
return;
}