]> granicus.if.org Git - nethack/commitdiff
replace -DWASM with compiler internal __EMSCRIPTEN__
authorAdam Powers <apowers@ato.ms>
Fri, 28 Aug 2020 05:15:12 +0000 (22:15 -0700)
committerAdam Powers <apowers@ato.ms>
Fri, 28 Aug 2020 05:15:12 +0000 (22:15 -0700)
include/global.h
sys/lib/Makefile.utl
sys/lib/hints/wasm
util/makedefs.c

index 8f7ed95a4238fa8b20d8828410cba5ed75e05e3b..b3f17e99622c0df4ab343ed1c7383d723b02e4da 100644 (file)
@@ -325,15 +325,15 @@ struct version_info {
     unsigned long incarnation;   /* actual version number */
     unsigned long feature_set;   /* bitmask of config settings */
     unsigned long entity_count;  /* # of monsters and objects */
-#ifndef WASM
+#ifndef __EMSCRIPTEN__
     unsigned long struct_sizes1; /* size of key structs */
     unsigned long struct_sizes2; /* size of more key structs */
-#else /* WASM */
+#else /* __EMSCRIPTEN__ */
     /* 'long' in WASM is 4 bytes, which is too small to hold version numbers
      * such as: VERSION_SANITY2 */
     unsigned long long struct_sizes1; /* size of key structs */
     unsigned long long struct_sizes2; /* size of more key structs */
-#endif /* !WASM */
+#endif /* !__EMSCRIPTEN__ */
 };
 
 struct savefile_info {
@@ -397,7 +397,7 @@ struct savefile_info {
 
 /* PANICTRACE: Always defined for NH_DEVEL_STATUS != NH_STATUS_RELEASED
    but only for supported platforms. */
-#if defined(UNIX) && !defined(WASM)
+#if defined(UNIX) && !defined(__EMSCRIPTEN__)
 #if (NH_DEVEL_STATUS != NH_STATUS_RELEASED)
 /* see end.c */
 #ifndef PANICTRACE
@@ -412,7 +412,7 @@ struct savefile_info {
 #if defined(MACOSX)
 #define PANICTRACE_LIBC
 #endif
-#if defined(UNIX) && !defined(WASM) /* no popen in WASM */
+#if defined(UNIX) && !defined(__EMSCRIPTEN__) /* no popen in WASM */
 #define PANICTRACE_GDB
 #endif
 
index ce39a3edf9aab5567593b3d67a1b1250f161dce4..cd1cca15948ca51e528034139431531c3750b0b3 100644 (file)
@@ -148,9 +148,6 @@ CXX_V1 = @echo "[CXX] $<"; $(ACTUAL_CXX)
 CXX = $(CXX_V$(QUIETCC))
 
 CFLAGS+=-I../include
-ifdef WANT_WASM
-CFLAGS+=-DWASM
-endif
 
 # LD and LINK might be based on invoking CC and may not be able to substitute
 # for QUIETCC, so feedback from them is handled differently (via $AT)
index e5cf4bc7b2115793dd0c420df37df006f4ce74f5..8715104c84073a1edda92650665d2c9af55f4b71 100644 (file)
@@ -17,7 +17,7 @@ EMCC_LFLAGS=-s WASM=1
 EMCC_LFLAGS+=-s ALLOW_TABLE_GROWTH
 EMCC_LFLAGS+=-s ASYNCIFY -s ASYNCIFY_IMPORTS='["_nhmain"]' -O3
 EMCC_LFLAGS+=-s MODULARIZE
-EMCC_LFLAGS+=-s EXPORTED_FUNCTIONS='["_main"]'
+EMCC_LFLAGS+=-s EXPORTED_FUNCTIONS='["_main", "_stub_graphics_set_callback"]'
 EMCC_LFLAGS+=-s EXPORTED_RUNTIME_METHODS='["cwrap", "ccall", "addFunction", "removeFunction", "UTF8ToString"]'
 EMCC_LFLAGS+=-s ERROR_ON_UNDEFINED_SYMBOLS=0
 EMCC_LFLAGS+=--embed-file wasm-data@/
@@ -25,7 +25,6 @@ EMCC_LFLAGS+=--embed-file wasm-data@/
 # WASM C flags
 EMCC_CFLAGS=
 EMCC_CFLAGS+=-Wall -Werror
-EMCC_CFLAGS+=-DWASM
 EMCC_DEBUG_CFLAGS+=-s ASSERTIONS=1
 EMCC_DEBUG_CFLAGS+=-s STACK_OVERFLOW_CHECK=2
 EMCC_DEBUG_CFLAGS+=-s SAFE_HEAP=1
index 7ff0ec2c96de151dc6c2abb3891da53de11a4870..68421776f6f078565276ac497f85d1866b8dd38f 100644 (file)
@@ -1218,17 +1218,17 @@ do_date()
 #endif
     Fprintf(ofp, "#define VERSION_SANITY1 0x%08lx%s\n", version.entity_count,
             ul_sfx);
-#ifndef WASM
+#ifndef __EMSCRIPTEN__
     Fprintf(ofp, "#define VERSION_SANITY2 0x%08lx%s\n", version.struct_sizes1,
             ul_sfx);
     Fprintf(ofp, "#define VERSION_SANITY3 0x%08lx%s\n", version.struct_sizes2,
             ul_sfx);
-#else /* WASM */
+#else /* __EMSCRIPTEN__ */
     Fprintf(ofp, "#define VERSION_SANITY2 0x%08llx%s\n", version.struct_sizes1,
             ul_sfx);
     Fprintf(ofp, "#define VERSION_SANITY3 0x%08llx%s\n", version.struct_sizes2,
             ul_sfx);
-#endif /* !WASM */
+#endif /* !__EMSCRIPTEN__ */
 
     Fprintf(ofp, "\n");
     Fprintf(ofp, "#define VERSION_STRING \"%s\"\n", version_string(buf, "."));