diff --git a/TODO b/TODO index e892a67..9d34d9e 100644 --- a/TODO +++ b/TODO @@ -31,6 +31,5 @@ build system: * make autodependencies (.d?) * make from... directories * order-only prerequisites to avoid multiple make updates? (https://interrupt.memfault.com/blog/gnu-make-guidelines#order-only-prerequisites) -* clang + Ofast & bulk memory (maybe using old binaryen) - or implement memset etc. * put common parts of Makefiles together somewhere/somehow (DRY) * recursive make? diff --git a/examples/fx_bitcrush/web/index.html b/examples/common/web/index-fx.html similarity index 100% rename from examples/fx_bitcrush/web/index.html rename to examples/common/web/index-fx.html diff --git a/examples/synth_mono/web/index.html b/examples/common/web/index-synth.html similarity index 100% rename from examples/synth_mono/web/index.html rename to examples/common/web/index-synth.html diff --git a/examples/common/web/memset.c b/examples/common/web/memset.c new file mode 100644 index 0000000..991a99a --- /dev/null +++ b/examples/common/web/memset.c @@ -0,0 +1,28 @@ +/* + * Brickworks + * + * Copyright (C) 2021, 2022 Orastron Srl unipersonale + * + * Brickworks 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, version 3 of the License. + * + * Brickworks 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 Brickworks. If not, see . + * + * File author: Stefano D'Angelo + */ + +#include + +void *memset(void *ptr, int value, size_t num) { + unsigned char *p = (unsigned char *)ptr; + for (size_t i = 0; i < num; i++) + p[i] = (unsigned char)value; + return ptr; +} diff --git a/examples/common/web/web.mk b/examples/common/web/web.mk new file mode 100644 index 0000000..239bc6f --- /dev/null +++ b/examples/common/web/web.mk @@ -0,0 +1,71 @@ +CC := clang +CFLAGS := \ + -D__WASM__ \ + -I${ROOT_DIR}/../src \ + -I${ROOT_DIR}/../../common/web \ + -I${ROOT_DIR}/../../../include \ + --target=wasm32 \ + -flto \ + -fvisibility=hidden \ + -Ofast +LDFLAGS := \ + -Wl,--allow-undefined \ + -Wl,--no-entry \ + -Wl,--lto-O3 \ + -Wl,-strip-all \ + -Wl,--export-table \ + -Wl,--export=wrapper_new \ + -Wl,--export=wrapper_free \ + -Wl,--export=wrapper_get_ins \ + -Wl,--export=wrapper_get_outs \ + -Wl,--export=wrapper_get_param_values \ + -Wl,--export=wrapper_process \ + -Wl,--export=wrapper_set_parameter \ + -Wl,-z,stack-size=$$((8*1024*1024)) \ + -nostdlib +ifdef SYNTH +LDFLAGS += \ + -Wl,--export=wrapper_note_on \ + -Wl,--export=wrapper_note_off + +INDEX := ${ROOT_DIR}/../../common/web/index-synth.html +else +INDEX := ${ROOT_DIR}/../../common/web/index-fx.html +endif + +SOURCES_COMMON := \ + ${ROOT_DIR}/../../common/web/walloc.c \ + ${ROOT_DIR}/../../common/web/wrapper.c + +ifdef NEEDS_MEMSET +SOURCES_COMMON += \ + ${ROOT_DIR}/../../common/web/memset.c + +LDFLAGS += \ + -Wl,--export=memset +endif + +all: build/web/module.wasm build/web/index.html build/web/config.js build/web/processor.js build/web/cert.pem build/web/key.pem + +build/web/module.wasm: build/web ${SOURCES} + ${CC} ${SOURCES} ${CFLAGS} ${LDFLAGS} -o $@ + +build/web/index.html: build/web ${INDEX} + cp ${INDEX} $@ + +build/web/processor.js: build/web ${ROOT_DIR}/config.js ${ROOT_DIR}/../../common/web/processor.js + cat ${ROOT_DIR}/config.js ${ROOT_DIR}/../../common/web//processor.js > $@ + +build/web/config.js: build/web ${ROOT_DIR}/config.js + cp ${ROOT_DIR}/config.js $@ + +build/web/key.pem: build/web/cert.pem + +build/web/cert.pem: build/web + yes "" | openssl req -x509 -newkey rsa:2048 -keyout build/web/key.pem -out build/web/cert.pem -days 365 -nodes 2>/dev/null + +build/web: + mkdir -p build/web + +clean: + rm -fr build/web diff --git a/examples/fx_bitcrush/web/Makefile b/examples/fx_bitcrush/web/Makefile index abdb8d6..f7964bb 100644 --- a/examples/fx_bitcrush/web/Makefile +++ b/examples/fx_bitcrush/web/Makefile @@ -1,56 +1,4 @@ -CC=clang -CFLAGS= \ - -D__WASM__ \ - -I${ROOT_DIR}/../src \ - -I${ROOT_DIR}/../../common/web \ - -I${ROOT_DIR}/../../../include \ - --target=wasm32 \ - -flto \ - -fvisibility=hidden \ - -Ofast -LDFLAGS= \ - -Wl,--allow-undefined \ - -Wl,--no-entry \ - -Wl,--lto-O3 \ - -Wl,-strip-all \ - -Wl,--export-table \ - -Wl,--export=wrapper_new \ - -Wl,--export=wrapper_free \ - -Wl,--export=wrapper_get_ins \ - -Wl,--export=wrapper_get_outs \ - -Wl,--export=wrapper_get_param_values \ - -Wl,--export=wrapper_process \ - -Wl,--export=wrapper_set_parameter \ - -Wl,-z,stack-size=$$((8*1024*1024)) \ - -nostdlib +ROOT_DIR := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST)))) +SOURCES = ${SOURCES_COMMON} ${ROOT_DIR}/../src/bw_example_fx_bitcrush.c -ROOT_DIR=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST)))) -SOURCES= \ - ${ROOT_DIR}/../src/bw_example_fx_bitcrush.c \ - ${ROOT_DIR}/../../common/web/walloc.c \ - ${ROOT_DIR}/../../common/web/wrapper.c - -all: build/web/module.wasm build/web/index.html build/web/config.js build/web/processor.js build/web/cert.pem build/web/key.pem - -build/web/module.wasm: build/web ${SOURCES} - ${CC} ${SOURCES} ${CFLAGS} ${LDFLAGS} -o $@ - -build/web/index.html: build/web ${ROOT_DIR}/index.html - cp ${ROOT_DIR}/index.html $@ - -build/web/processor.js: build/web ${ROOT_DIR}/config.js ${ROOT_DIR}/../../common/web/processor.js - cat ${ROOT_DIR}/config.js ${ROOT_DIR}/../../common/web//processor.js > $@ - -build/web/config.js: build/web ${ROOT_DIR}/config.js - cp ${ROOT_DIR}/config.js $@ - -build/web/key.pem: build/web/cert.pem - -build/web/cert.pem: build/web - yes "" | openssl req -x509 -newkey rsa:2048 -keyout build/web/key.pem -out build/web/cert.pem -days 365 -nodes 2>/dev/null - -build/web: - mkdir -p build/web - -clean: - rm -fr build/web +include ${ROOT_DIR}/../../common/web/web.mk diff --git a/examples/fx_comp/web/Makefile b/examples/fx_comp/web/Makefile index a29443d..820f961 100644 --- a/examples/fx_comp/web/Makefile +++ b/examples/fx_comp/web/Makefile @@ -1,56 +1,4 @@ -CC=clang -CFLAGS= \ - -D__WASM__ \ - -I${ROOT_DIR}/../src \ - -I${ROOT_DIR}/../../common/web \ - -I${ROOT_DIR}/../../../include \ - --target=wasm32 \ - -flto \ - -fvisibility=hidden \ - -Ofast -LDFLAGS= \ - -Wl,--allow-undefined \ - -Wl,--no-entry \ - -Wl,--lto-O3 \ - -Wl,-strip-all \ - -Wl,--export-table \ - -Wl,--export=wrapper_new \ - -Wl,--export=wrapper_free \ - -Wl,--export=wrapper_get_ins \ - -Wl,--export=wrapper_get_outs \ - -Wl,--export=wrapper_get_param_values \ - -Wl,--export=wrapper_process \ - -Wl,--export=wrapper_set_parameter \ - -Wl,-z,stack-size=$$((8*1024*1024)) \ - -nostdlib +ROOT_DIR := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST)))) +SOURCES = ${SOURCES_COMMON} ${ROOT_DIR}/../src/bw_example_fx_comp.c -ROOT_DIR=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST)))) -SOURCES= \ - ${ROOT_DIR}/../src/bw_example_fx_comp.c \ - ${ROOT_DIR}/../../common/web/walloc.c \ - ${ROOT_DIR}/../../common/web/wrapper.c - -all: build/web/module.wasm build/web/index.html build/web/config.js build/web/processor.js build/web/cert.pem build/web/key.pem - -build/web/module.wasm: build/web ${SOURCES} - ${CC} ${SOURCES} ${CFLAGS} ${LDFLAGS} -o $@ - -build/web/index.html: build/web ${ROOT_DIR}/index.html - cp ${ROOT_DIR}/index.html $@ - -build/web/processor.js: build/web ${ROOT_DIR}/config.js ${ROOT_DIR}/../../common/web/processor.js - cat ${ROOT_DIR}/config.js ${ROOT_DIR}/../../common/web//processor.js > $@ - -build/web/config.js: build/web ${ROOT_DIR}/config.js - cp ${ROOT_DIR}/config.js $@ - -build/web/key.pem: build/web/cert.pem - -build/web/cert.pem: build/web - yes "" | openssl req -x509 -newkey rsa:2048 -keyout build/web/key.pem -out build/web/cert.pem -days 365 -nodes 2>/dev/null - -build/web: - mkdir -p build/web - -clean: - rm -fr build/web +include ${ROOT_DIR}/../../common/web/web.mk diff --git a/examples/fx_comp/web/index.html b/examples/fx_comp/web/index.html deleted file mode 100644 index a8874e5..0000000 --- a/examples/fx_comp/web/index.html +++ /dev/null @@ -1,210 +0,0 @@ - - - - - Brickworks web effect example - - - - -

Brickworks web effect example

- - - - - diff --git a/examples/fx_mm1/web/Makefile b/examples/fx_mm1/web/Makefile index b0e0958..b5e795f 100644 --- a/examples/fx_mm1/web/Makefile +++ b/examples/fx_mm1/web/Makefile @@ -1,56 +1,4 @@ -CC=clang -CFLAGS= \ - -D__WASM__ \ - -I${ROOT_DIR}/../src \ - -I${ROOT_DIR}/../../common/web \ - -I${ROOT_DIR}/../../../include \ - --target=wasm32 \ - -flto \ - -fvisibility=hidden \ - -Ofast -LDFLAGS= \ - -Wl,--allow-undefined \ - -Wl,--no-entry \ - -Wl,--lto-O3 \ - -Wl,-strip-all \ - -Wl,--export-table \ - -Wl,--export=wrapper_new \ - -Wl,--export=wrapper_free \ - -Wl,--export=wrapper_get_ins \ - -Wl,--export=wrapper_get_outs \ - -Wl,--export=wrapper_get_param_values \ - -Wl,--export=wrapper_process \ - -Wl,--export=wrapper_set_parameter \ - -Wl,-z,stack-size=$$((8*1024*1024)) \ - -nostdlib +ROOT_DIR := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST)))) +SOURCES = ${SOURCES_COMMON} ${ROOT_DIR}/../src/bw_example_fx_mm1.c -ROOT_DIR=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST)))) -SOURCES= \ - ${ROOT_DIR}/../src/bw_example_fx_mm1.c \ - ${ROOT_DIR}/../../common/web/walloc.c \ - ${ROOT_DIR}/../../common/web/wrapper.c - -all: build/web/module.wasm build/web/index.html build/web/config.js build/web/processor.js build/web/cert.pem build/web/key.pem - -build/web/module.wasm: build/web ${SOURCES} - ${CC} ${SOURCES} ${CFLAGS} ${LDFLAGS} -o $@ - -build/web/index.html: build/web ${ROOT_DIR}/index.html - cp ${ROOT_DIR}/index.html $@ - -build/web/processor.js: build/web ${ROOT_DIR}/config.js ${ROOT_DIR}/../../common/web/processor.js - cat ${ROOT_DIR}/config.js ${ROOT_DIR}/../../common/web//processor.js > $@ - -build/web/config.js: build/web ${ROOT_DIR}/config.js - cp ${ROOT_DIR}/config.js $@ - -build/web/key.pem: build/web/cert.pem - -build/web/cert.pem: build/web - yes "" | openssl req -x509 -newkey rsa:2048 -keyout build/web/key.pem -out build/web/cert.pem -days 365 -nodes 2>/dev/null - -build/web: - mkdir -p build/web - -clean: - rm -fr build/web +include ${ROOT_DIR}/../../common/web/web.mk diff --git a/examples/fx_mm1/web/index.html b/examples/fx_mm1/web/index.html deleted file mode 100644 index a8874e5..0000000 --- a/examples/fx_mm1/web/index.html +++ /dev/null @@ -1,210 +0,0 @@ - - - - - Brickworks web effect example - - - - -

Brickworks web effect example

- - - - - diff --git a/examples/fx_mm2/web/Makefile b/examples/fx_mm2/web/Makefile index e7c65f1..ccbc772 100644 --- a/examples/fx_mm2/web/Makefile +++ b/examples/fx_mm2/web/Makefile @@ -1,56 +1,4 @@ -CC=clang -CFLAGS= \ - -D__WASM__ \ - -I${ROOT_DIR}/../src \ - -I${ROOT_DIR}/../../common/web \ - -I${ROOT_DIR}/../../../include \ - --target=wasm32 \ - -flto \ - -fvisibility=hidden \ - -Ofast -LDFLAGS= \ - -Wl,--allow-undefined \ - -Wl,--no-entry \ - -Wl,--lto-O3 \ - -Wl,-strip-all \ - -Wl,--export-table \ - -Wl,--export=wrapper_new \ - -Wl,--export=wrapper_free \ - -Wl,--export=wrapper_get_ins \ - -Wl,--export=wrapper_get_outs \ - -Wl,--export=wrapper_get_param_values \ - -Wl,--export=wrapper_process \ - -Wl,--export=wrapper_set_parameter \ - -Wl,-z,stack-size=$$((8*1024*1024)) \ - -nostdlib +ROOT_DIR := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST)))) +SOURCES = ${SOURCES_COMMON} ${ROOT_DIR}/../src/bw_example_fx_mm2.c -ROOT_DIR=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST)))) -SOURCES= \ - ${ROOT_DIR}/../src/bw_example_fx_mm2.c \ - ${ROOT_DIR}/../../common/web/walloc.c \ - ${ROOT_DIR}/../../common/web/wrapper.c - -all: build/web/module.wasm build/web/index.html build/web/config.js build/web/processor.js build/web/cert.pem build/web/key.pem - -build/web/module.wasm: build/web ${SOURCES} - ${CC} ${SOURCES} ${CFLAGS} ${LDFLAGS} -o $@ - -build/web/index.html: build/web ${ROOT_DIR}/index.html - cp ${ROOT_DIR}/index.html $@ - -build/web/processor.js: build/web ${ROOT_DIR}/config.js ${ROOT_DIR}/../../common/web/processor.js - cat ${ROOT_DIR}/config.js ${ROOT_DIR}/../../common/web//processor.js > $@ - -build/web/config.js: build/web ${ROOT_DIR}/config.js - cp ${ROOT_DIR}/config.js $@ - -build/web/key.pem: build/web/cert.pem - -build/web/cert.pem: build/web - yes "" | openssl req -x509 -newkey rsa:2048 -keyout build/web/key.pem -out build/web/cert.pem -days 365 -nodes 2>/dev/null - -build/web: - mkdir -p build/web - -clean: - rm -fr build/web +include ${ROOT_DIR}/../../common/web/web.mk diff --git a/examples/fx_mm2/web/index.html b/examples/fx_mm2/web/index.html deleted file mode 100644 index a8874e5..0000000 --- a/examples/fx_mm2/web/index.html +++ /dev/null @@ -1,210 +0,0 @@ - - - - - Brickworks web effect example - - - - -

Brickworks web effect example

- - - - - diff --git a/examples/fx_noise_gate/web/Makefile b/examples/fx_noise_gate/web/Makefile index bf24e7e..7d41a4a 100644 --- a/examples/fx_noise_gate/web/Makefile +++ b/examples/fx_noise_gate/web/Makefile @@ -1,56 +1,4 @@ -CC=clang -CFLAGS= \ - -D__WASM__ \ - -I${ROOT_DIR}/../src \ - -I${ROOT_DIR}/../../common/web \ - -I${ROOT_DIR}/../../../include \ - --target=wasm32 \ - -flto \ - -fvisibility=hidden \ - -Ofast -LDFLAGS= \ - -Wl,--allow-undefined \ - -Wl,--no-entry \ - -Wl,--lto-O3 \ - -Wl,-strip-all \ - -Wl,--export-table \ - -Wl,--export=wrapper_new \ - -Wl,--export=wrapper_free \ - -Wl,--export=wrapper_get_ins \ - -Wl,--export=wrapper_get_outs \ - -Wl,--export=wrapper_get_param_values \ - -Wl,--export=wrapper_process \ - -Wl,--export=wrapper_set_parameter \ - -Wl,-z,stack-size=$$((8*1024*1024)) \ - -nostdlib +ROOT_DIR := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST)))) +SOURCES = ${SOURCES_COMMON} ${ROOT_DIR}/../src/bw_example_fx_noise_gate.c -ROOT_DIR=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST)))) -SOURCES= \ - ${ROOT_DIR}/../src/bw_example_fx_noise_gate.c \ - ${ROOT_DIR}/../../common/web/walloc.c \ - ${ROOT_DIR}/../../common/web/wrapper.c - -all: build/web/module.wasm build/web/index.html build/web/config.js build/web/processor.js build/web/cert.pem build/web/key.pem - -build/web/module.wasm: build/web ${SOURCES} - ${CC} ${SOURCES} ${CFLAGS} ${LDFLAGS} -o $@ - -build/web/index.html: build/web ${ROOT_DIR}/index.html - cp ${ROOT_DIR}/index.html $@ - -build/web/processor.js: build/web ${ROOT_DIR}/config.js ${ROOT_DIR}/../../common/web/processor.js - cat ${ROOT_DIR}/config.js ${ROOT_DIR}/../../common/web//processor.js > $@ - -build/web/config.js: build/web ${ROOT_DIR}/config.js - cp ${ROOT_DIR}/config.js $@ - -build/web/key.pem: build/web/cert.pem - -build/web/cert.pem: build/web - yes "" | openssl req -x509 -newkey rsa:2048 -keyout build/web/key.pem -out build/web/cert.pem -days 365 -nodes 2>/dev/null - -build/web: - mkdir -p build/web - -clean: - rm -fr build/web +include ${ROOT_DIR}/../../common/web/web.mk diff --git a/examples/fx_noise_gate/web/index.html b/examples/fx_noise_gate/web/index.html deleted file mode 100644 index a8874e5..0000000 --- a/examples/fx_noise_gate/web/index.html +++ /dev/null @@ -1,210 +0,0 @@ - - - - - Brickworks web effect example - - - - -

Brickworks web effect example

- - - - - diff --git a/examples/fx_satur/web/Makefile b/examples/fx_satur/web/Makefile index 9f81c12..5ff91be 100644 --- a/examples/fx_satur/web/Makefile +++ b/examples/fx_satur/web/Makefile @@ -1,56 +1,4 @@ -CC=clang -CFLAGS= \ - -D__WASM__ \ - -I${ROOT_DIR}/../src \ - -I${ROOT_DIR}/../../common/web \ - -I${ROOT_DIR}/../../../include \ - --target=wasm32 \ - -flto \ - -fvisibility=hidden \ - -Ofast -LDFLAGS= \ - -Wl,--allow-undefined \ - -Wl,--no-entry \ - -Wl,--lto-O3 \ - -Wl,-strip-all \ - -Wl,--export-table \ - -Wl,--export=wrapper_new \ - -Wl,--export=wrapper_free \ - -Wl,--export=wrapper_get_ins \ - -Wl,--export=wrapper_get_outs \ - -Wl,--export=wrapper_get_param_values \ - -Wl,--export=wrapper_process \ - -Wl,--export=wrapper_set_parameter \ - -Wl,-z,stack-size=$$((8*1024*1024)) \ - -nostdlib +ROOT_DIR := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST)))) +SOURCES = ${SOURCES_COMMON} ${ROOT_DIR}/../src/bw_example_fx_satur.c -ROOT_DIR=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST)))) -SOURCES= \ - ${ROOT_DIR}/../src/bw_example_fx_satur.c \ - ${ROOT_DIR}/../../common/web/walloc.c \ - ${ROOT_DIR}/../../common/web/wrapper.c - -all: build/web/module.wasm build/web/index.html build/web/config.js build/web/processor.js build/web/cert.pem build/web/key.pem - -build/web/module.wasm: build/web ${SOURCES} - ${CC} ${SOURCES} ${CFLAGS} ${LDFLAGS} -o $@ - -build/web/index.html: build/web ${ROOT_DIR}/index.html - cp ${ROOT_DIR}/index.html $@ - -build/web/processor.js: build/web ${ROOT_DIR}/config.js ${ROOT_DIR}/../../common/web/processor.js - cat ${ROOT_DIR}/config.js ${ROOT_DIR}/../../common/web//processor.js > $@ - -build/web/config.js: build/web ${ROOT_DIR}/config.js - cp ${ROOT_DIR}/config.js $@ - -build/web/key.pem: build/web/cert.pem - -build/web/cert.pem: build/web - yes "" | openssl req -x509 -newkey rsa:2048 -keyout build/web/key.pem -out build/web/cert.pem -days 365 -nodes 2>/dev/null - -build/web: - mkdir -p build/web - -clean: - rm -fr build/web +include ${ROOT_DIR}/../../common/web/web.mk diff --git a/examples/fx_satur/web/index.html b/examples/fx_satur/web/index.html deleted file mode 100644 index a8874e5..0000000 --- a/examples/fx_satur/web/index.html +++ /dev/null @@ -1,210 +0,0 @@ - - - - - Brickworks web effect example - - - - -

Brickworks web effect example

- - - - - diff --git a/examples/fx_svf/web/index.html b/examples/fx_svf/web/index.html deleted file mode 100644 index a8874e5..0000000 --- a/examples/fx_svf/web/index.html +++ /dev/null @@ -1,210 +0,0 @@ - - - - - Brickworks web effect example - - - - -

Brickworks web effect example

- - - - - diff --git a/examples/fx_wah/web/Makefile b/examples/fx_wah/web/Makefile index 81a3fe9..bde2269 100644 --- a/examples/fx_wah/web/Makefile +++ b/examples/fx_wah/web/Makefile @@ -1,56 +1,4 @@ -CC=clang -CFLAGS= \ - -D__WASM__ \ - -I${ROOT_DIR}/../src \ - -I${ROOT_DIR}/../../common/web \ - -I${ROOT_DIR}/../../../include \ - --target=wasm32 \ - -flto \ - -fvisibility=hidden \ - -Ofast -LDFLAGS= \ - -Wl,--allow-undefined \ - -Wl,--no-entry \ - -Wl,--lto-O3 \ - -Wl,-strip-all \ - -Wl,--export-table \ - -Wl,--export=wrapper_new \ - -Wl,--export=wrapper_free \ - -Wl,--export=wrapper_get_ins \ - -Wl,--export=wrapper_get_outs \ - -Wl,--export=wrapper_get_param_values \ - -Wl,--export=wrapper_process \ - -Wl,--export=wrapper_set_parameter \ - -Wl,-z,stack-size=$$((8*1024*1024)) \ - -nostdlib +ROOT_DIR := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST)))) +SOURCES = ${SOURCES_COMMON} ${ROOT_DIR}/../src/bw_example_fx_wah.c -ROOT_DIR=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST)))) -SOURCES= \ - ${ROOT_DIR}/../src/bw_example_fx_wah.c \ - ${ROOT_DIR}/../../common/web/walloc.c \ - ${ROOT_DIR}/../../common/web/wrapper.c - -all: build/web/module.wasm build/web/index.html build/web/config.js build/web/processor.js build/web/cert.pem build/web/key.pem - -build/web/module.wasm: build/web ${SOURCES} - ${CC} ${SOURCES} ${CFLAGS} ${LDFLAGS} -o $@ - -build/web/index.html: build/web ${ROOT_DIR}/index.html - cp ${ROOT_DIR}/index.html $@ - -build/web/processor.js: build/web ${ROOT_DIR}/config.js ${ROOT_DIR}/../../common/web/processor.js - cat ${ROOT_DIR}/config.js ${ROOT_DIR}/../../common/web//processor.js > $@ - -build/web/config.js: build/web ${ROOT_DIR}/config.js - cp ${ROOT_DIR}/config.js $@ - -build/web/key.pem: build/web/cert.pem - -build/web/cert.pem: build/web - yes "" | openssl req -x509 -newkey rsa:2048 -keyout build/web/key.pem -out build/web/cert.pem -days 365 -nodes 2>/dev/null - -build/web: - mkdir -p build/web - -clean: - rm -fr build/web +include ${ROOT_DIR}/../../common/web/web.mk diff --git a/examples/fx_wah/web/index.html b/examples/fx_wah/web/index.html deleted file mode 100644 index a8874e5..0000000 --- a/examples/fx_wah/web/index.html +++ /dev/null @@ -1,210 +0,0 @@ - - - - - Brickworks web effect example - - - - -

Brickworks web effect example

- - - - - diff --git a/examples/synth_mono/web/Makefile b/examples/synth_mono/web/Makefile index 354a4f3..e6d2e53 100644 --- a/examples/synth_mono/web/Makefile +++ b/examples/synth_mono/web/Makefile @@ -1,60 +1,6 @@ -CC=clang -CFLAGS= \ - -D__WASM__ \ - -I${ROOT_DIR}/../src \ - -I${ROOT_DIR}/../../common/web \ - -I${ROOT_DIR}/../../../include \ - --target=wasm32 \ - -flto \ - -fvisibility=hidden \ - #-Ofast - had to turn this off as there are issues with wasm bulk memory -LDFLAGS= \ - -Wl,--allow-undefined \ - -Wl,--no-entry \ - -Wl,--lto-O3 \ - -Wl,-strip-all \ - -Wl,--export-table \ - -Wl,--export=wrapper_new \ - -Wl,--export=wrapper_free \ - -Wl,--export=wrapper_get_ins \ - -Wl,--export=wrapper_get_outs \ - -Wl,--export=wrapper_get_param_values \ - -Wl,--export=wrapper_process \ - -Wl,--export=wrapper_set_parameter \ - -Wl,--export=wrapper_note_on \ - -Wl,--export=wrapper_note_off \ - -Wl,--export=wrapper_pitch_bend \ - -Wl,--export=wrapper_mod_wheel \ - -Wl,-z,stack-size=$$((8*1024*1024)) \ - -nostdlib +ROOT_DIR := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST)))) +SOURCES = ${SOURCES_COMMON} ${ROOT_DIR}/../src/bw_example_synth_mono.c +SYNTH := yes +NEEDS_MEMSET := yes -ROOT_DIR=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST)))) -SOURCES= \ - ${ROOT_DIR}/../src/bw_example_synth_mono.c \ - ${ROOT_DIR}/../../common/web/walloc.c \ - ${ROOT_DIR}/../../common/web/wrapper.c - -all: build/web/module.wasm build/web/index.html build/web/config.js build/web/processor.js build/web/cert.pem build/web/key.pem - -build/web/module.wasm: build/web ${SOURCES} - ${CC} ${SOURCES} ${CFLAGS} ${LDFLAGS} -o $@ - -build/web/index.html: build/web ${ROOT_DIR}/index.html - cp ${ROOT_DIR}/index.html $@ - -build/web/processor.js: build/web ${ROOT_DIR}/config.js ${ROOT_DIR}/../../common/web/processor.js - cat ${ROOT_DIR}/config.js ${ROOT_DIR}/../../common/web//processor.js > $@ - -build/web/config.js: build/web ${ROOT_DIR}/config.js - cp ${ROOT_DIR}/config.js $@ - -build/web/key.pem: build/web/cert.pem - -build/web/cert.pem: build/web - yes "" | openssl req -x509 -newkey rsa:2048 -keyout build/web/key.pem -out build/web/cert.pem -days 365 -nodes 2>/dev/null - -build/web: - mkdir -p build/web - -clean: - rm -fr build/web +include ${ROOT_DIR}/../../common/web/web.mk diff --git a/examples/synth_simple/web/Makefile b/examples/synth_simple/web/Makefile index b6d682e..b94e329 100644 --- a/examples/synth_simple/web/Makefile +++ b/examples/synth_simple/web/Makefile @@ -1,58 +1,5 @@ -CC=clang -CFLAGS= \ - -D__WASM__ \ - -I${ROOT_DIR}/../src \ - -I${ROOT_DIR}/../../common/web \ - -I${ROOT_DIR}/../../../include \ - --target=wasm32 \ - -flto \ - -fvisibility=hidden \ - #-Ofast - had to turn this off as there are issues with wasm bulk memory -LDFLAGS= \ - -Wl,--allow-undefined \ - -Wl,--no-entry \ - -Wl,--lto-O3 \ - -Wl,-strip-all \ - -Wl,--export-table \ - -Wl,--export=wrapper_new \ - -Wl,--export=wrapper_free \ - -Wl,--export=wrapper_get_ins \ - -Wl,--export=wrapper_get_outs \ - -Wl,--export=wrapper_get_param_values \ - -Wl,--export=wrapper_process \ - -Wl,--export=wrapper_set_parameter \ - -Wl,--export=wrapper_note_on \ - -Wl,--export=wrapper_note_off \ - -Wl,-z,stack-size=$$((8*1024*1024)) \ - -nostdlib +ROOT_DIR := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST)))) +SOURCES = ${SOURCES_COMMON} ${ROOT_DIR}/../src/bw_example_synth_simple.c +SYNTH := yes -ROOT_DIR=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST)))) -SOURCES= \ - ${ROOT_DIR}/../src/bw_example_synth_simple.c \ - ${ROOT_DIR}/../../common/web/walloc.c \ - ${ROOT_DIR}/../../common/web/wrapper.c - -all: build/web/module.wasm build/web/index.html build/web/config.js build/web/processor.js build/web/cert.pem build/web/key.pem - -build/web/module.wasm: build/web ${SOURCES} - ${CC} ${SOURCES} ${CFLAGS} ${LDFLAGS} -o $@ - -build/web/index.html: build/web ${ROOT_DIR}/index.html - cp ${ROOT_DIR}/index.html $@ - -build/web/processor.js: build/web ${ROOT_DIR}/config.js ${ROOT_DIR}/../../common/web/processor.js - cat ${ROOT_DIR}/config.js ${ROOT_DIR}/../../common/web//processor.js > $@ - -build/web/config.js: build/web ${ROOT_DIR}/config.js - cp ${ROOT_DIR}/config.js $@ - -build/web/key.pem: build/web/cert.pem - -build/web/cert.pem: build/web - yes "" | openssl req -x509 -newkey rsa:2048 -keyout build/web/key.pem -out build/web/cert.pem -days 365 -nodes 2>/dev/null - -build/web: - mkdir -p build/web - -clean: - rm -fr build/web +include ${ROOT_DIR}/../../common/web/web.mk diff --git a/examples/synth_simple/web/index.html b/examples/synth_simple/web/index.html deleted file mode 100644 index 450be66..0000000 --- a/examples/synth_simple/web/index.html +++ /dev/null @@ -1,167 +0,0 @@ - - - - - Brickworks web synth example - - - - -

Brickworks web synth example

- - - - -