tibia/templates/web-make/Makefile

56 lines
1.4 KiB
Makefile
Raw Normal View History

2024-01-17 16:31:14 +00:00
include vars.mk
2024-02-01 05:59:10 +00:00
COMMON_DIR := $(or $(COMMON_DIR),.)
DATA_DIR := $(or $(DATA_DIR),.)
PLUGIN_DIR := $(or $(PLUGIN_DIR),src)
2024-01-17 16:31:14 +00:00
CC = clang
CFLAGS = -Ofast -Wall -Wpedantic -Wextra
2024-02-01 05:59:10 +00:00
CFLAGS_ALL = -I${COMMON_DIR}/src -I${DATA_DIR}/src -I${PLUGIN_DIR} --target=wasm32 -flto -fvisibility=hidden ${CFLAGS} ${CFLAGS_EXTRA}
LDFLAGS_ALL = \
2024-01-17 16:31:14 +00:00
-Wl,--allow-undefined \
-Wl,--no-entry \
-Wl,--lto-O3 \
-Wl,-strip-all \
-Wl,--export-table \
2024-01-18 14:30:38 +00:00
-Wl,--export=processor_new \
-Wl,--export=processor_free \
2024-01-19 14:33:53 +00:00
-Wl,--export=processor_get_x_buf \
-Wl,--export=processor_get_y_buf \
-Wl,--export=processor_get_out_params \
2024-01-18 14:30:38 +00:00
-Wl,--export=processor_process \
-Wl,--export=processor_set_parameter \
2024-01-17 16:31:14 +00:00
-Wl,-z,stack-size=$$((8*1024*1024)) \
-nostdlib
2024-01-19 16:28:00 +00:00
ifeq (${HAS_MIDI_IN}, yes)
LDFLAGS_ALL += -Wl,--export=processor_midi_msg_in
2024-01-19 16:28:00 +00:00
endif
LDFLAGS_ALL += ${LDFLAGS} ${LDFLAGS_EXTRA}
2024-01-19 16:28:00 +00:00
2024-01-18 17:13:31 +00:00
ALL = build/${BUNDLE_NAME}.wasm build/${BUNDLE_NAME}_processor.js build/${BUNDLE_NAME}.js
default: all
2024-02-01 05:59:10 +00:00
-include ${COMMON_DIR}/demo.mk
2024-01-18 17:13:31 +00:00
all: ${ALL}
2024-01-17 16:31:14 +00:00
2024-02-01 05:59:10 +00:00
build/${BUNDLE_NAME}.wasm: ${COMMON_DIR}/src/memset.h ${COMMON_DIR}/src/walloc.h ${COMMON_DIR}/src/processor.c ${DATA_DIR}/src/data.h ${PLUGIN_DIR}/plugin.h | build
${CC} ${COMMON_DIR}/src/processor.c -o $@ ${CFLAGS_ALL} ${LDFLAGS_ALL}
2024-01-18 14:30:38 +00:00
2024-02-01 05:59:10 +00:00
build/${BUNDLE_NAME}_processor.js: ${DATA_DIR}/src/processor.js | build
2024-01-18 14:30:38 +00:00
cp $^ $@
2024-01-17 16:31:14 +00:00
2024-02-01 05:59:10 +00:00
build/${BUNDLE_NAME}.js: ${DATA_DIR}/src/module.js | build
2024-01-18 17:13:31 +00:00
cp $^ $@
2024-01-17 16:31:14 +00:00
build:
mkdir -p $@
clean:
rm -fr build
.PHONY: all clean