2021-02-10 16:46:15 -08:00
|
|
|
# -*- 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 08:30:34 -08:00
|
|
|
|
2021-02-01 20:13:25 -08:00
|
|
|
include ../common/config.mk
|
2021-02-01 08:30:34 -08:00
|
|
|
|
2021-02-06 08:52:42 -08:00
|
|
|
DEBS = cmake
|
|
|
|
|
2021-02-26 15:45:35 -08:00
|
|
|
INPUTS = main.c wasmdict.c wasmutls.c wasmdraw.c wasmutil.c wasmdutil.c ${COMMONSRC}
|
2021-02-01 20:13:25 -08:00
|
|
|
|
|
|
|
DEFINES += -DXWFEATURE_CHAT
|
|
|
|
DEFINES += -DXWFEATURE_BONUSALL
|
|
|
|
DEFINES += -DMAX_ROWS=32
|
|
|
|
DEFINES += -DCOMMON_LAYOUT
|
|
|
|
DEFINES += -DDROP_BITMAPS
|
|
|
|
DEFINES += -D__LITTLE_ENDIAN
|
|
|
|
DEFINES += -DXWFEATURE_RELAY
|
2021-02-07 12:48:06 -08:00
|
|
|
# DEFINES += -DXWFEATURE_DEVID
|
2021-02-01 20:13:25 -08:00
|
|
|
DEFINES += -D__WORDSIZE=32
|
2021-02-07 12:48:06 -08:00
|
|
|
# DEFINES += -DCOMMS_CHECKSUM
|
2021-02-01 20:13:25 -08:00
|
|
|
DEFINES += -DENABLE_LOGGING
|
|
|
|
DEFINES += -DKEYBOARD_NAV
|
|
|
|
DEFINES += -DDISABLE_TILE_SEL
|
|
|
|
DEFINES += -DKEY_SUPPORT
|
|
|
|
DEFINES += -DSTREAM_VERS_HASHSTREAM
|
|
|
|
DEFINES += -DXWFEATURE_KNOWNPLAYERS
|
|
|
|
DEFINES += -DXWFEATURE_DICTSANITY
|
2021-02-02 12:04:31 -08:00
|
|
|
DEFINES += -DPOINTER_SUPPORT
|
2021-02-03 08:47:23 -08:00
|
|
|
DEFINES += -DPLATFORM_WASM
|
2021-02-03 12:53:03 -08:00
|
|
|
DEFINES += -DXWFEATURE_CROSSHAIRS
|
2021-02-20 09:04:57 -08:00
|
|
|
DEFINES += -DXWFEATURE_STREAMREF
|
2021-02-23 08:35:50 -08:00
|
|
|
DEFINES += -DXWFEATURE_TURNCHANGENOTIFY
|
2021-03-06 18:51:01 -08:00
|
|
|
DEFINES += -DXWFEATURE_BOARDWORDS
|
2021-03-07 16:10:48 -08:00
|
|
|
DEFINES += -DXWFEATURE_DEVICE
|
2021-02-07 12:48:06 -08:00
|
|
|
DEFINES += -DNATIVE_NLI
|
|
|
|
DEFINES += -DDEBUG_REF
|
2021-02-11 17:57:18 -08:00
|
|
|
DEFINES += -Wno-switch
|
2021-02-21 21:59:03 -08:00
|
|
|
DEFINES += -DGITREV=\"$(shell git describe --tags --dirty)\"
|
2021-02-10 16:46:15 -08:00
|
|
|
|
|
|
|
ifeq ($(MEMDEBUG),TRUE)
|
2021-02-11 17:57:18 -08:00
|
|
|
DEFINES += -DMEM_DEBUG -DDEBUG -O0
|
2021-02-28 21:31:04 -08:00
|
|
|
WEBDIR = dbg
|
2021-03-06 21:23:28 -08:00
|
|
|
ROOT_PATH = "/persisted0.3"
|
2021-02-10 16:46:15 -08:00
|
|
|
else
|
|
|
|
DEFINES += -O3
|
2021-02-28 21:31:04 -08:00
|
|
|
WEBDIR = rel
|
2021-03-06 21:23:28 -08:00
|
|
|
ROOT_PATH = "/persisted_rel0.0"
|
2021-02-10 16:46:15 -08:00
|
|
|
endif
|
2021-03-06 21:23:28 -08:00
|
|
|
DEFINES += -DROOT_PATH=\"$(ROOT_PATH)\"
|
2021-02-10 16:46:15 -08:00
|
|
|
|
2021-02-08 21:51:25 -08:00
|
|
|
OUTPUTS = main.html main.js main.js.mem main.data main.html.mem main.wasm
|
2021-02-01 08:30:34 -08:00
|
|
|
|
2021-02-02 20:58:43 -08:00
|
|
|
all: main.js
|
|
|
|
|
2021-02-09 16:48:00 -08:00
|
|
|
# PHONY: install
|
2021-02-02 22:10:26 -08:00
|
|
|
|
2021-02-08 21:51:25 -08:00
|
|
|
# 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 \
|
|
|
|
# -s "EXTRA_EXPORTED_RUNTIME_METHODS=['ccall']" \
|
|
|
|
# ${INPUTS} -o $@
|
|
|
|
|
|
|
|
# This isn't a thing any more
|
2021-02-16 05:59:54 -08:00
|
|
|
main.html: ${INPUTS} Makefile shell_minimal.html
|
2021-02-08 21:51:25 -08:00
|
|
|
emcc $(DEFINES) -I . -I ../common -I ../relay -s USE_SDL=2 \
|
|
|
|
--preload-file assets_dir --shell-file shell_minimal.html \
|
2021-03-05 09:03:32 -08:00
|
|
|
-s USE_SDL_TTF=2 -s USE_SDL_IMAGE=2 -s SDL2_IMAGE_FORMATS='["png"]' -lidbfs.js \
|
2021-02-02 20:58:43 -08:00
|
|
|
-s "EXTRA_EXPORTED_RUNTIME_METHODS=['ccall']" \
|
2021-03-05 09:03:32 -08:00
|
|
|
-s EXPORTED_FUNCTIONS='["_main", "_mainPostSync", "_cbckBinary", "_cbckVoid", "_cbckString", "_MQTTConnectedChanged", "_onNewGame", "_gotDictBinary"]' \
|
2021-02-08 21:51:25 -08:00
|
|
|
-s WASM=1 \
|
2021-02-02 09:08:41 -08:00
|
|
|
${INPUTS} -o $@
|
2021-02-02 22:10:26 -08:00
|
|
|
|
2021-02-16 05:59:54 -08:00
|
|
|
install: main.html
|
2021-02-06 08:52:42 -08:00
|
|
|
if [ -n "${XW_WASM_DEST}" ]; then \
|
2021-02-16 05:59:54 -08:00
|
|
|
for FILE in ${OUTPUTS} paho-mqtt.js xwutils.js; do \
|
2021-02-28 21:31:04 -08:00
|
|
|
[ -f $$FILE ] && scp $$FILE ${XW_WASM_DEST}/${WEBDIR}/; \
|
2021-02-06 09:23:39 -08:00
|
|
|
echo "$$FILE copied"; \
|
|
|
|
done; \
|
2021-02-06 08:52:42 -08:00
|
|
|
fi
|
2021-02-03 11:47:03 -08:00
|
|
|
|
|
|
|
clean:
|
2021-02-06 09:23:39 -08:00
|
|
|
rm -f ${OUTPUTS}
|
2021-02-06 08:52:42 -08:00
|
|
|
|
|
|
|
debs_install:
|
|
|
|
sudo apt-get install ${DEBS}
|