-
Notifications
You must be signed in to change notification settings - Fork 77
/
Makefile
31 lines (21 loc) · 825 Bytes
/
Makefile
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
CLANG=${LLVM_TOOLCHAIN}clang${LLVM_VERSION}
SRCFILES = $(shell find src/ -type f -name '*.c')
CFILES = $(patsubst src/%.c, %, $(SRCFILES))
O0FILES = ${patsubst %, build-O0/%.bc, ${CFILES}}
O1FILES = ${patsubst %, build-O1/%.bc, ${CFILES}}
O2FILES = ${patsubst %, build-O2/%.bc, ${CFILES}}
SYSROOT = $(shell cd ../../sysroot/ && pwd)
CFLAGS=-fno-vectorize -fno-slp-vectorize -emit-llvm -target le32-unknown-nacl
CFLAGS += -ffreestanding
CFLAGS += --sysroot=${SYSROOT} -I${SYSROOT}/usr/include -std=gnu99
.PHONY: all
all: ${O0FILES} ${O1FILES} ${O2FILES}
build-O0/%.bc: src/%.c Makefile
@mkdir -p "$(@D)"
${CLANG} -O0 ${CFLAGS} -c $< -o $@
build-O1/%.bc: src/%.c Makefile
@mkdir -p "$(@D)"
${CLANG} -O1 ${CFLAGS} -c $< -o $@
build-O2/%.bc: src/%.c Makefile
@mkdir -p "$(@D)"
${CLANG} -O2 ${CFLAGS} -c $< -o $@