shrooms-vb-core/makefile

72 lines
2.8 KiB
Makefile
Raw Normal View History

2024-10-14 20:07:00 +00:00
.PHONY: help
help:
@echo
2024-10-15 19:11:29 +00:00
@echo "Shrooms Virtual Boy core module - October 15, 2024"
2024-10-14 20:07:00 +00:00
@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"
2024-10-30 14:52:33 +00:00
@echo " util Check the C utility source for compiler warnings"
2024-10-14 20:07:00 +00:00
@echo " wasm Build the WebAssembly module"
@echo
.PHONY: clean
clean:
@rm -f web/core.wasm
.PHONY: core
core:
# GCC generic
2024-10-19 22:01:36 +00:00
@gcc core/vb.c -I core -c -o /dev/null -O3 \
-Werror -std=c90 -Wall -Wextra -Wpedantic -fno-strict-aliasing
2024-10-14 20:07:00 +00:00
# GCC compilation control
2024-10-19 22:01:36 +00:00
@gcc core/vb.c -I core -c -o /dev/null -O3 \
-Werror -std=c90 -Wall -Wextra -Wpedantic -fno-strict-aliasing \
2024-10-14 20:07:00 +00:00
-D VB_LITTLE_ENDIAN -D VB_SIGNED_PROPAGATE -D VB_DIV_GENERIC \
2024-10-15 19:11:29 +00:00
-D VB_DIRECT_EXCEPTION=textException -D VB_DIRECT_EXECUTE=textExecute \
2024-10-17 01:14:38 +00:00
-D VB_DIRECT_FETCH=testFetch -D VB_DIRECT_FRAME=testFrame \
2024-10-22 00:39:35 +00:00
-D VB_DIRECT_WRITE=testWrite -D VB_DIRECT_SAMPLES=testSamples \
2024-10-30 14:48:56 +00:00
-D VB_DIRECT_READ=testRead -D VB_DIRECT_LINK=testLink
2024-10-14 20:07:00 +00:00
# Clang generic
2024-10-19 22:01:36 +00:00
@emcc core/vb.c -I core -c -o /dev/null -O3 \
-Werror -std=c90 -Wall -Wextra -Wpedantic -fno-strict-aliasing
2024-10-14 20:07:00 +00:00
# Clang compilation control
2024-10-19 22:01:36 +00:00
@emcc core/vb.c -I core -c -o /dev/null -O3 \
-Werror -std=c90 -Wall -Wextra -Wpedantic -fno-strict-aliasing \
2024-10-14 20:07:00 +00:00
-D VB_LITTLE_ENDIAN -D VB_SIGNED_PROPAGATE -D VB_DIV_GENERIC \
2024-10-15 19:11:29 +00:00
-D VB_DIRECT_EXCEPTION=textException -D VB_DIRECT_EXECUTE=textExecute \
2024-10-17 01:14:38 +00:00
-D VB_DIRECT_FETCH=testFetch -D VB_DIRECT_FRAME=testFrame \
2024-10-22 00:39:35 +00:00
-D VB_DIRECT_WRITE=testWrite -D VB_DIRECT_SAMPLES=testSamples \
2024-10-30 14:48:56 +00:00
-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
2024-10-30 14:52:33 +00:00
# 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
2024-10-14 20:07:00 +00:00
.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))" \
2024-10-22 00:39:35 +00:00
--no-entry -O2 -flto -s WASM=1 -s WARN_ON_UNDEFINED_SYMBOLS=0 \
2024-10-14 20:07:00 +00:00
-s EXPORTED_RUNTIME_METHODS=[] -s ALLOW_MEMORY_GROWTH \
-s MAXIMUM_MEMORY=4GB -fno-strict-aliasing
@rm -f web/*.wasm.tmp*