73 lines
2.9 KiB
Makefile
73 lines
2.9 KiB
Makefile
.PHONY: help
|
|
help:
|
|
@echo
|
|
@echo "Shrooms Virtual Boy core module - October 15, 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 " util Check the C utility 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 -O3 \
|
|
-Werror -std=c90 -Wall -Wextra -Wpedantic -fno-strict-aliasing
|
|
# GCC compilation control
|
|
@gcc core/vb.c -I core -c -o /dev/null -O3 \
|
|
-Werror -std=c90 -Wall -Wextra -Wpedantic -fno-strict-aliasing \
|
|
-D VB_LITTLE_ENDIAN -D VB_SIGNED_PROPAGATE -D VB_DIV_GENERIC \
|
|
-D VB_DIRECT_EXCEPTION=textException -D VB_DIRECT_EXECUTE=textExecute \
|
|
-D VB_DIRECT_FETCH=testFetch -D VB_DIRECT_FRAME=testFrame \
|
|
-D VB_DIRECT_WRITE=testWrite -D VB_DIRECT_SAMPLES=testSamples \
|
|
-D VB_DIRECT_READ=testRead -D VB_DIRECT_LINK=testLink
|
|
# Clang generic
|
|
@emcc core/vb.c -I core -c -o /dev/null -O3 \
|
|
-Werror -std=c90 -Wall -Wextra -Wpedantic -fno-strict-aliasing
|
|
# Clang compilation control
|
|
@emcc core/vb.c -I core -c -o /dev/null -O3 \
|
|
-Werror -std=c90 -Wall -Wextra -Wpedantic -fno-strict-aliasing \
|
|
-D VB_LITTLE_ENDIAN -D VB_SIGNED_PROPAGATE -D VB_DIV_GENERIC \
|
|
-D VB_DIRECT_EXCEPTION=textException -D VB_DIRECT_EXECUTE=textExecute \
|
|
-D VB_DIRECT_FETCH=testFetch -D VB_DIRECT_FRAME=testFrame \
|
|
-D VB_DIRECT_WRITE=testWrite -D VB_DIRECT_SAMPLES=testSamples \
|
|
-D VB_DIRECT_READ=testRead -D VB_DIRECT_LINK=testLink
|
|
|
|
.PHONY: util
|
|
util:
|
|
# GCC generic
|
|
@gcc util/vbu.c -I core -I util -c -o /dev/null -O3 \
|
|
-Werror -std=c90 -Wall -Wextra -Wpedantic -fno-strict-aliasing
|
|
# GCC compilation control
|
|
@gcc util/vbu.c -I core -I util -c -o /dev/null -O3 \
|
|
-Werror -std=c90 -Wall -Wextra -Wpedantic -fno-strict-aliasing \
|
|
-D VB_SIGNED_PROPAGATE -D VBU_REALLOC=testRealloc
|
|
# Clang generic
|
|
@emcc util/vbu.c -I core -I util -c -o /dev/null -O3 \
|
|
-Werror -std=c90 -Wall -Wextra -Wpedantic -fno-strict-aliasing
|
|
# Clang compilation control
|
|
@emcc util/vbu.c -I core -I util -c -o /dev/null -O3 \
|
|
-Werror -std=c90 -Wall -Wextra -Wpedantic -fno-strict-aliasing \
|
|
-D VB_SIGNED_PROPAGATE -D VBU_REALLOC=testRealloc
|
|
|
|
.PHONY: wasm
|
|
wasm:
|
|
@emcc -o web/core.wasm web/wasm.c core/vb.c util/vbu.c -I core -I util \
|
|
-D VB_LITTLE_ENDIAN -D VB_SIGNED_PROPAGATE \
|
|
-D "VBAPI=__attribute__((used))" -D "VBUAPI=__attribute__((used))" \
|
|
-D VB_DIRECT_FRAME=wasmOnFrame \
|
|
--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*
|