Skip to content

Instantly share code, notes, and snippets.

@linux-china
Created October 12, 2019 23:24
Show Gist options
  • Save linux-china/9542a3d656f58616e65a7320175fbe72 to your computer and use it in GitHub Desktop.
Save linux-china/9542a3d656f58616e65a7320175fbe72 to your computer and use it in GitHub Desktop.
Makefile for Emscripten
WASM_MODULE = cpp17
CC = em++
CXXFLAGS = --bind -O3 -x c++ -std=c++17 -s ALLOW_MEMORY_GROWTH=1 -s 'MALLOC="emmalloc"'
.PHONY : all clean
all: $(WASM_MODULE).wasm ## Build all Wasm
$(WASM_MODULE).wasm: $(WASM_MODULE).cpp ## Compile cpp17.wasm
$(CC) $(CXXFLAGS) -o $(WASM_MODULE).js $(WASM_MODULE).cpp
clean:
rm -rf $(WASM_MODULE).js $(WASM_MODULE).wasm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment