#
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
--- /dev/null
+#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
--- /dev/null
+#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__
#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
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
#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
#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>
// 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
#define MAJOR 2 // Major version number
#define MINOR 2 // Minor version number
-#define PATCH 16 // Patch release number
+#define PATCH 17 // Patch release number
#endif // __VERSION_H__