Skip to content

Commit

Permalink
Add wasm target to Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
oleiade committed Jul 14, 2023
1 parent 5efa62b commit cbc64a3
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,20 @@ WINDOWS_TARGETS = x86_64-pc-windows-gnu \


# Rule for building all targets
release: linux macos
release: linux macos wasm

# Rule for building Linux targets, Debian, and RPM packages
linux: check_cross check_linux_crosscompilation_on_macos $(LINUX_TARGETS) $(addprefix deb-, $(LINUX_TARGETS))

# Rule for building macOS targets
macos: check_cargo check_toolchain check_cross $(MACOS_TARGETS)

# Rule for building wasm code
wasm: check_wasm_pack
cd crates/motus-wasm && wasm-pack build --target web && cd -
mkdir -p release/wasm
cp -r crates/motus-wasm/pkg/* release/wasm/

# Rules for building Linux targets and creating tar.gz archives
$(LINUX_TARGETS):
@echo "building for target $@"
Expand Down Expand Up @@ -87,6 +93,10 @@ check_deb:
check_mingw:
@command -v x86_64-w64-mingw32-gcc > /dev/null 2>&1 || { echo >&2 "Error: 'mingw-w64' is not installed. Please install it according to your platform (macOS: 'brew install mingw-w64', Debian/Ubuntu: 'sudo apt-get install mingw-w64', Fedora: 'sudo dnf install mingw64-gcc')."; exit 1; }

# Rule to check if 'wasm-pack' is installed
check_wasm_pack:
@command -v wasm-pack > /dev/null 2>&1 || { echo >&2 "Error: 'wasm-pack' is not installed. Please install it by running 'cargo install wasm-pack'."; exit 1; }

# Verify Homebrew tap and formula for cross-compiling Linux targets on macOS
check_linux_crosscompilation_on_macos:
ifeq ($(shell uname),Darwin)
Expand All @@ -104,4 +114,4 @@ ifeq ($(shell uname),Darwin)
fi
endif

.PHONY: check_cross check_cargo check_toolchain check_deb check_rpm linux windows macos release $(LINUX_TARGETS) $(WINDOWS_TARGETS) $(MACOS_TARGETS) deb rpm
.PHONY: check_cross check_cargo check_toolchain check_deb check_rpm linux windows macos release $(LINUX_TARGETS) $(WINDOWS_TARGETS) $(MACOS_TARGETS) wasm deb rpm

0 comments on commit cbc64a3

Please sign in to comment.