# Paths
RAYLIB_WEB_PATH = /opt/devel
SRC = main.cc
OUTPUT = index.js

# Compiler
CC = emcc

# Flags
# -s ASYNCIFY: Required if you use traditional loops (though we used emscripten_set_main_loop)
# -s USE_GLFW=3: Essential for Raylib's window management
# -s EXPORTED_RUNTIME_METHODS: Helps JS communicate with the WASM
CFLAGS = -I$(RAYLIB_WEB_PATH)/include -DPLATFORM_WEB
LDFLAGS = -L$(RAYLIB_WEB_PATH)/lib -lraylib.web \
          -s USE_GLFW=3 \
          -s ASYNCIFY \
          -s FORCE_FILESYSTEM=1 \
		  -s ALLOW_MEMORY_GROWTH=1 \
		  --preload-file assets

all:
	$(CC) $(SRC) -o $(OUTPUT) $(CFLAGS) $(LDFLAGS)

clean:
	rm -f $(OUTPUT) *.wasm *.data
