-
Notifications
You must be signed in to change notification settings - Fork 1
/
ldc_runtime.mk
88 lines (63 loc) · 1.85 KB
/
ldc_runtime.mk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
LDC_RUNTIME_ROOT:=$(REPOROOT)/ldc/runtime
#LDC_RUNTIME+=
#LDC_RUNTIME+=--ninja
ifdef NATIVE
LDC_RUNTIME+=--buildDir=$(RUNTIME_BUILD)
else
#LDC_RUNTIME+=--dFlags=-mtriple=wasm32-wasi
#LDC_RUNTIME+=--dFlags=-mtriple=wasm32-wasi
LDC_RUNTIME+=--dFlags=-mtriple=wasm32-linux-wasi
LDC_RUNTIME+=--buildDir=$(RUNTIME_BUILD)
LDC_RUNTIME+=CMAKE_TOOLCHAIN_FILE=$(WASI_SDK_PREFIX)/share/cmake/wasi-sdk.cmake
endif
LDC_RUNTIME+=--ldcSrcDir=ldc
#LDC_RUNTIME+=--linkerFlags=-L$(WASI_SDK_PREFIX)/wasi-libc/sysroot/lib/wasm32-wasi
LDC_RUNTIME+=WASI_SDK_PREFIX=$(WASI_SDK_PREFIX) BUILD_SHARED_LIBS=OFF
help-ldc-runtime:
@echo "Usage $@"
@echo
@echo make info-ldc-runtime - Print setting for the ldc-build-runtime
@echo
@echo make clean-ldc-runtime - Remove the build
@echo
.PHONY: help-ldc-runtime
help: help-ldc-runtime
info-ldc-runtime:
@echo "Setup parameters for ldc-build-runtime"
@echo LDC_RUNTIME_ROOT=$(LDC_RUNTIME_ROOT)
@echo LDC_RUNTIME =$(LDC_RUNTIME)
@echo
ldc-runtime: $(RUNTIME_BUILD)/.done $(RUNTIME_BUILD)/ldc2.conf
.PHONY: ldc-runtime
prebuild: ldc-runtime
info: info-ldc-runtime
prebuild: $(RUNTIME_BUILD)/.done
$(RUNTIME_BUILD)/.done:
ldc-build-runtime $(LDC_RUNTIME)
touch $@
define LDC_CONF
"^wasm(32|64)-":
{
switches = [
"-defaultlib=c,druntime-ldc,phobos2-ldc",
"-link-internally",
];
post-switches = [
"-I$(LDC_RUNTIME_ROOT)/druntime/src>",
"-I$(LDC_RUNTIME_ROOT)/phobos>",
],
lib-dirs = ["$(RUNTIME_BUILD)/lib",
"$(WASI_SDK_PREFIX)/share/wasi-sysroot/lib/wasm32-wasi/"];
};
endef
export LDC_CONF_TEXT=$(LDC_CONF)
ldc2-conf: $(RUNTIME_BUILD)/ldc2.conf
@echo $<
$(RUNTIME_BUILD)/ldc2.conf:
@echo "$${LDC_CONF_TEXT}" > $@
CLEAN+=clean-ldc-runtime
clean-ldc-runtime:
@echo "clean $@"
rm -fR $(RUNTIME_BUILD)
.PHONY: clean-ldc-runtime
clean: clean-ldc-runtime