mirror of http://shamusworld.gotdns.org/git/rmac
Fix to placate the Visual Studio(TM) gods.
N.B.: Even MXE (which makes Windows(TM) executables), doesn't need this kind of special treatment. So, meh. :-/
This commit is contained in:
parent
bdae4ca0d4
commit
977e372d50
|
@ -7,6 +7,7 @@
|
|||
#
|
||||
echo "Cross compiling for Win32..."
|
||||
export PATH=/opt/mxe/usr/bin:$PATH
|
||||
make CROSS=i686-pc-mingw32-
|
||||
#make CROSS=i686-pc-mingw32-
|
||||
make CROSS=i686-w64-mingw32.static-
|
||||
rel=`git log -1 --pretty=format:%ci | cut -d ' ' -f 1 | tr -d -`
|
||||
mv rmac rmac.exe && upx -9v rmac.exe && zip -9v rmac-$rel.zip rmac.exe
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
#if defined(WIN32) || defined(WIN64)
|
||||
|
||||
// Microsoft™ Windows™ dependent code
|
||||
|
||||
// There is one, and only one case where this is needed and that's in a Visual
|
||||
// Studio™ environment. Even building a Windows™ executable with MXE doesn't
|
||||
// require this. So, even though this kind of thing is POSIX, it can't be
|
||||
// included in a Visual Studio™ environment without adding a 3rd party shim.
|
||||
// So we've made our own shim.
|
||||
//
|
||||
// The shim is minimal because the code in RMAC that uses it is minimal. If it
|
||||
// gets expanded in the future for some reason, the shim will have to expand
|
||||
// too. :-/ But that will never happen, right? ;-)
|
||||
//
|
||||
|
||||
#include "dirent_lose.h"
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
|
||||
static DIR dummy;
|
||||
|
||||
DIR * opendir(const char * name)
|
||||
{
|
||||
BOOL test = ((GetFileAttributesA(name) & FILE_ATTRIBUTE_DIRECTORY) != INVALID_FILE_ATTRIBUTES);
|
||||
|
||||
return (test ? &dummy : NULL);
|
||||
}
|
||||
|
||||
int closedir(DIR * dir)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
|
@ -0,0 +1,18 @@
|
|||
#ifndef __DIRENT_LOSE_H__
|
||||
#define __DIRENT_LOSE_H__
|
||||
|
||||
#if defined(WIN32) || defined(WIN64)
|
||||
|
||||
// Microsoft™ Windows™ dependent code
|
||||
|
||||
// This is only needed to keep the compiler from throwing a fit, it's not meant
|
||||
// to be used except as a sentinel (NULL/non-NULL).
|
||||
typedef struct { int i; /* dummy member */ } DIR;
|
||||
|
||||
// These are the only two functions used from <dirent.h>
|
||||
DIR * opendir(const char *);
|
||||
int closedir(DIR *);
|
||||
|
||||
#endif
|
||||
|
||||
#endif // __DIRENT_LOSE_H__
|
3
makefile
3
makefile
|
@ -27,7 +27,7 @@ HOSTCC = gcc
|
|||
#CFLAGS = -std=$(STD) -D_DEFAULT_SOURCE -g -D__GCCUNIX__ -I. -O2 -MMD
|
||||
CFLAGS = -std=$(STD) -D_DEFAULT_SOURCE -g -D__GCCUNIX__ -I. -O2
|
||||
|
||||
OBJS = 6502.o amode.o debug.o direct.o dsp56k.o dsp56k_amode.o dsp56k_mach.o eagen.o error.o expr.o fltpoint.o listing.o mach.o macro.o mark.o object.o op.o procln.o riscasm.o rmac.o sect.o symbol.o token.o
|
||||
OBJS = 6502.o amode.o debug.o direct.o dsp56k.o dsp56k_amode.o dsp56k_mach.o eagen.o error.o expr.o fltpoint.o listing.o mach.o macro.o mark.o object.o op.o procln.o riscasm.o rmac.o sect.o symbol.o token.o dirent_lose.o
|
||||
|
||||
#
|
||||
# Build everything
|
||||
|
@ -162,3 +162,4 @@ symbol.o: symbol.c symbol.h error.h rmac.h listing.h object.h procln.h \
|
|||
token.h
|
||||
token.o: token.c token.h rmac.h symbol.h direct.h error.h macro.h \
|
||||
procln.h sect.h riscasm.h kwtab.h unarytab.h
|
||||
dirent_lose.o: dirent_lose.h
|
||||
|
|
24
rmac.h
24
rmac.h
|
@ -22,6 +22,7 @@
|
|||
#if defined(WIN32) || defined(WIN64)
|
||||
#include <io.h>
|
||||
#include <fcntl.h>
|
||||
#include "dirent_lose.h"
|
||||
// Release platform - windows
|
||||
#define PLATFORM "Win32"
|
||||
#define _OPEN_FLAGS _O_TRUNC|_O_CREAT|_O_BINARY|_O_RDWR
|
||||
|
@ -54,8 +55,19 @@
|
|||
|
||||
#endif
|
||||
|
||||
// Ever since Visual Studio... 2017? 2019? the following constants come
|
||||
// defined in the platform SDK, which leads to endless warnings from the
|
||||
// compiler. So let's just put the pacifier on and undef them, sheesh! (No,
|
||||
// we won't rename the defines, we've been here since 1986, Visual Studio
|
||||
// wasn't even a glimpse in the milkman's eyes, if you catch my drift)
|
||||
#undef CONST
|
||||
#undef ERROR
|
||||
#undef TEXT
|
||||
|
||||
#else
|
||||
|
||||
#include <dirent.h>
|
||||
|
||||
#ifdef __GCCUNIX__
|
||||
|
||||
#include <sys/fcntl.h>
|
||||
|
@ -156,20 +168,8 @@
|
|||
// Non-target specific stuff
|
||||
//
|
||||
#include <inttypes.h>
|
||||
#include <dirent.h>
|
||||
#include "symbol.h"
|
||||
|
||||
#if defined(WIN32) || defined(WIN64)
|
||||
// Ever since Visual Studio... 2017? 2019? the following constants come defined in the
|
||||
// platform SDK, which leads to endless warnings from the compiler. So let's just
|
||||
// put the pacifier on and undef them, sheesh! (No, we won't rename the defines,
|
||||
// we've been here since 1986, Visual Studio wasn't even a glimpse in the milkman's eyes,
|
||||
// if you catch my drift)
|
||||
#undef CONST
|
||||
#undef ERROR
|
||||
#undef TEXT
|
||||
#endif
|
||||
|
||||
#define BYTE uint8_t
|
||||
#define WORD uint16_t
|
||||
#define LONG uint32_t
|
||||
|
|
Loading…
Reference in New Issue