xwords/xwords4/wasm/Makefile

119 lines
3.8 KiB
Makefile
Raw Normal View History

# -*- mode: makefile; compile-command: "make -j3 MEMDEBUG=TRUE install"; -*-
# Copyright 2021 by Eric House (xwords@eehouse.org). All rights
# reserved.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
2021-02-01 17:30:34 +01:00
2021-02-02 05:13:25 +01:00
include ../common/config.mk
2021-02-01 17:30:34 +01:00
2021-02-06 17:52:42 +01:00
DEBS = cmake
2021-02-27 00:45:35 +01:00
INPUTS = main.c wasmdict.c wasmutls.c wasmdraw.c wasmutil.c wasmdutil.c ${COMMONSRC}
2021-02-02 05:13:25 +01:00
DEFINES += -DXWFEATURE_BONUSALL
DEFINES += -DMAX_ROWS=32
DEFINES += -DCOMMON_LAYOUT
DEFINES += -DDROP_BITMAPS
DEFINES += -D__LITTLE_ENDIAN
2021-02-07 21:48:06 +01:00
# DEFINES += -DXWFEATURE_DEVID
2021-02-02 05:13:25 +01:00
DEFINES += -D__WORDSIZE=32
2021-02-07 21:48:06 +01:00
# DEFINES += -DCOMMS_CHECKSUM
2021-03-12 06:41:46 +01:00
DEFINES += -DXWFEATURE_COMMSACK
2021-02-02 05:13:25 +01:00
DEFINES += -DENABLE_LOGGING
DEFINES += -DKEYBOARD_NAV
2021-03-24 23:58:25 +01:00
DEFINES += -DXWFEATURE_CHAT
2021-02-02 05:13:25 +01:00
DEFINES += -DDISABLE_TILE_SEL
DEFINES += -DKEY_SUPPORT
DEFINES += -DSTREAM_VERS_HASHSTREAM
DEFINES += -DXWFEATURE_KNOWNPLAYERS
DEFINES += -DXWFEATURE_DICTSANITY
DEFINES += -DPOINTER_SUPPORT
2021-02-03 17:47:23 +01:00
DEFINES += -DPLATFORM_WASM
2021-02-03 21:53:03 +01:00
DEFINES += -DXWFEATURE_CROSSHAIRS
2021-02-20 18:04:57 +01:00
DEFINES += -DXWFEATURE_STREAMREF
DEFINES += -DXWFEATURE_TURNCHANGENOTIFY
DEFINES += -DXWFEATURE_BOARDWORDS
2021-03-08 01:10:48 +01:00
DEFINES += -DXWFEATURE_DEVICE
2021-02-07 21:48:06 +01:00
DEFINES += -DNATIVE_NLI
DEFINES += -DDEBUG_REF
DEFINES += -DXWFEATURE_COMMS_INVITE
DEFINES += -DMQTT_DEV_TOPICS
DEFINES += -DMQTT_GAMEID_TOPICS
DEFINES += -DXWFEATURE_NLI_FROM_ARGV
DEFINES += -DNO_NATIVE_MD5SDUM
2021-02-12 02:57:18 +01:00
DEFINES += -Wno-switch
2021-02-22 06:59:03 +01:00
DEFINES += -DGITREV=\"$(shell git describe --tags --dirty)\"
ifeq ($(MEMDEBUG),TRUE)
2021-02-12 02:57:18 +01:00
DEFINES += -DMEM_DEBUG -DDEBUG -O0
2021-03-09 20:01:38 +01:00
WEBDIR = wasm/dbg
ROOT_PATH = "/persisted0.3"
else
DEFINES += -O3
2021-03-09 20:01:38 +01:00
WEBDIR = wasm/rel
ROOT_PATH = "/persisted_rel0.0"
endif
DEFINES += -DROOT_PATH=\"$(ROOT_PATH)\"
OUTPUTS = main.html main.js main.js.mem main.data main.html.mem main.wasm
2021-02-01 17:30:34 +01:00
all: main.html
2021-02-03 05:58:43 +01:00
2021-02-10 01:48:00 +01:00
# PHONY: install
# main.js: ${INPUTS} Makefile
# emcc $(DEFINES) -O2 -I . -I ../common -I ../relay -s USE_SDL=2 \
# --preload-file assets_dir --memory-init-file 1 \
# -s USE_SDL_TTF=2 -s USE_SDL_IMAGE=2 -s SDL2_IMAGE_FORMATS='["png"]' \
# -s EXPORTED_FUNCTIONS='["_mainf", "_button", "_newgame", "_gotMQTTMsg"]' -s WASM=0 \
2022-01-04 21:45:01 +01:00
# -s "EXPORTED_RUNTIME_METHODS=['ccall']" \
# ${INPUTS} -o $@
# This isn't a thing any more
main.html: ${INPUTS} Makefile shell_minimal.html
emcc $(DEFINES) -I . -I ../common -I ../relay -s USE_SDL=2 \
--preload-file assets_dir --shell-file shell_minimal.html \
2021-03-05 18:03:32 +01:00
-s USE_SDL_TTF=2 -s USE_SDL_IMAGE=2 -s SDL2_IMAGE_FORMATS='["png"]' -lidbfs.js \
2022-01-04 21:45:01 +01:00
-s "EXPORTED_RUNTIME_METHODS=['ccall']" \
2023-02-23 19:55:05 +01:00
-s EXPORTED_FUNCTIONS='["_main", "_mainPostSync", "_cbckMsg", "_cbckVoid", "_cbckString", "_MQTTConnectedChanged", "_onNewGame", "_gotDictBinary", "_onResize"]' \
-s WASM=1 \
2021-02-02 18:08:41 +01:00
${INPUTS} -o $@
install: main.html
2022-01-04 21:45:01 +01:00
@if [ -n "${XW_WASM_DEST}" -a -n "${XW_WASM_HOST}" ]; then \
2022-01-03 16:58:22 +01:00
ssh "${XW_WASM_HOST}" mkdir -p ${XW_WASM_DEST}/${WEBDIR}/; \
for FILE in ${OUTPUTS} paho-mqtt.js xwutils.js; do \
2022-01-04 21:45:01 +01:00
if [ -f $$FILE ]; then \
scp $$FILE ${XW_WASM_HOST}:${XW_WASM_DEST}/${WEBDIR}/; \
echo "$$FILE copied"; \
fi; \
2021-02-06 18:23:39 +01:00
done; \
2022-01-04 21:45:01 +01:00
else \
echo "ERROR: XW_WASM_DEST ($$XW_WASM_DEST) or XW_WASM_HOST ($$XW_WASM_HOST) unset"; \
2021-02-06 17:52:42 +01:00
fi
2021-02-03 20:47:03 +01:00
clean:
2021-02-06 18:23:39 +01:00
rm -f ${OUTPUTS}
2021-02-06 17:52:42 +01:00
debs_install:
sudo apt-get install ${DEBS}
2022-01-04 21:45:01 +01:00
help:
@echo 'usage: debs_install OR'
@echo 'usage: make [MEMDEBUG=TRUE] [clean] install'
@echo '(expects XW_WASM_HOST and XW_WASM_DEST to be set in env)'