~colbyhub/pocket_dust

3b44298c23cdd58b7d0a76580bc8c8c28b523001 — colbyhub 3 months ago 53ee1e2
Update Makefile to latest version
1 files changed, 9 insertions(+), 9 deletions(-)

M Makefile
M Makefile => Makefile +9 -9
@@ 2,8 2,8 @@ ifndef WASI_SDK_PATH
$(error Download the WASI SDK (https://github.com/WebAssembly/wasi-sdk) and set $$WASI_SDK_PATH)
endif

CC = $(WASI_SDK_PATH)/bin/clang --sysroot="$(WASI_SDK_PATH)/share/wasi-sysroot"
CXX = $(WASI_SDK_PATH)/bin/clang++ --sysroot="$(WASI_SDK_PATH)/share/wasi-sysroot"
CC = "$(WASI_SDK_PATH)/bin/clang" --sysroot="$(WASI_SDK_PATH)/share/wasi-sysroot"
CXX = "$(WASI_SDK_PATH)/bin/clang++" --sysroot="$(WASI_SDK_PATH)/share/wasi-sysroot"

# Optional dependency from binaryen for smaller builds
WASM_OPT = wasm-opt


@@ 21,8 21,8 @@ else
endif

# Linker flags
LDFLAGS = -Wl,-zstack-size=1024,--no-entry,--import-memory -mexec-model=reactor \
	-Wl,--initial-memory=65536,--max-memory=65536,--global-base=6560
LDFLAGS = -Wl,-zstack-size=14752,--no-entry,--import-memory -mexec-model=reactor \
	-Wl,--initial-memory=65536,--max-memory=65536,--stack-first
ifeq ($(DEBUG), 1)
	LDFLAGS += -Wl,--export-all,--no-gc-sections
else


@@ 34,10 34,10 @@ OBJECTS += $(patsubst src/%.cpp, build/%.o, $(wildcard src/*.cpp))
DEPS = $(OBJECTS:.o=.d)

ifeq ($(OS), Windows_NT)
	MKDIR = md
	MKDIR_BUILD = if not exist build md build
	RMDIR = rd /s /q
else
	MKDIR = mkdir -p
	MKDIR_BUILD = mkdir -p build
	RMDIR = rm -rf
endif



@@ 47,7 47,7 @@ all: build/cart.wasm
build/cart.wasm: $(OBJECTS)
	$(CXX) -o $@ $(OBJECTS) $(LDFLAGS)
ifneq ($(DEBUG), 1)
ifeq (, $(shell which $(WASM_OPT)))
ifeq (, $(shell command -v $(WASM_OPT)))
	@echo Tip: $(WASM_OPT) was not found. Install it from binaryen for smaller builds!
else
	$(WASM_OPT) $(WASM_OPT_FLAGS) $@ -o $@


@@ 56,12 56,12 @@ endif

# Compile C sources
build/%.o: src/%.c
	@$(MKDIR) build
	@$(MKDIR_BUILD)
	$(CC) -c $< -o $@ $(CFLAGS)

# Compile C++ sources
build/%.o: src/%.cpp
	@$(MKDIR) build
	@$(MKDIR_BUILD)
	$(CXX) -c $< -o $@ $(CFLAGS)

.PHONY: clean