fix tile2bmp build under mingw. Provide alternatives for Microsoft-specific macros. Be consistent about slashes in gcc Makefile. Don't include shlwapi.h for any compiler.
This commit is contained in:
@@ -595,7 +595,7 @@ $(GAMEFILE) : $(ALLOBJ) $(NHRES) $(O)gamedir.tag \
|
||||
$(GAMEDIR)/nhdefkey.dll $(GAMEDIR)/nh340key.dll $(GAMEDIR)/nhraykey.dll
|
||||
endif
|
||||
@echo Linking....
|
||||
$(link) $(lflags) -o$@ $(ALLOBJ) $(NHRES) $(WINPLIBS) -lstdc++
|
||||
$(link) $(lflags) -o$@ $(ALLOBJ) $(NHRES) $(WINPLIBS) -static -lstdc++
|
||||
$(subst /,\,@if exist $(O)install.tag del $(O)install.tag)
|
||||
|
||||
|
||||
@@ -686,10 +686,10 @@ $(SRC)/vis_tab.c: $(U)makedefs.exe
|
||||
$(DAT)/engrave: $(DAT)/engrave.txt $(U)makedefs.exe
|
||||
$(subst /,\,$(U)makedefs -s)
|
||||
|
||||
$(DAT)\epitaph: $(DAT)/epitaph.txt $(U)makedefs.exe
|
||||
$(DAT)/epitaph: $(DAT)/epitaph.txt $(U)makedefs.exe
|
||||
$(subst /,\,$(U)makedefs -s)
|
||||
|
||||
$(DAT)\bogusmon: $(DAT)/bogusmon.txt $(U)makedefs.exe
|
||||
$(DAT)/bogusmon: $(DAT)/bogusmon.txt $(U)makedefs.exe
|
||||
$(subst /,\,$(U)makedefs -s)
|
||||
|
||||
|
||||
@@ -999,7 +999,7 @@ $(U)til2bm32.exe: $(O)til2bm32.o $(TEXT_IO32)
|
||||
@$(link) $(LFLAGSU) -o$@ $(O)til2bm32.o $(TEXT_IO32)
|
||||
|
||||
$(O)tile2bmp.o: $(WSHR)/tile2bmp.c $(HACK_H) $(TILE_H) $(INCL)/win32api.h
|
||||
$(cc) $(CFLAGS) -I$(WSHR) -o$@ $(WSHR)/tile2bmp.c
|
||||
$(cc) $(CFLAGS) -mno-ms-bitfields -I$(WSHR) -o$@ $(WSHR)/tile2bmp.c
|
||||
|
||||
$(O)til2bm32.o: $(WSHR)/til2bm32.c $(HACK_H) $(TILE_H) $(INCL)/win32api.h
|
||||
$(cc) $(CFLAGS) -I$(WSHR) -DTILE_X=32 -DTILE_Y=32 -o$@ $(WSHR)/til2bm32.c
|
||||
|
||||
@@ -16,6 +16,50 @@
|
||||
#include "mhmsgwnd.h"
|
||||
#include "mhmap.h"
|
||||
|
||||
|
||||
#ifdef __MINGW32__
|
||||
/* Force a compilation error if condition is true, but also produce a
|
||||
result (of value 0 and type size_t), so the expression can be used
|
||||
e.g. in a structure initializer (or where-ever else comma expressions
|
||||
aren't permitted). */
|
||||
#define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); }))
|
||||
/* &a[0] degrades to a pointer: a different type from an array */
|
||||
#define __must_be_array(a) \
|
||||
BUILD_BUG_ON_ZERO(__builtin_types_compatible_p(typeof(a), typeof(&a[0])))
|
||||
|
||||
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
|
||||
#define _countof(arr) ARRAY_SIZE(arr)
|
||||
|
||||
int _stprintf_s(
|
||||
TCHAR*buffer,
|
||||
size_t sizeOfBuffer,
|
||||
const TCHAR *format ,
|
||||
...
|
||||
)
|
||||
{
|
||||
int ret;
|
||||
va_list args;
|
||||
|
||||
va_start (args, format);
|
||||
ret = _vstprintf( buffer, format, args);
|
||||
va_end(args);
|
||||
return ret;
|
||||
}
|
||||
|
||||
double _wtof( const wchar_t *string )
|
||||
{
|
||||
double ret;
|
||||
size_t len = wcslen(string) + 1;
|
||||
char* p = (char*) malloc(len);
|
||||
|
||||
wcstombs(p,string,len);
|
||||
ret = atof(p);
|
||||
free(p);
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
typedef struct mswin_nethack_main_window {
|
||||
int mapAcsiiModeSave;
|
||||
} NHMainWindow, *PNHMainWindow;
|
||||
|
||||
@@ -15,9 +15,8 @@
|
||||
#include "mhmain.h"
|
||||
#include "mhmap.h"
|
||||
|
||||
#ifndef __BORLANDC__
|
||||
#include <shlwapi.h>
|
||||
#else /* Borland redefines "boolean" in shlwapi.h so just use the little bit we need */
|
||||
/* Borland and MinGW redefine "boolean" in shlwapi.h,
|
||||
so just use the little bit we need */
|
||||
typedef struct _DLLVERSIONINFO
|
||||
{
|
||||
DWORD cbSize;
|
||||
@@ -34,7 +33,7 @@ typedef struct _DLLVERSIONINFO
|
||||
|
||||
typedef HRESULT (CALLBACK* DLLGETVERSIONPROC)(DLLVERSIONINFO *);
|
||||
|
||||
#endif
|
||||
/* en of shlwapi.h */
|
||||
|
||||
/* Minimal common control library version
|
||||
Version _WIN_32IE Platform/IE
|
||||
|
||||
Reference in New Issue
Block a user