50 lines
1.7 KiB
Makefile
50 lines
1.7 KiB
Makefile
|
.PHONY: help
|
||
|
help:
|
||
|
@echo
|
||
|
@echo "Shrooms Virtual Boy core module - October 14, 2024"
|
||
|
@echo
|
||
|
@echo "Target build environment is any Debian with the following packages:"
|
||
|
@echo " emscripten"
|
||
|
@echo " gcc"
|
||
|
@echo
|
||
|
@echo "Available make targets:"
|
||
|
@echo " clean Remove output files"
|
||
|
@echo " core Check the C core source for compiler warnings"
|
||
|
@echo " wasm Build the WebAssembly module"
|
||
|
@echo
|
||
|
|
||
|
.PHONY: clean
|
||
|
clean:
|
||
|
@rm -f web/core.wasm
|
||
|
|
||
|
.PHONY: core
|
||
|
core:
|
||
|
# GCC generic
|
||
|
@gcc core/vb.c -I core -c -o /dev/null \
|
||
|
-Werror -std=c90 -Wall -Wextra -Wpedantic
|
||
|
# GCC compilation control
|
||
|
@gcc core/vb.c -I core -c -o /dev/null \
|
||
|
-Werror -std=c90 -Wall -Wextra -Wpedantic \
|
||
|
-D VB_LITTLE_ENDIAN -D VB_SIGNED_PROPAGATE -D VB_DIV_GENERIC \
|
||
|
-D VB_DIRECT_EXCEPTION -D VB_DIRECT_EXECUTE -D VB_DIRECT_FETCH \
|
||
|
-D VB_DIRECT_READ -D VB_DIRECT_WRITE -D VB_DIV_GENERIC
|
||
|
# Clang generic
|
||
|
@emcc core/vb.c -I core -c -o /dev/null \
|
||
|
-Werror -std=c90 -Wall -Wextra -Wpedantic
|
||
|
# Clang compilation control
|
||
|
@emcc core/vb.c -I core -c -o /dev/null \
|
||
|
-Werror -std=c90 -Wall -Wextra -Wpedantic \
|
||
|
-D VB_LITTLE_ENDIAN -D VB_SIGNED_PROPAGATE -D VB_DIV_GENERIC \
|
||
|
-D VB_DIRECT_EXCEPTION -D VB_DIRECT_EXECUTE -D VB_DIRECT_FETCH \
|
||
|
-D VB_DIRECT_READ -D VB_DIRECT_WRITE -D VB_DIV_GENERIC
|
||
|
|
||
|
.PHONY: wasm
|
||
|
wasm:
|
||
|
@emcc -o web/core.wasm web/wasm.c core/vb.c -I core \
|
||
|
-D VB_LITTLE_ENDIAN -D VB_SIGNED_PROPAGATE \
|
||
|
-D "VBAPI=__attribute__((used))" \
|
||
|
--no-entry -O2 -flto -s WASM=1 \
|
||
|
-s EXPORTED_RUNTIME_METHODS=[] -s ALLOW_MEMORY_GROWTH \
|
||
|
-s MAXIMUM_MEMORY=4GB -fno-strict-aliasing
|
||
|
@rm -f web/*.wasm.tmp*
|