Files
wasmer/lib/c-api/examples/Makefile
Felix Schütt 7441fade9c Final fixes for make test-capi on windows-msvc
- .wasm files should always be opened in "rb" mode
- open_memstream doesn't exist on Windows, use tempfile() instead
- remove .obj and .exe files when the test finish
2022-09-14 22:31:19 +02:00

44 lines
1.4 KiB
Makefile

WASMER_DIR:=$(realpath $(WASMER_DIR))
$(info Using provided WASMER_DIR=$(WASMER_DIR))
ROOT_DIR:=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
MSVC_CFLAGS:=""
MSVC_LDFLAGS:=""
MSVC_LDLIBS:=""
ifeq (,$(wildcard $(WASMER_DIR)/bin/wasmer))
CFLAGS = -g -I$(ROOT_DIR)/ -I$(WASMER_DIR)/include
LDFLAGS = -Wl,-rpath,$(WASMER_DIR)/lib
LDLIBS = -L$(WASMER_DIR)/lib -lwasmer
MSVC_CFLAGS:= /DEBUG /I $(ROOT_DIR)/ /I $(WASMER_DIR)/include
MSVC_LDFLAGS:= ""
MSVC_LDLIBS:= /LIBPATH:$(WASMER_DIR)/lib wasmer.dll.lib
else
CFLAGS = -g -I$(ROOT_DIR)/ -I$(shell $(WASMER_DIR)/bin/wasmer config --includedir)
LDFLAGS = -Wl,-rpath,$(shell $(WASMER_DIR)/bin/wasmer config --libdir)
LDLIBS = $(shell $(WASMER_DIR)/bin/wasmer config --libs)
MSVC_CFLAGS:= /DEBUG /I $(ROOT_DIR)/ /I $(shell $(WASMER_DIR)/bin/wasmer config --includedir)
MSVC_LDFLAGS:= ""
MSVC_LDLIBS:= /LIBPATH:$(shell $(WASMER_DIR)/bin/wasmer config --libs) wasmer.dll.lib
endif
$(info * CFLAGS: $(CFLAGS))
$(info * LDFLAGS: $(LDFLAGS))
$(info * LDLIBS: $(LDLIBS))
ALL = deprecated-header early-exit instance imports-exports exports-function exports-global memory memory2 features wasi
.PHONY: run
.SILENT: run
run:
WASMER_DIR="$(WASMER_DIR)" ROOT_DIR="$(ROOT_DIR)" CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" LDLIBS="$(LDLIBS)" cargo test --manifest-path="./wasmer-capi-examples-runner/Cargo.toml" -- --nocapture
.SILENT: clean
.PHONY: clean
clean:
$(foreach file,$(ALL),rm -f $(file).o $(file))