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:
@@ -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
|
||||
@@ -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$@
|
||||
@@ -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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user