Merge branch 'win32-x64-working' of https://rodney.nethack.org:20040/git/NHsource into win32-x64-working

* 'win32-x64-working' of https://rodney.nethack.org:20040/git/NHsource: (27 commits)
  Makefile bit
  gcc Makefile updates for recent file additions
  ...

Conflicts:
	src/files.c
This commit is contained in:
Derek S. Ray
2015-04-15 18:30:13 -04:00
54 changed files with 502 additions and 289 deletions

View File

@@ -1,8 +1,8 @@
/* NetHack 3.5 posixregex.c $NHDT-Date: 1428590280 2015/04/09 14:38:00 $ $NHDT-Branch: scshunt-regex $:$NHDT-Revision: 1.0 $ */
/* NetHack 3.5 posixregex.c $NHDT-Date: 1428970913 2015/04/14 00:21:53 $ $NHDT-Branch: master $:$NHDT-Revision: 1.0 $ */
/* Copyright (c) Sean Hunt 2015. */
/* NetHack may be freely redistributed. See license for details. */
#include <hack.h>
#include "hack.h"
#include <regex.h>
@@ -50,7 +50,7 @@ struct nhregex {
};
struct nhregex *regex_init() {
return malloc (sizeof (struct nhregex));
return (struct nhregex *)alloc(sizeof (struct nhregex));
}
boolean regex_compile(const char *s, struct nhregex *re) {
@@ -65,7 +65,7 @@ const char *regex_error_desc(struct nhregex *re) {
static char buf[BUFSZ];
if (!re || !re->err)
return NULL;
return (const char *)0;
/* FIXME: Using a static buffer here is not ideal, but avoids memory
* leaks. Consider the allocation more carefully. */
@@ -75,11 +75,12 @@ const char *regex_error_desc(struct nhregex *re) {
}
boolean regex_match(const char *s, struct nhregex *re) {
int result;
if (!re)
return FALSE;
int result;
if ((result = regexec(&re->re, s, 0, NULL, 0))) {
if ((result = regexec(&re->re, s, 0, (genericptr_t)0, 0))) {
if (result != REG_NOMATCH)
re->err = result;
return FALSE;

View File

@@ -1,6 +1,6 @@
# NetHack 3.5 Makefile.gcc $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$
# NetHack 3.5 Makefile.gcc $Date: 2011/10/11 02:37:22 $ $Revision: 1.38 $
# Copyright (c) NetHack PC Development Team 1993-2010
# Copyright (c) NetHack PC Development Team 1993-2015
#
# NetHack 3.5.x Makefile for MinGW
#
@@ -89,7 +89,7 @@ SRC = ../src
# Shared system files
SSYS = ../sys/share
# NT Win32 specific files
NTSYS = ../sys/winnt
MSWSYS = ../sys/winnt
# window port files (tty)
TTY = ../win/tty
# window port files (Win32)
@@ -262,14 +262,17 @@ $(OBJ)/%.o : $(SRC)/%.c
$(OBJ)/%.o : $(SSYS)/%.c
$(cc) $(CFLAGS) -o$@ $<
$(OBJ)/%.o : $(SSYS)/%.cpp
g++ $(CFLAGS) -std=c++11 -o$@ $<
#==========================================
# Rules for files in sys/winnt
#==========================================
$(OBJ)/%.o : $(NTSYS)/%.c
$(OBJ)/%.o : $(MSWSYS)/%.c
$(cc) $(CFLAGS) -o$@ $<
$(INCL)/%.h : $(NTSYS)/%.h
$(INCL)/%.h : $(MSWSYS)/%.h
@copy $< $@
#==========================================
@@ -313,7 +316,7 @@ $(OBJ)/%.o : $(WIN32)/%.c
# referenced later on in the Makefile.
#
DEFFILE = $(NTSYS)/$(GAME).def
DEFFILE = $(MSWSYS)/$(GAME).def
#
# Shorten up the location for some files
@@ -394,6 +397,8 @@ VOBJ27 = $(O)worm.o $(O)worn.o $(O)write.o $(O)zap.o
DLBOBJ = $(O)dlb.o
REGEX = $(O)cppregex.o
TTYOBJ = $(O)topl.o $(O)getline.o $(O)wintty.o
SOBJ = $(O)winnt.o $(O)pcsys.o $(O)pcunix.o \
@@ -404,7 +409,7 @@ OBJS = $(VOBJ01) $(VOBJ02) $(VOBJ03) $(VOBJ04) $(VOBJ05) \
$(VOBJ11) $(VOBJ12) $(VOBJ13) $(VOBJ14) $(VOBJ15) \
$(VOBJ16) $(VOBJ17) $(VOBJ18) $(VOBJ19) $(VOBJ20) \
$(VOBJ21) $(VOBJ22) $(VOBJ23) $(VOBJ24) $(VOBJ25) \
$(VOBJ26) $(VOBJ27)
$(VOBJ26) $(VOBJ27) $(REGEX)
WINPOBJ = $(WINPORT)
@@ -437,7 +442,7 @@ HACK_H = $(INCL)/hack.h $(CONFIG_H) $(INCL)/align.h $(INCL)/context.h \
$(INCL)/wintype.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)/onames.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 $(INCL)/winprocs.h \
@@ -506,13 +511,14 @@ else
$(subst /,\,copy $(DAT)/*.lev $(GAMEDIR))
$(subst /,\,if exist $(GAMEDIR)/makefile del $(GAMEDIR)/makefile)
endif
$(subst /,\,if not exist $(GAMEDIR)/sysconf copy $(MSWSYS)/sysconf $(GAMEDIR))
$(subst /,\,if exist $(DAT)/symbols copy $(DAT)/symbols $(GAMEDIR))
$(subst /,\,if exist $(DOC)/guidebook.txt copy $(DOC)/guidebook.txt $(GAMEDIR)/Guidebook.txt)
$(subst /,\,if exist $(DOC)/nethack.txt copy $(DOC)/nethack.txt $(GAMEDIR)/NetHack.txt)
$(subst /,\,copy $(NTSYS)/defaults.nh $(GAMEDIR)/defaults.nh)
$(subst /,\,copy $(MSWSYS)/defaults.nh $(GAMEDIR)/defaults.nh)
$(subst /,\,echo install done > $@)
# copy $(NTSYS)/winnt.hlp $(GAMEDIR)
# copy $(MSWSYS)/winnt.hlp $(GAMEDIR)
recover: $(U)recover.exe
$(subst /,\,if exist $(U)recover.exe copy $(U)recover.exe $(GAMEDIR))
@@ -570,8 +576,8 @@ $(NHRES): $(TILEBMP16) $(WIN32)/winhack.rc $(WIN32)/mnsel.bmp \
$(WIN32)/splash.bmp
@$(rc) -o$@ --include-dir $(WIN32) -i $(WIN32)/winhack.rc
else
$(NHRES): $(NTSYS)/console.rc $(NTSYS)/NetHack.ico
@$(rc) -o$@ --include-dir $(NTSYS) -i $(NTSYS)/console.rc
$(NHRES): $(MSWSYS)/console.rc $(MSWSYS)/NetHack.ico
@$(rc) -o$@ --include-dir $(MSWSYS) -i $(MSWSYS)/console.rc
endif
#==========================================
@@ -589,12 +595,12 @@ $(GAMEFILE) : $(ALLOBJ) $(NHRES) $(O)gamedir.tag \
$(GAMEDIR)/nhdefkey.dll $(GAMEDIR)/nh340key.dll $(GAMEDIR)/nhraykey.dll
endif
@echo Linking....
@$(link) $(lflags) -o$@ $(ALLOBJ) $(NHRES) $(WINPLIBS)
$(link) $(lflags) -o$@ $(ALLOBJ) $(NHRES) $(WINPLIBS) -lstdc++
$(subst /,\,@if exist $(O)install.tag del $(O)install.tag)
$(O)nhdefkey.o:
$(cc) $(CFLAGS) -DBUILD_DLL -o$@ $(NTSYS)/nhdefkey.c
$(cc) $(CFLAGS) -DBUILD_DLL -o$@ $(MSWSYS)/nhdefkey.c
$(GAMEDIR)/nhdefkey.dll : $(O)nhdefkey.o $(O)gamedir.tag
@echo Linking $@
@@ -602,7 +608,7 @@ $(GAMEDIR)/nhdefkey.dll : $(O)nhdefkey.o $(O)gamedir.tag
-Wl,--add-stdcall-alias -o $@ $<
$(O)nh340key.o:
$(cc) $(CFLAGS) -DBUILD_DLL -o$@ $(NTSYS)/nh340key.c
$(cc) $(CFLAGS) -DBUILD_DLL -o$@ $(MSWSYS)/nh340key.c
$(GAMEDIR)/nh340key.dll : $(O)nh340key.o $(O)gamedir.tag
@echo Linking $@
@@ -610,15 +616,15 @@ $(GAMEDIR)/nh340key.dll : $(O)nh340key.o $(O)gamedir.tag
-Wl,--add-stdcall-alias -o $@ $<
$(O)nhraykey.o:
$(cc) $(CFLAGS) -DBUILD_DLL -o$@ $(NTSYS)/nhraykey.c
$(cc) $(CFLAGS) -DBUILD_DLL -o$@ $(MSWSYS)/nhraykey.c
$(GAMEDIR)/nhraykey.dll : $(O)nhraykey.o $(O)gamedir.tag
@echo Linking $@
$(cc) -shared -Wl,--export-all-symbols \
-Wl,--add-stdcall-alias -o $@ $<
$(GAME)_.ico : $(NTSYS)/$(GAME).ico
$(subst /,\,@copy $(NTSYS)/$(GAME).ico $@)
$(GAME)_.ico : $(MSWSYS)/$(GAME).ico
$(subst /,\,@copy $(MSWSYS)/$(GAME).ico $@)
#==========================================
# Create directory for holding object files
@@ -677,6 +683,17 @@ $(INCL)/vis_tab.h: $(U)makedefs.exe
$(SRC)/vis_tab.c: $(U)makedefs.exe
$(subst /,\,$(U)makedefs -z)
$(DAT)/engrave: $(DAT)/engrave.txt $(U)makedefs.exe
$(subst /,\,$(U)makedefs -s)
$(DAT)\epitaph: $(DAT)/epitaph.txt $(U)makedefs.exe
$(subst /,\,$(U)makedefs -s)
$(DAT)\bogusmon: $(DAT)/bogusmon.txt $(U)makedefs.exe
$(subst /,\,$(U)makedefs -s)
#==========================================
# uudecode utility and uuencoded targets
#==========================================
@@ -686,12 +703,12 @@ $(U)uudecode.exe: $(O)uudecode.o
$(O)uudecode.o: $(SSYS)/uudecode.c
$(NTSYS)/NetHack.ico : $(U)uudecode.exe $(NTSYS)/nhico.uu
$(subst /,\,$(U)uudecode.exe $(NTSYS)/nhico.uu)
$(MSWSYS)/NetHack.ico : $(U)uudecode.exe $(MSWSYS)/nhico.uu
$(subst /,\,$(U)uudecode.exe $(MSWSYS)/nhico.uu)
$(subst /,\,copy NetHack.ico $@)
del NetHack.ico
$(WIN32)/NetHack.ico : $(NTSYS)/NetHack.ico
$(WIN32)/NetHack.ico : $(MSWSYS)/NetHack.ico
$(subst /,\,copy $< $@)
$(WIN32)/mnsel.bmp: $(U)uudecode.exe $(WIN32)/mnsel.uu
@@ -850,8 +867,8 @@ $(O)obj.tag:
# Header files NOT distributed in ../include
#===========================================
$(INCL)/win32api.h: $(NTSYS)/win32api.h
$(subst /,\,copy $(NTSYS)/win32api.h $@)
$(INCL)/win32api.h: $(MSWSYS)/win32api.h
$(subst /,\,copy $(MSWSYS)/win32api.h $@)
#==========================================
@@ -868,13 +885,13 @@ $(O)dlb.o: $(O)dlb_main.o $(O)alloc.o $(O)panic.o $(INCL)/dlb.h
$(O)dlb_main.o: $(UTIL)/dlb_main.c $(INCL)/config.h $(INCL)/dlb.h
$(cc) $(CFLAGS) -o$@ $(UTIL)/dlb_main.c
$(DAT)/porthelp: $(NTSYS)/porthelp
$(subst /,\,@copy $(NTSYS)/porthelp $@ >nul)
$(DAT)/porthelp: $(MSWSYS)/porthelp
$(subst /,\,@copy $(MSWSYS)/porthelp $@ >nul)
nhdat: $(U)dlb_main.exe $(DAT)/data $(DAT)/oracles $(OPTIONS_FILE) \
$(DAT)/quest.dat $(DAT)/rumors $(DAT)/help $(DAT)/hh $(DAT)/cmdhelp \
$(DAT)/history $(DAT)/opthelp $(DAT)/wizhelp $(DAT)/dungeon \
$(DAT)/porthelp $(DAT)/license $(O)sp_lev.tag
$(DAT)/porthelp $(DAT)/license $(DAT)/engrave $(DAT)/epitaph $(DAT)/bogusmon $(DAT)/tribute $(O)sp_lev.tag
$(subst /,\,echo data >$(DAT)/dlb.lst)
$(subst /,\,echo oracles >>$(DAT)/dlb.lst)
$(subst /,\,if exist $(DAT)/options echo options >>$(DAT)/dlb.lst)
@@ -891,6 +908,10 @@ nhdat: $(U)dlb_main.exe $(DAT)/data $(DAT)/oracles $(OPTIONS_FILE) \
$(subst /,\,echo wizhelp >>$(DAT)/dlb.lst)
$(subst /,\,echo dungeon >>$(DAT)/dlb.lst)
$(subst /,\,echo license >>$(DAT)/dlb.lst)
$(subst /,\,echo engrave >>$(DAT)/dlb.lst)
$(subst /,\,echo epitaph >>$(DAT)/dlb.lst)
$(subst /,\,echo bogusmon >>$(DAT)/dlb.lst)
$(subst /,\,echo tribute >>$(DAT)/dlb.lst)
dir /l /b /-p $(subst /,\,$(DAT)/*.lev >>$(DAT)/dlb.lst)
$(subst /,\,$(U)dlb_main CcIf $(DAT) dlb.lst $(SRC)/nhdat)
@@ -1085,12 +1106,19 @@ $(DAT)/dungeon: $(O)utility.tag $(DAT)/dungeon.def
# NT dependencies
#
$(O)nttty.o: $(HACK_H) $(TILE_H) $(INCL)/win32api.h $(NTSYS)/nttty.c
$(cc) $(CFLAGS) -I$(WSHR) -o$@ $(NTSYS)/nttty.c
$(O)winnt.o: $(HACK_H) $(INCL)/win32api.h $(NTSYS)/winnt.c
$(cc) $(CFLAGS) -o$@ $(NTSYS)/winnt.c
$(O)ntsound.o: $(HACK_H) $(NTSYS)/ntsound.c
$(cc) $(CFLAGS) -o$@ $(NTSYS)/ntsound.c
$(O)nttty.o: $(HACK_H) $(TILE_H) $(INCL)/win32api.h $(MSWSYS)/nttty.c
$(cc) $(CFLAGS) -I$(WSHR) -o$@ $(MSWSYS)/nttty.c
$(O)winnt.o: $(HACK_H) $(INCL)/win32api.h $(MSWSYS)/winnt.c
$(cc) $(CFLAGS) -o$@ $(MSWSYS)/winnt.c
$(O)ntsound.o: $(HACK_H) $(MSWSYS)/ntsound.c
$(cc) $(CFLAGS) -o$@ $(MSWSYS)/ntsound.c
#
# sys/share dependencies
#
(O)cppregex.o: $(O)cppregex.cpp $(HACK_H)
@$(CC) $(CFLAGS) -Fo$@ ../sys/share/cppregex.cpp
#
# util dependencies

View File

@@ -142,63 +142,6 @@ rc=Rc
TARGET_CPU=x86
!ENDIF
# Common compiler flags:
# -c - compile without linking
# -W3 - Set warning level to level 3 (-W4 for 64-bit compilations)
# -Zi - generate debugging information
# -Od - disable all optimizations
# -Ox - use maximum optimizations
# -Zd - generate only public symbols and line numbers for debugging
# -GS - enable security checks
#
ccommon=-c -Zi -DCRTAPI1=_cdecl -DCRTAPI2=_cdecl -nologo -GS -c
lflags=/INCREMENTAL:NO /NOLOGO
!IF "$(TARGET_CPU)" == "x86"
cflags = $(ccommon) -D_X86_=1 -DWIN32 -D_WIN32 -W3
scall = -Gz
!ELSEIF "$(TARGET_CPU)" == "x64"
cflags = $(ccommon) -D_AMD64_=1 -DWIN64 -D_WIN64 -DWIN32 -D_WIN32
cflags = $(cflags) -W4
scall =
!ENDIF
# declarations for use on Intel x86 systems
!IF "$(TARGET_CPU)" == "x86"
DLLENTRY = @12
!ENDIF
# declarations for use on AMD64 systems
!IF "$(TARGET_CPU)" == "x64"
DLLENTRY =
!ENDIF
# for Windows applications
conlflags = $(lflags) -subsystem:console,$(EXEVER)
guilflags = $(lflags) -subsystem:windows,$(EXEVER)
dlllflags = $(lflags) -entry:_DllMainCRTStartup$(DLLENTRY) -dll
# basic subsystem specific libraries, less the C Run-Time
baselibs = kernel32.lib $(optlibs) $(winsocklibs) advapi32.lib
winlibs = $(baselibs) user32.lib gdi32.lib comdlg32.lib winspool.lib
# for Windows applications that use the C Run-Time libraries
conlibs = $(baselibs)
guilibs = $(winlibs)
#
# End of VS2013 and greater stuff
#=============================================
#
#=============================================
# Visual Studio versions >= 2013 specific stuff
#=============================================
!IF "$(TARGET_CPU)" == ""
TARGET_CPU=x86
!ENDIF
# Common compiler flags:
# -c - compile without linking
# -W3 - Set warning level to level 3 (-W4 for 64-bit compilations)
@@ -413,7 +356,7 @@ lflagsUtil = $(lflags) $(conlibs)
# - Game build
#==========================================
GAMEPDBFILE= /DEBUG /PDB:"$(O)$(GAME).PDB"
GAMEPDBFILE= /PDB:"$(O)$(GAME).PDB"
GAMEMAPFILE= /MAP:"$(O)$(GAME).MAP"
LIBS= user32.lib winmm.lib $(ZLIB)
@@ -588,7 +531,6 @@ VOBJ24 = $(O)track.o $(O)trap.o $(O)u_init.o $(O)uhitm.o
VOBJ25 = $(O)vault.o $(O)vis_tab.o $(O)vision.o $(O)weapon.o
VOBJ26 = $(O)were.o $(O)wield.o $(O)windows.o $(O)wizard.o
VOBJ27 = $(O)worm.o $(O)worn.o $(O)write.o $(O)zap.o
DLBOBJ = $(O)dlb.o
REGEX = $(O)cppregex.o