]>
Commit | Line | Data |
---|---|---|
dcf13b6f DG |
1 | # These variables are specifically meant to be overridable via |
2 | # the make command-line. | |
3 | WASM_CC = clang | |
4 | WASM_CFLAGS = -O2 | |
5 | WASM_TARGET_FLAGS = --target=wasm32 | |
6 | SYSROOT = sysroot | |
7 | ||
8 | # These variables describe the locations of various files and | |
9 | # directories in the source tree. | |
10 | BASICS_DIR = basics | |
11 | BASICS_INC = basics/include | |
12 | BASICS_LIBC_DIR = $(BASICS_DIR)/libc | |
13 | BASICS_LIBC_SOURCES = $(BASICS_LIBC_DIR)/string.c | |
14 | ||
15 | .PHONY: $(SYSROOT) | |
16 | $(SYSROOT): | |
17 | $(RM) -r "$(SYSROOT)" | |
18 | mkdir -p "$(SYSROOT)/usr" | |
19 | ||
20 | # | |
21 | # Install the include files. | |
22 | # | |
23 | cp -r "$(BASICS_INC)" "$(SYSROOT)/usr" | |
24 | ||
25 | # | |
26 | # Build the C startup files. | |
27 | # | |
28 | $(RM) *.o | |
29 | "$(WASM_CC)" $(WASM_CFLAGS) $(WASM_TARGET_FLAGS) --sysroot="$(SYSROOT)" -c $(BASICS_LIBC_DIR)/crt*.s | |
30 | mkdir -p "$(SYSROOT)/lib" | |
31 | mv *.o "$(SYSROOT)/lib" | |
32 | ||
33 | # | |
34 | # Compile and install the libc-subset source files. | |
35 | # | |
36 | $(RM) *.o | |
37 | "$(WASM_CC)" $(WASM_CFLAGS) $(WASM_TARGET_FLAGS) --sysroot="$(SYSROOT)" -c $(BASICS_LIBC_SOURCES) | |
38 | mkdir -p "$(SYSROOT)/lib" | |
7ef30385 | 39 | $(AR) crs "$(SYSROOT)/lib/libc.a" *.o |
dcf13b6f | 40 | $(RM) *.o |