Skip to content

Commit

Permalink
Change WASMTIME variable to EMULATE in runtime/Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
MatthewFluet committed May 22, 2024
1 parent c66ecc1 commit 7f31145
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions runtime/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Copyright (C) 2010-2013,2018,2019-2022 Matthew Fluet.
## Copyright (C) 2010-2013,2018,2019-2022,2024 Matthew Fluet.
# Copyright (C) 1999-2009 Henry Cejtin, Matthew Fluet, Suresh
# Jagannathan, and Stephen Weeks.
# Copyright (C) 1997-2000 NEC Research Institute.
Expand All @@ -20,7 +20,12 @@ endif

EXE :=

WASMTIME :=
# Building the runtime for a target platform requires executing target-platform
# executables (eg., `gen/gen-types` to determine the sizes of C types).
# When cross compiling, it may be possible/necessary to emulate/execute the
# target-platform executable on the host platform (e.g., Wasmtime to execute
# WebAssembly programs).
EMULATE :=

MDVARIANTS := OPT DBG
PIVARIANTS := DPI NPI PIC PIE
Expand Down Expand Up @@ -113,7 +118,7 @@ EXE := .exe
endif

ifeq ($(TARGET_OS), wasi)
WASMTIME := wasmtime
EMULATE := wasmtime
XCPPFLAGS += -D_WASI_EMULATED_SIGNAL \
-D_WASI_EMULATED_PROCESS_CLOCKS \
-D_WASI_EMULATED_GETPID
Expand Down Expand Up @@ -251,11 +256,11 @@ ml-types.h: gen/ml-types.h
$(CP) $< $@

gen/ml-types.h: gen/gen-types$(EXE)
$(WASMTIME) ./gen/gen-types$(EXE) ml-types.h > gen/ml-types.h
$(EMULATE) ./gen/gen-types$(EXE) ml-types.h > gen/ml-types.h
gen/c-types.h: gen/gen-types$(EXE)
$(WASMTIME) ./gen/gen-types$(EXE) c-types.h > gen/c-types.h
$(EMULATE) ./gen/gen-types$(EXE) c-types.h > gen/c-types.h
gen/c-types.sml: gen/gen-types$(EXE)
$(WASMTIME) ./gen/gen-types$(EXE) c-types.sml > gen/c-types.sml
$(EMULATE) ./gen/gen-types$(EXE) c-types.sml > gen/c-types.sml

ifneq ($(MAKECMDGOALS),clean)
-include gen/gen-types.d
Expand All @@ -274,7 +279,7 @@ gen/$(1): gen/gen-basis-ffi.sml gen/basis-ffi.def
touch gen/$(1)
else
gen/$(1): gen/gen-basis-ffi$(EXE) gen/basis-ffi.def
$(WASMTIME) ./gen/gen-basis-ffi$(EXE) $(1) < gen/basis-ffi.def > gen/$(1)
$(EMULATE) ./gen/gen-basis-ffi$(EXE) $(1) < gen/basis-ffi.def > gen/$(1)
$(CAT) gen/gen-basis-ffi.sml gen/basis-ffi.def gen/$(1) | $(SHA1DGST) > gen/$(1).chk
endif
endef
Expand Down Expand Up @@ -319,7 +324,7 @@ gdtoa/README: gdtoa.tgz gdtoa.may_alias-unions.patch gdtoa.rename-public-fns.pat
@touch $@

gdtoa/arith.h: gdtoa/arithchk$(EXE)
$(WASMTIME) ./gdtoa/arithchk$(EXE) > gdtoa/arith.h
$(EMULATE) ./gdtoa/arithchk$(EXE) > gdtoa/arith.h

gdtoa/arithchk.c: gdtoa/README
@touch $@
Expand All @@ -331,7 +336,7 @@ ifneq ($(MAKECMDGOALS),clean)
endif

gdtoa/gd_qnan.h: gdtoa/qnan$(EXE)
$(WASMTIME) ./gdtoa/qnan$(EXE) > gdtoa/gd_qnan.h
$(EMULATE) ./gdtoa/qnan$(EXE) > gdtoa/gd_qnan.h

gdtoa/qnan.c: gdtoa/README
@touch $@
Expand Down Expand Up @@ -360,7 +365,7 @@ $(eval $(call A_TEMPLATE,mlton,MLTON))
### gen/constants ###

gen/constants: gen/gen-constants$(EXE)
$(WASMTIME) ./gen/gen-constants > gen/constants
$(EMULATE) ./gen/gen-constants > gen/constants

ifneq ($(MAKECMDGOALS),clean)
-include gen/gen-constants.d
Expand Down

0 comments on commit 7f31145

Please sign in to comment.