-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
49 lines (32 loc) · 1.45 KB
/
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
COMPILER_FLAGS := -O3 -std=c++1z -fno-exceptions -fno-stack-protector -fno-rtti -ffreestanding -fvisibility=hidden -Wall -Wsign-compare -I. -DGIT_REF=$(shell git rev-parse HEAD | tr '[:lower:]' '[:upper:]')
LINKER_FLAGS := #-Wl,-s
SOURCES := Foundation/* Storage/* DataStructures/* Ontology/* External/*
PLATFORM = $(shell uname)
BUILD_PATH = build/
$(BUILD_PATH):
mkdir -p $(BUILD_PATH)
# Build POSIX Executables
$(BUILD_PATH)SymatemMP: Targets/MP.cpp Targets/POSIX.hpp $(SOURCES) $(BUILD_PATH)
$(CC) $(COMPILER_FLAGS) $(LINKER_FLAGS) -o $@ $<
$(BUILD_PATH)SymatemTests: Targets/Tests.cpp Targets/POSIX.hpp $(SOURCES) $(BUILD_PATH)
$(CC) $(COMPILER_FLAGS) $(LINKER_FLAGS) -o $@ $<
# Run POSIX Executables
IMAGE_PATH = /dev/zero
runMP: $(BUILD_PATH)SymatemMP
$< --path $(IMAGE_PATH)
runTests: $(BUILD_PATH)SymatemTests
$< $(IMAGE_PATH)
# WebAssembly
WASM_TARGET = wasm32 # wasm64
$(BUILD_PATH)Symatem.s: Targets/WASM.cpp $(SOURCES) $(BUILD_PATH)
$(LLVM_BIN)clang $(COMPILER_FLAGS) -target $(WASM_TARGET) -S -emit-llvm -o $(BUILD_PATH)Symatem.bc $<
$(LLVM_BIN)llc -march=$(WASM_TARGET) -filetype=asm -o $(BUILD_PATH)Symatem.s $(BUILD_PATH)Symatem.bc
rm $(BUILD_PATH)Symatem.bc
$(BUILD_PATH)Symatem.wast: $(BUILD_PATH)Symatem.s
$(BINARYEN_BIN)s2wasm -o $@ $<
$(BUILD_PATH)Symatem.wasm: $(BUILD_PATH)Symatem.wast
$(BINARYEN_BIN)wasm-as -o $@ $<
# Combined
buildAll: $(BUILD_PATH)SymatemMP $(BUILD_PATH)SymatemTests $(BUILD_PATH)Symatem.wasm
clear:
rm -Rf build/