-
Notifications
You must be signed in to change notification settings - Fork 80
Expand file tree
/
Copy pathMakefile
More file actions
62 lines (51 loc) · 2.51 KB
/
Makefile
File metadata and controls
62 lines (51 loc) · 2.51 KB
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
CC = gcc
CFLAGS = -std=c99 -Wall -Wextra -pedantic -Werror -O2 \
-Wshadow -Wstrict-prototypes -Wmissing-prototypes \
-Wformat=2 -Wundef -Wcast-align -Wnull-dereference \
-Wstack-usage=4096 -Wno-error=stack-usage= \
-Wconversion -Wold-style-definition \
-Wdouble-promotion -Wswitch-enum -Wredundant-decls -Wwrite-strings \
-D_FORTIFY_SOURCE=2 -fstack-protector-strong -fPIE -fcf-protection \
-Isrc -Isrc/fe -Isrc/ir -Isrc/amdgpu -Isrc/tensix -Isrc/nvidia -Isrc/runtime
LDFLAGS = -pie
LIBS = -lm
# Linux/ELF only: -Wl,-z,relro,-z,now -Wl,-z,noexecstack
SOURCES = src/main.c \
src/fe/bc_err.c src/fe/preproc.c src/fe/lexer.c src/fe/parser.c src/fe/sema.c \
src/ir/bir.c src/ir/bir_print.c src/ir/bir_lower.c src/ir/bir_mem2reg.c src/ir/bir_cfold.c src/ir/bir_dce.c \
src/amdgpu/amd_rplan.c src/amdgpu/isel.c src/amdgpu/emit.c src/amdgpu/ra_ssa.c src/amdgpu/encode.c src/amdgpu/enc_tab.c src/amdgpu/sched.c src/amdgpu/verify.c \
src/tensix/isel.c src/tensix/emit.c src/tensix/coarsen.c src/tensix/datamov.c \
src/nvidia/isel.c src/nvidia/emit.c
OBJECTS = $(SOURCES:.c=.o)
TARGET = barracuda
all: $(TARGET)
$(TARGET): $(OBJECTS)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
%.o: %.c
$(CC) $(CFLAGS) -c $< -o $@
# ---- Test Suite ----
TCFLAGS = -std=c99 -D_POSIX_C_SOURCE=200809L -Wall -Wextra -O0 -g \
-Isrc -Isrc/fe -Isrc/ir -Isrc/amdgpu -Isrc/tensix -Isrc/nvidia -Isrc/runtime
TSRC = tests/tmain.c tests/tsmoke.c tests/tcomp.c tests/tenc.c \
tests/ttabs.c tests/ttypes.c tests/terrs.c tests/tphase.c \
tests/tdce.c \
tests/tcfold.c \
tests/tsched.c \
tests/tabend.c \
tests/tregalloc.c
TOBJS = $(TSRC:.c=.o)
COBJS = src/ir/bir.o src/ir/bir_print.o src/ir/bir_lower.o src/ir/bir_mem2reg.o src/ir/bir_cfold.o src/ir/bir_dce.o \
src/amdgpu/amd_rplan.o src/amdgpu/encode.o src/amdgpu/enc_tab.o src/amdgpu/isel.o src/amdgpu/emit.o src/amdgpu/ra_ssa.o src/amdgpu/sched.o src/amdgpu/verify.o \
src/fe/bc_err.o src/fe/lexer.o src/fe/parser.o src/fe/preproc.o src/fe/sema.o \
src/runtime/bc_abend.o
test: $(TARGET) trunner
./trunner --all
trunner: $(TOBJS) $(COBJS)
$(CC) $(TCFLAGS) -o $@ $^ $(LIBS)
tests/%.o: tests/%.c
$(CC) $(TCFLAGS) -c $< -o $@
src/runtime/%.o: src/runtime/%.c
$(CC) $(TCFLAGS) -c $< -o $@
clean:
rm -f $(OBJECTS) $(TARGET) $(TARGET).exe trunner trunner.exe $(TOBJS) src/runtime/*.o
.PHONY: all clean test