]> git.proxmox.com Git - wasi-libc.git/blame - Makefile
Merge pull request #8 from WebAssembly/suseconds_t_and_nlink_t
[wasi-libc.git] / Makefile
CommitLineData
dcf13b6f
DG
1# These variables are specifically meant to be overridable via
2# the make command-line.
3WASM_CC = clang
4WASM_CFLAGS = -O2
5WASM_TARGET_FLAGS = --target=wasm32
6SYSROOT = sysroot
7
8# These variables describe the locations of various files and
9# directories in the source tree.
10BASICS_DIR = basics
11BASICS_INC = basics/include
12BASICS_LIBC_DIR = $(BASICS_DIR)/libc
13BASICS_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