find_rust = $(shell find $(1) -type f -name '*.rs' )

target/debug/frontend.wasm: $(call find_rust,frontend) frontend/Cargo.toml
	cargo build -p frontend --target wasm32-unknown-unknown

target_pkg/frontend_bg.wasm: target/debug/frontend.wasm
	PATH="$PATH:${HOME}/.cargo/bin" wasm-bindgen --target web --out-dir target_pkg target/wasm32-unknown-unknown/debug/frontend.wasm

.PHONY: all clean
all: target_pkg/frontend_bg.wasm
	true

clean:
	rm -r target_pkg target