Reduced Windows build further, dropping msvcrt.
Added both 32 and 64 bit flavors to deploy.
This commit is contained in:
@ -7,17 +7,22 @@ WINDOWS = $(OUT)/windows
|
|||||||
ARDUINO = $(OUT)/arduino
|
ARDUINO = $(OUT)/arduino
|
||||||
DEPLOY = $(OUT)/deploy
|
DEPLOY = $(OUT)/deploy
|
||||||
|
|
||||||
CFLAGS = -Wall -Werror \
|
CFLAGS_COMMON = -Wall -Werror \
|
||||||
-O2 \
|
-O2 \
|
||||||
-fno-exceptions \
|
|
||||||
-s \
|
-s \
|
||||||
-fomit-frame-pointer \
|
-ffreestanding \
|
||||||
|
-fno-exceptions \
|
||||||
|
-fno-stack-check \
|
||||||
-fno-stack-protector \
|
-fno-stack-protector \
|
||||||
|
-fno-stack-protector \
|
||||||
|
-fomit-frame-pointer \
|
||||||
|
-mno-stack-arg-probe \
|
||||||
-fno-ident -Wl,--build-id=none \
|
-fno-ident -Wl,--build-id=none \
|
||||||
-ffunction-sections -fdata-sections \
|
-ffunction-sections -fdata-sections \
|
||||||
-Wl,--gc-sections \
|
|
||||||
-fmerge-all-constants \
|
-fmerge-all-constants \
|
||||||
-I ./ -I $(OUT)
|
-I ./ -I $(OUT)
|
||||||
|
CFLAGS = $(CFLAGS_COMMON) \
|
||||||
|
-Wl,--gc-sections
|
||||||
STRIP_ARGS = -S \
|
STRIP_ARGS = -S \
|
||||||
--strip-unneeded \
|
--strip-unneeded \
|
||||||
--remove-section=.note.gnu.gold-version \
|
--remove-section=.note.gnu.gold-version \
|
||||||
@ -27,9 +32,9 @@ STRIP_ARGS = -S \
|
|||||||
--remove-section=.note.ABI-tag
|
--remove-section=.note.ABI-tag
|
||||||
LIBS=-ldl
|
LIBS=-ldl
|
||||||
|
|
||||||
WINFLAGS = -ffreestanding -fno-stack-check \
|
WIN_CFLAGS = $(CFLAGS_COMMON) -mwindows -nostdlib \
|
||||||
-fno-stack-protector -mno-stack-arg-probe \
|
|
||||||
-mwindows -lkernel32
|
WIN_LIBS = -lkernel32
|
||||||
|
|
||||||
# Default to 32-bit Windows for maximum portability.
|
# Default to 32-bit Windows for maximum portability.
|
||||||
ifeq ($(WIN_ARCH),)
|
ifeq ($(WIN_ARCH),)
|
||||||
@ -43,14 +48,23 @@ TARGETS = $(WEB)/terminal.html \
|
|||||||
$(ARDUINO)/ueforth/ueforth.ino
|
$(ARDUINO)/ueforth/ueforth.ino
|
||||||
|
|
||||||
# Selectively enable windows if tools available
|
# Selectively enable windows if tools available
|
||||||
ifneq (, $(shell which $(WIN_ARCH)-w64-mingw32-windres))
|
ifneq (, $(shell which i686-w64-mingw32-windres))
|
||||||
ifneq (, $(shell which $(WIN_ARCH)-w64-mingw32-gcc))
|
ifneq (, $(shell which i686-w64-mingw32-gcc))
|
||||||
TARGETS += $(WINDOWS)/uEforth.exe
|
TARGETS += $(WINDOWS)/uEforth32.exe
|
||||||
else
|
else
|
||||||
$(warning "Missing $(WIN_ARCH)-w64-mingw32-gcc skipping Windows.")
|
$(warning "Missing i686-w64-mingw32-gcc skipping 32-bit Windows.")
|
||||||
endif
|
endif
|
||||||
else
|
else
|
||||||
$(warning "Missing $(WIN_ARCH)-w64-mingw32-windres skipping Windows.")
|
$(warning "Missing i686-w64-mingw32-windres skipping 32-bit Windows.")
|
||||||
|
endif
|
||||||
|
ifneq (, $(shell which x86_64-w64-mingw32-windres))
|
||||||
|
ifneq (, $(shell which x86_64-w64-mingw32-gcc))
|
||||||
|
TARGETS += $(WINDOWS)/uEforth64.exe
|
||||||
|
else
|
||||||
|
$(warning "Missing i686-w64-mingw32-gcc skipping 64-bit Windows.")
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
$(warning "Missing i686-w64-mingw32-windres skipping 64-bit Windows.")
|
||||||
endif
|
endif
|
||||||
|
|
||||||
all: $(TARGETS) tests $(DEPLOY)/app.yaml
|
all: $(TARGETS) tests $(DEPLOY)/app.yaml
|
||||||
@ -124,10 +138,11 @@ ICON_SIZES = $(RES)/eforth256x256.png \
|
|||||||
$(RES)/eforth.ico: $(ICON_SIZES)
|
$(RES)/eforth.ico: $(ICON_SIZES)
|
||||||
convert $^ $< $@
|
convert $^ $< $@
|
||||||
|
|
||||||
WINDOWS_RESOURCES = $(RES)/ueforth_res.o
|
$(RES)/ueforth_res32.o: windows/ueforth.rc $(RES)/eforth.ico
|
||||||
|
i686-w64-mingw32-windres $< $@
|
||||||
|
|
||||||
$(WINDOWS_RESOURCES): windows/ueforth.rc $(RES)/eforth.ico
|
$(RES)/ueforth_res64.o: windows/ueforth.rc $(RES)/eforth.ico
|
||||||
$(WIN_ARCH)-w64-mingw32-windres $< $@
|
x86_64-w64-mingw32-windres $< $@
|
||||||
|
|
||||||
# ---- WEB ----
|
# ---- WEB ----
|
||||||
|
|
||||||
@ -163,14 +178,23 @@ $(POSIX)/ueforth: \
|
|||||||
$(WINDOWS):
|
$(WINDOWS):
|
||||||
mkdir -p $@
|
mkdir -p $@
|
||||||
|
|
||||||
$(WINDOWS)/uEforth.exe: \
|
$(WINDOWS)/uEforth32.exe: \
|
||||||
windows/windows_main.c \
|
windows/windows_main.c \
|
||||||
common/opcodes.h \
|
common/opcodes.h \
|
||||||
common/core.h \
|
common/core.h \
|
||||||
$(GEN)/windows_boot.h \
|
$(GEN)/windows_boot.h \
|
||||||
$(WINDOWS_RESOURCES) | $(WINDOWS)
|
$(RES)/ueforth_res32.o | $(WINDOWS)
|
||||||
$(WIN_ARCH)-w64-mingw32-gcc \
|
i686-w64-mingw32-gcc \
|
||||||
$(CFLAGS) $(WINFLAGS) $< $(WINDOWS_RESOURCES) -o $@
|
$(WIN_CFLAGS) $< $(RES)/ueforth_res32.o -o $@ $(WIN_LIBS)
|
||||||
|
|
||||||
|
$(WINDOWS)/uEforth64.exe: \
|
||||||
|
windows/windows_main.c \
|
||||||
|
common/opcodes.h \
|
||||||
|
common/core.h \
|
||||||
|
$(GEN)/windows_boot.h \
|
||||||
|
$(RES)/ueforth_res64.o | $(WINDOWS)
|
||||||
|
x86_64-w64-mingw32-gcc \
|
||||||
|
$(WIN_CFLAGS) $< $(RES)/ueforth_res64.o -o $@ $(WIN_LIBS)
|
||||||
|
|
||||||
# ---- ARDUINO ----
|
# ---- ARDUINO ----
|
||||||
|
|
||||||
@ -203,7 +227,8 @@ $(DEPLOY)/app.yaml: $(ARDUINO)/ueforth-arduino-esp32.zip \
|
|||||||
mkdir -p $(DEPLOY)/static
|
mkdir -p $(DEPLOY)/static
|
||||||
cp -r $(ARDUINO)/ueforth-arduino-esp32.zip $(DEPLOY)/static
|
cp -r $(ARDUINO)/ueforth-arduino-esp32.zip $(DEPLOY)/static
|
||||||
cp -r $(POSIX)/ueforth $(DEPLOY)/static/ueforth.linux
|
cp -r $(POSIX)/ueforth $(DEPLOY)/static/ueforth.linux
|
||||||
cp -r $(WINDOWS)/uEforth.exe $(DEPLOY)/static/uEforth.exe
|
cp -r $(WINDOWS)/uEforth32.exe $(DEPLOY)/static/uEforth32.exe
|
||||||
|
cp -r $(WINDOWS)/uEforth64.exe $(DEPLOY)/static/uEforth64.exe
|
||||||
cp -r $(RES)/eforth.ico $(DEPLOY)/static/favicon.ico
|
cp -r $(RES)/eforth.ico $(DEPLOY)/static/favicon.ico
|
||||||
cp -r site/* $(DEPLOY)
|
cp -r site/* $(DEPLOY)
|
||||||
cp -r site/.gcloudignore $(DEPLOY)
|
cp -r site/.gcloudignore $(DEPLOY)
|
||||||
|
|||||||
@ -19,20 +19,22 @@ typedef uint64_t udcell_t;
|
|||||||
#define COMMA(n) *g_sys.heap++ = (n)
|
#define COMMA(n) *g_sys.heap++ = (n)
|
||||||
#define IMMEDIATE() g_sys.last[-1] |= 1
|
#define IMMEDIATE() g_sys.last[-1] |= 1
|
||||||
#define DOES(ip) *g_sys.last = (cell_t) && OP_DODOES; g_sys.last[1] = (cell_t) ip
|
#define DOES(ip) *g_sys.last = (cell_t) && OP_DODOES; g_sys.last[1] = (cell_t) ip
|
||||||
#define UMSMOD udcell_t ud = *(udcell_t *) &sp[-1]; \
|
#ifndef UMSMOD_FUNC
|
||||||
|
#define UMSMOD_FUNC udcell_t ud = *(udcell_t *) &sp[-1]; \
|
||||||
--sp; *sp = (cell_t) (ud % tos); \
|
--sp; *sp = (cell_t) (ud % tos); \
|
||||||
tos = (cell_t) (ud / tos)
|
tos = (cell_t) (ud / tos)
|
||||||
#define SSMOD dcell_t d = (dcell_t) *sp * (dcell_t) sp[-1]; \
|
#define SSMOD_FUNC dcell_t d = (dcell_t) *sp * (dcell_t) sp[-1]; \
|
||||||
--sp; *sp = (cell_t) (((udcell_t) d) % tos); \
|
--sp; *sp = (cell_t) (((udcell_t) d) % tos); \
|
||||||
tos = (cell_t) (d < 0 ? ~(~d / tos) : d / tos)
|
tos = (cell_t) (d < 0 ? ~(~d / tos) : d / tos)
|
||||||
|
#endif
|
||||||
#define PARK DUP; g_sys.ip = ip; g_sys.rp = rp; g_sys.sp = sp
|
#define PARK DUP; g_sys.ip = ip; g_sys.rp = rp; g_sys.sp = sp
|
||||||
|
|
||||||
#define OPCODE_LIST \
|
#define OPCODE_LIST \
|
||||||
X("0=", ZEQUAL, tos = !tos ? -1 : 0) \
|
X("0=", ZEQUAL, tos = !tos ? -1 : 0) \
|
||||||
X("0<", ZLESS, tos = (tos|0) < 0 ? -1 : 0) \
|
X("0<", ZLESS, tos = (tos|0) < 0 ? -1 : 0) \
|
||||||
X("+", PLUS, tos = (tos + *sp) | 0; --sp) \
|
X("+", PLUS, tos = (tos + *sp) | 0; --sp) \
|
||||||
X("UM/MOD", UMSMOD, UMSMOD) \
|
X("UM/MOD", UMSMOD, UMSMOD_FUNC) \
|
||||||
X("*/MOD", SSMOD, SSMOD) \
|
X("*/MOD", SSMOD, SSMOD_FUNC) \
|
||||||
X("AND", AND, tos = tos & *sp; --sp) \
|
X("AND", AND, tos = tos & *sp; --sp) \
|
||||||
X("OR", OR, tos = tos | *sp; --sp) \
|
X("OR", OR, tos = tos | *sp; --sp) \
|
||||||
X("XOR", XOR, tos = tos ^ *sp; --sp) \
|
X("XOR", XOR, tos = tos ^ *sp; --sp) \
|
||||||
|
|||||||
@ -17,10 +17,11 @@ In its original form metacompilation is avoided.
|
|||||||
<p>
|
<p>
|
||||||
Version of uEforth - A reduced cross-platform EForth version (RECOMMENDED)
|
Version of uEforth - A reduced cross-platform EForth version (RECOMMENDED)
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="static/uEforth.exe">uEforth.exe</a> - Window EXE uEforth</li>
|
|
||||||
<li><a href="static/ueforth.linux">ueforth.linux</a> - Linux Executable uEforth</li>
|
|
||||||
<li><a href="static/ueforth-arduino-esp32.zip">ueforth-arduino-esp32.zip</a>
|
<li><a href="static/ueforth-arduino-esp32.zip">ueforth-arduino-esp32.zip</a>
|
||||||
- Arudino Source Code</li>
|
- Arudino Source Code</li>
|
||||||
|
<li><a href="static/uEforth32.exe">uEforth32.exe</a> - Window 32-bit EXE uEforth</li>
|
||||||
|
<li><a href="static/uEforth64.exe">uEforth64.exe</a> - Window 64-bit EXE uEforth</li>
|
||||||
|
<li><a href="static/ueforth.linux">ueforth.linux</a> - Linux 64-bit Executable uEforth</li>
|
||||||
<li><a href="https://github.com/flagxor/eforth" target="_blank">http://github.com/flagxor/eforth</a>
|
<li><a href="https://github.com/flagxor/eforth" target="_blank">http://github.com/flagxor/eforth</a>
|
||||||
- Complete Source Code (under ueforth)</li>
|
- Complete Source Code (under ueforth)</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|||||||
@ -31,4 +31,5 @@ int main(int argc, char *argv[]) {
|
|||||||
fprintf(stderr, "USAGE: %s cases/dict\n", argv[1]);
|
fprintf(stderr, "USAGE: %s cases/dict\n", argv[1]);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,6 +2,17 @@
|
|||||||
|
|
||||||
#define CALLTYPE WINAPI
|
#define CALLTYPE WINAPI
|
||||||
|
|
||||||
|
# define UMSMOD_FUNC \
|
||||||
|
asm("div %2" \
|
||||||
|
: "=a" (tos), "=d" (sp[-1]) \
|
||||||
|
: "r" (tos), "a" (sp[-1]), "d" (*sp)); --sp
|
||||||
|
|
||||||
|
# define SSMOD_FUNC \
|
||||||
|
w = tos; asm("imul %4\n\t" \
|
||||||
|
"idiv %2" \
|
||||||
|
: "=a" (tos), "=d" (sp[-1]) \
|
||||||
|
: "r" (w), "a" (sp[-1]), "d" (*sp)); --sp; if (*sp < 0) { *sp += w; --tos; }
|
||||||
|
|
||||||
#include "common/opcodes.h"
|
#include "common/opcodes.h"
|
||||||
#include "common/calling.h"
|
#include "common/calling.h"
|
||||||
|
|
||||||
@ -19,8 +30,7 @@
|
|||||||
|
|
||||||
#include "gen/windows_boot.h"
|
#include "gen/windows_boot.h"
|
||||||
|
|
||||||
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrev,
|
int WINAPI WinMainCRTStartup(void) {
|
||||||
PSTR pCmdLine, int nCmdShow) {
|
|
||||||
void *heap = VirtualAlloc(
|
void *heap = VirtualAlloc(
|
||||||
NULL, HEAP_SIZE, MEM_RESERVE | MEM_COMMIT, PAGE_EXECUTE_READWRITE);
|
NULL, HEAP_SIZE, MEM_RESERVE | MEM_COMMIT, PAGE_EXECUTE_READWRITE);
|
||||||
ueforth(0, 0, heap, boot, sizeof(boot));
|
ueforth(0, 0, heap, boot, sizeof(boot));
|
||||||
|
|||||||
Reference in New Issue
Block a user