forked from brenocfg/AnghaBench
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile.1k
88 lines (71 loc) · 3.43 KB
/
Makefile.1k
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
SRCS=$(shell find ./source-1k -name '*.c' -type f)
OBJS_AMD64=$(patsubst ./source-1k/%.c, compiled/binaries/amd64/%.o, $(SRCS))
OBJS_X86=$(patsubst ./source-1k/%.c, compiled/binaries/x86/%.o, $(SRCS))
OBJS_ARM32=$(patsubst ./source-1k/%.c, compiled/binaries/armv7/%.o, $(SRCS))
OBJS_THUMB=$(patsubst ./source-1k/%.c, compiled/binaries/thumb/%.o, $(SRCS))
OBJS_ARM64=$(patsubst ./source-1k/%.c, compiled/binaries/arm64/%.o, $(SRCS))
OBJS_POWERPC=$(patsubst ./source-1k/%.c, compiled/binaries/powerpc/%.o, $(SRCS))
OBJS_SPARC=$(patsubst ./source-1k/%.c, compiled/binaries/sparc/%.o, $(SRCS))
BCOBJS_AMD64=$(patsubst ./source-1k/%.c, compiled/bitcode/amd64/%.bc, $(SRCS))
BCOBJS_X86=$(patsubst ./source-1k/%.c, compiled/bitcode/x86/%.bc, $(SRCS))
BCOBJS_ARM32=$(patsubst ./source-1k/%.c, compiled/bitcode/armv7/%.bc, $(SRCS))
BCOBJS_THUMB=$(patsubst ./source-1k/%.c, compiled/bitcode/thumb/%.bc, $(SRCS))
BCOBJS_ARM64=$(patsubst ./source-1k/%.c, compiled/bitcode/arm64/%.bc, $(SRCS))
BCOBJS_POWERPC=$(patsubst ./source-1k/%.c, compiled/bitcode/powerpc/%.bc, $(SRCS))
BCOBJS_SPARC=$(patsubst ./source-1k/%.c, compiled/bitcode/sparc/%.bc, $(SRCS))
CC=clang-14
CFLAGS=-pipe -O1 -ggdb -w -c
BCFLAGS=$(CFLAGS) -emit-llvm
AMD64_CFLAGS=--target=x86_64-pc-linux-gnu
X86_CFLAGS=--target=i686-linux-gnu
ARM32_CFLAGS=--target=arm-linux-gnueabihf -march=armv7a -isystem/usr/arm-linux-gnueabihf/include
THUMB_CFLAGS=--target=arm-linux-gnueabihf -march=armv7a -mthumb -isystem/usr/arm-linux-gnueabihf/include
ARM64_CFLAGS=--target=aarch64-linux-gnu -isystem/usr/aarch64-linux-gnu/include
POWERPC_CFLAGS=--target=powerpc64-linux-gnu -isystem/usr/powerpc64-linux-gnu/include/
SPARC_CFLAGS=--target=sparc64-linux-gnu -m32 -isystem/usr/sparc64-linux-gnu/include
all: binaries bitcode
binaries: $(OBJS_X86) $(OBJS_AMD64) $(OBJS_ARM32) $(OBJS_ARM64) $(OBJS_THUMB) $(OBJS_POWERPC) $(OBJS_SPARC)
bitcode: $(BCOBJS_X86) $(BCOBJS_AMD64) $(BCOBJS_ARM32) $(BCOBJS_ARM64) $(BCOBJS_THUMB) $(BCOBJS_POWERPC) $(BCOBJS_SPARC)
.PHONY: all binaries bitcode
compiled/binaries/amd64/%.o: source-1k/%.c
@mkdir -p "$(@D)"
@$(CC) $(AMD64_CFLAGS) $(CFLAGS) $< -o $@
compiled/binaries/x86/%.o: source-1k/%.c
@mkdir -p "$(@D)"
@$(CC) $(X86_CFLAGS) $(CFLAGS) $< -o $@
compiled/binaries/arm64/%.o: source-1k/%.c
@mkdir -p "$(@D)"
@$(CC) $(ARM64_CFLAGS) $(CFLAGS) $< -o $@
compiled/binaries/armv7/%.o: source-1k/%.c
@mkdir -p "$(@D)"
@$(CC) $(ARM32_CFLAGS) $(CFLAGS) $< -o $@
compiled/binaries/thumb/%.o: source-1k/%.c
@mkdir -p "$(@D)"
@$(CC) $(THUMB_CFLAGS) $(CFLAGS) $< -o $@
compiled/binaries/powerpc/%.o: source-1k/%.c
@mkdir -p "$(@D)"
@$(CC) $(POWERPC_CFLAGS) $(CFLAGS) $< -o $@
compiled/binaries/sparc/%.o: source-1k/%.c
@mkdir -p "$(@D)"
@$(CC) $(SPARC_CFLAGS) $(CFLAGS) $< -o $@
compiled/bitcode/amd64/%.bc: source-1k/%.c
@mkdir -p "$(@D)"
@$(CC) $(AMD64_CFLAGS) $(BCFLAGS) $< -o $@
compiled/bitcode/x86/%.bc: source-1k/%.c
@mkdir -p "$(@D)"
@$(CC) $(X86_CFLAGS) $(BCFLAGS) $< -o $@
compiled/bitcode/arm64/%.bc: source-1k/%.c
@mkdir -p "$(@D)"
@$(CC) $(ARM64_CFLAGS) $(BCFLAGS) $< -o $@
compiled/bitcode/armv7/%.bc: source-1k/%.c
@mkdir -p "$(@D)"
@$(CC) $(ARM32_CFLAGS) $(BCFLAGS) $< -o $@
compiled/bitcode/thumb/%.bc: source-1k/%.c
@mkdir -p "$(@D)"
@$(CC) $(THUMB_CFLAGS) $(BCFLAGS) $< -o $@
compiled/bitcode/powerpc/%.bc: source-1k/%.c
@mkdir -p "$(@D)"
@$(CC) $(POWERPC_CFLAGS) $(BCFLAGS) $< -o $@
compiled/bitcode/sparc/%.bc: source-1k/%.c
@mkdir -p "$(@D)"
@$(CC) $(SPARC_CFLAGS) $(BCFLAGS) $< -o $@