forked from michaeljclark/rv8-bench
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
174 lines (152 loc) · 6.67 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
#
# rv8-bench
#
BINDIR ?= bin
CC ?= gcc
CFLAGS += -O2
LDFLAGS += -lm
TESTBENCHES := \
aes \
dhrystone \
miniz \
norx \
primes \
qsort \
sha512
SHELL_HACK := $(shell mkdir -p $(abspath $(BINDIR)))
.PHONY: all clean
all: $(foreach tb,$(TESTBENCHES),$(BINDIR)/$(tb))
$(BINDIR)/%: src/%.c
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
clean:
$(RM) $(foreach tb,$(TESTBENCHES),$(abspath $(BINDIR))/$(tb))
# CFLAGS = -fPIE -g
# LDFLAGS = -static
RV32 = riscv32-linux-musl-
RV64 = riscv64-linux-musl-
I386 = i386-linux-musl-
X86_64 = x86_64-linux-musl-
ARM32 = arm-linux-musleabihf-
ARM64 = aarch64-linux-musl-
PROGRAMS = aes bigint dhrystone miniz norx primes qsort sha512
RV32_PROGS = $(addprefix bin/riscv32/, $(PROGRAMS))
RV64_PROGS = $(addprefix bin/riscv64/, $(PROGRAMS))
I386_PROGS = $(addprefix bin/i386/, $(PROGRAMS))
X86_64_PROGS = $(addprefix bin/x86_64/, $(PROGRAMS))
ARM32_PROGS = $(addprefix bin/arm/, $(PROGRAMS))
ARM64_PROGS = $(addprefix bin/aarch64/, $(PROGRAMS))
ALL_PROGS = $(RV32_PROGS) $(RV64_PROGS) $(I386_PROGS) $(X86_64_PROGS) $(ARM32_PROGS) $(ARM64_PROGS)
O3_PROGS = $(addsuffix .O3, $(ALL_PROGS)) $(addsuffix .O3.stripped, $(ALL_PROGS))
O2_PROGS = $(addsuffix .O2, $(ALL_PROGS)) $(addsuffix .O2.stripped, $(ALL_PROGS))
OS_PROGS = $(addsuffix .Os, $(ALL_PROGS)) $(addsuffix .Os.stripped, $(ALL_PROGS))
# all: $(O3_PROGS) $(O2_PROGS) $(OS_PROGS) | npm
npm: ; npm install
# clean: ; rm -fr bin
bin/riscv32/%.O3: src/%.c
@echo CC $@ ; mkdir -p $(@D) ; $(RV32)gcc $(LDFLAGS) -O3 $(CFLAGS) $< -o $@
bin/riscv32/%.O3: src/%.cc
@echo CC $@ ; mkdir -p $(@D) ; $(RV32)g++ $(LDFLAGS) -O3 $(CFLAGS) $< -o $@
bin/riscv32/%.O3.stripped: bin/riscv32/%.O3
@echo STRIP $@ ; $(RV32)strip --strip-all $< -o $@
bin/riscv32/%.O2: src/%.c
@echo CC $@ ; mkdir -p $(@D) ; $(RV32)gcc $(LDFLAGS) -O2 $(CFLAGS) $< -o $@
bin/riscv32/%.O2: src/%.cc
@echo CC $@ ; mkdir -p $(@D) ; $(RV32)g++ $(LDFLAGS) -O2 $(CFLAGS) $< -o $@
bin/riscv32/%.O2.stripped: bin/riscv32/%.O2
@echo STRIP $@ ; $(RV32)strip --strip-all $< -o $@
bin/riscv32/%.Os: src/%.c
@echo CC $@ ; mkdir -p $(@D) ; $(RV32)gcc $(LDFLAGS) -Os $(CFLAGS) $< -o $@
bin/riscv32/%.Os: src/%.cc
@echo CC $@ ; mkdir -p $(@D) ; $(RV32)g++ $(LDFLAGS) -Os $(CFLAGS) $< -o $@
bin/riscv32/%.Os.stripped: bin/riscv32/%.Os
@echo STRIP $@ ; $(RV32)strip --strip-all $< -o $@
bin/riscv64/%.O3: src/%.c
@echo CC $@ ; mkdir -p $(@D) ; $(RV64)gcc $(LDFLAGS) -O3 $(CFLAGS) $< -o $@
bin/riscv64/%.O3: src/%.cc
@echo CC $@ ; mkdir -p $(@D) ; $(RV64)g++ $(LDFLAGS) -O3 $(CFLAGS) $< -o $@
bin/riscv64/%.O3.stripped: bin/riscv64/%.O3
@echo STRIP $@ ; $(RV64)strip --strip-all $< -o $@
bin/riscv64/%.O2: src/%.c
@echo CC $@ ; mkdir -p $(@D) ; $(RV64)gcc $(LDFLAGS) -O2 $(CFLAGS) $< -o $@
bin/riscv64/%.O2: src/%.cc
@echo CC $@ ; mkdir -p $(@D) ; $(RV64)g++ $(LDFLAGS) -O2 $(CFLAGS) $< -o $@
bin/riscv64/%.O2.stripped: bin/riscv64/%.O2
@echo STRIP $@ ; $(RV64)strip --strip-all $< -o $@
bin/riscv64/%.Os: src/%.c
@echo CC $@ ; mkdir -p $(@D) ; $(RV64)gcc $(LDFLAGS) -Os $(CFLAGS) $< -o $@
bin/riscv64/%.Os: src/%.cc
@echo CC $@ ; mkdir -p $(@D) ; $(RV64)g++ $(LDFLAGS) -Os $(CFLAGS) $< -o $@
bin/riscv64/%.Os.stripped: bin/riscv64/%.Os
@echo STRIP $@ ; $(RV64)strip --strip-all $< -o $@
bin/i386/%.O3: src/%.c
@echo CC $@ ; mkdir -p $(@D) ; $(I386)gcc $(LDFLAGS) -O3 $(CFLAGS) $< -o $@
bin/i386/%.O3: src/%.cc
@echo CC $@ ; mkdir -p $(@D) ; $(I386)g++ $(LDFLAGS) -O3 $(CFLAGS) $< -o $@
bin/i386/%.O3.stripped: bin/i386/%.O3
@echo STRIP $@ ; $(I386)strip --strip-all $< -o $@
bin/i386/%.O2: src/%.c
@echo CC $@ ; mkdir -p $(@D) ; $(I386)gcc $(LDFLAGS) -O2 $(CFLAGS) $< -o $@
bin/i386/%.O2: src/%.cc
@echo CC $@ ; mkdir -p $(@D) ; $(I386)g++ $(LDFLAGS) -O2 $(CFLAGS) $< -o $@
bin/i386/%.O2.stripped: bin/i386/%.O2
@echo STRIP $@ ; $(I386)strip --strip-all $< -o $@
bin/i386/%.Os: src/%.c
@echo CC $@ ; mkdir -p $(@D) ; $(I386)gcc $(LDFLAGS) -Os $(CFLAGS) $< -o $@
bin/i386/%.Os: src/%.cc
@echo CC $@ ; mkdir -p $(@D) ; $(I386)g++ $(LDFLAGS) -Os $(CFLAGS) $< -o $@
bin/i386/%.Os.stripped: bin/i386/%.Os
@echo STRIP $@ ; $(I386)strip --strip-all $< -o $@
bin/x86_64/%.O3: src/%.c
@echo CC $@ ; mkdir -p $(@D) ; $(X86_64)gcc $(LDFLAGS) -O3 $(CFLAGS) $< -o $@
bin/x86_64/%.O3: src/%.cc
@echo CC $@ ; mkdir -p $(@D) ; $(X86_64)g++ $(LDFLAGS) -O3 $(CFLAGS) $< -o $@
bin/x86_64/%.O3.stripped: bin/x86_64/%.O3
@echo STRIP $@ ; $(X86_64)strip --strip-all $< -o $@
bin/x86_64/%.O2: src/%.c
@echo CC $@ ; mkdir -p $(@D) ; $(X86_64)gcc $(LDFLAGS) -O2 $(CFLAGS) $< -o $@
bin/x86_64/%.O2: src/%.cc
@echo CC $@ ; mkdir -p $(@D) ; $(X86_64)g++ $(LDFLAGS) -O2 $(CFLAGS) $< -o $@
bin/x86_64/%.O2.stripped: bin/x86_64/%.O2
@echo STRIP $@ ; $(X86_64)strip --strip-all $< -o $@
bin/x86_64/%.Os: src/%.c
@echo CC $@ ; mkdir -p $(@D) ; $(X86_64)gcc $(LDFLAGS) -Os $(CFLAGS) $< -o $@
bin/x86_64/%.Os: src/%.cc
@echo CC $@ ; mkdir -p $(@D) ; $(X86_64)g++ $(LDFLAGS) -Os $(CFLAGS) $< -o $@
bin/x86_64/%.Os.stripped: bin/x86_64/%.Os
@echo STRIP $@ ; $(X86_64)strip --strip-all $< -o $@
bin/arm/%.O3: src/%.c
@echo CC $@ ; mkdir -p $(@D) ; $(ARM32)gcc $(LDFLAGS) -O3 $(CFLAGS) $< -o $@
bin/arm/%.O3: src/%.cc
@echo CC $@ ; mkdir -p $(@D) ; $(ARM32)g++ $(LDFLAGS) -O3 $(CFLAGS) $< -o $@
bin/arm/%.O3.stripped: bin/arm/%.O3
@echo STRIP $@ ; $(ARM32)strip --strip-all $< -o $@
bin/arm/%.O2: src/%.c
@echo CC $@ ; mkdir -p $(@D) ; $(ARM32)gcc $(LDFLAGS) -O2 $(CFLAGS) $< -o $@
bin/arm/%.O2: src/%.cc
@echo CC $@ ; mkdir -p $(@D) ; $(ARM32)g++ $(LDFLAGS) -O2 $(CFLAGS) $< -o $@
bin/arm/%.O2.stripped: bin/arm/%.O2
@echo STRIP $@ ; $(ARM32)strip --strip-all $< -o $@
bin/arm/%.Os: src/%.c
@echo CC $@ ; mkdir -p $(@D) ; $(ARM32)gcc $(LDFLAGS) -Os $(CFLAGS) $< -o $@
bin/arm/%.Os: src/%.cc
@echo CC $@ ; mkdir -p $(@D) ; $(ARM32)g++ $(LDFLAGS) -Os $(CFLAGS) $< -o $@
bin/arm/%.Os.stripped: bin/arm/%.Os
@echo STRIP $@ ; $(ARM32)strip --strip-all $< -o $@
bin/aarch64/%.O3: src/%.c
@echo CC $@ ; mkdir -p $(@D) ; $(ARM64)gcc $(LDFLAGS) -O3 $(CFLAGS) $< -o $@
bin/aarch64/%.O3: src/%.cc
@echo CC $@ ; mkdir -p $(@D) ; $(ARM64)g++ $(LDFLAGS) -O3 $(CFLAGS) $< -o $@
bin/aarch64/%.O3.stripped: bin/aarch64/%.O3
@echo STRIP $@ ; $(ARM64)strip --strip-all $< -o $@
bin/aarch64/%.O2: src/%.c
@echo CC $@ ; mkdir -p $(@D) ; $(ARM64)gcc $(LDFLAGS) -O2 $(CFLAGS) $< -o $@
bin/aarch64/%.O2: src/%.cc
@echo CC $@ ; mkdir -p $(@D) ; $(ARM64)g++ $(LDFLAGS) -O2 $(CFLAGS) $< -o $@
bin/aarch64/%.O2.stripped: bin/aarch64/%.O2
@echo STRIP $@ ; $(ARM64)strip --strip-all $< -o $@
bin/aarch64/%.Os: src/%.c
@echo CC $@ ; mkdir -p $(@D) ; $(ARM64)gcc $(LDFLAGS) -Os $(CFLAGS) $< -o $@
bin/aarch64/%.Os: src/%.cc
@echo CC $@ ; mkdir -p $(@D) ; $(ARM64)g++ $(LDFLAGS) -Os $(CFLAGS) $< -o $@
bin/aarch64/%.Os.stripped: bin/aarch64/%.Os
@echo STRIP $@ ; $(ARM64)strip --strip-all $< -o $@