forked from innative-sdk/innative
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
82 lines (70 loc) · 3.13 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
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
# Compiler directories
OBJDIR ?= bin/obj
BINDIR ?= bin
LIBDIR ?= bin
# Compiler selection
AR ?= ar
CC ?= gcc
CXX ?= g++
CXXLD ?= $(CXX)
# Compiler flags
CPPFLAGS := $(CPPFLAGS) -Iinclude -Ibin/llvm/include -Illvm/include -Illvm/tools/lld/include
CPPFLAGS += -Wall -Wshadow -Wno-attributes -Wno-unknown-pragmas -Wno-missing-braces \
-Wno-unused-function -Wno-comment -Wno-char-subscripts -Wno-sign-compare \
-Wno-unused-variable -Wno-switch
LIBS :=
LDFLAGS := -L$(LIBDIR) -Lbin/llvm/lib
# Destination settings
PREFIX ?= /usr/local
DESTDIR ?=
ifeq ($(MAKECMDGOALS), debug)
CPPFLAGS += -DDEBUG -g
else
CPPFLAGS += -DNDEBUG -O3
endif
debug: innative-env innative innative-cmd innative-test innative-stub
all: innative-env innative innative-cmd innative-test innative-stub
clean: innative-env-clean innative-clean innative-cmd-clean innative-test-clean innative-stub-clean
#$(RM) -r $(LIBDIR)
#$(RM) -r $(BINDIR)
$(RM) -r $(OBJDIR)
install: all
mkdir -p $(DESTDIR)$(PREFIX)/include/innative/
mkdir -p $(DESTDIR)$(PREFIX)/lib
cp include/innative/*.h $(DESTDIR)$(PREFIX)/include/innative/
cp $(LIBDIR)/libinnative.so $(DESTDIR)$(PREFIX)/lib/libinnative.so
dist: all
mkdir -p innative-posix-runtime-x64/
cp bin/innative.a innative-posix-runtime-x64/
cp bin/libinnative.so innative-posix-runtime-x64/
cp bin/innative-env.a innative-posix-runtime-x64/
cp bin/innative-env-d.a innative-posix-runtime-x64/
cp bin/innative-cmd innative-posix-runtime-x64/
tar -czf innative-posix-runtime-x64.tar.gz innative-posix-runtime-x64/
mkdir -p innative-posix-sdk-x64/bin/
mkdir -p innative-posix-sdk-x64/include/innative/
mkdir -p innative-posix-sdk-x64/scripts/
mkdir -p innative-posix-sdk-x64/spec/test/core/
mv innative-posix-runtime-x64/* innative-posix-sdk-x64/bin/
rm -r innative-posix-runtime-x64/
cp bin/innative-test innative-posix-sdk-x64/bin/
cp bin/innative-stub.a innative-posix-sdk-x64/bin/
cp include/innative/*.h innative-posix-sdk-x64/include/innative/
cp scripts/*.wat innative-posix-sdk-x64/scripts/
cp scripts/*.wasm innative-posix-sdk-x64/scripts/
cp spec/test/core/*.wast innative-posix-sdk-x64/spec/test/core/
tar -czf innative-posix-sdk-x64.tar.gz innative-posix-sdk-x64/
rm -r innative-posix-sdk-x64/
uninstall:
$(RM) -r $(DESTDIR)$(PREFIX)/include/innative
$(RM) $(DESTDIR)$(PREFIX)/lib/libinnative.so
benchmarks:
$(CXX) innative-test/benchmark_n-body.cpp wasm_malloc.c --target=wasm32-unknown-unknown-wasm -nostdlib --optimize=3 --output /scripts/benchmark_n-body.wasm -Xlinker --no-entry -Xlinker --export-dynamic
$(CXX) innative-test/benchmark_fac.cpp wasm_malloc.c --target=wasm32-unknown-unknown-wasm -nostdlib --optimize=3 --output /scripts/benchmark_fac.wasm -Xlinker --no-entry -Xlinker --export-dynamic
$(CXX) innative-test/benchmark_fannkuch-redux.cpp wasm_malloc.c --target=wasm32-unknown-unknown-wasm -nostdlib --optimize=3 --output /scripts/benchmark_fannkuch-redux.wasm -Xlinker --no-entry -Xlinker --export-dynamic
.PHONY: all clean install uninstall benchmarks debug
include innative-env/Makefile
include innative/Makefile
include innative-cmd/Makefile
include innative-test/Makefile
include innative-stub/Makefile