-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
141 lines (118 loc) · 5.26 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
#
# Main akinator makefile
#
# Important! Dependencies are done automatically by 'make dep', which also
# removes any old dependencies. Do not modify it...
#
# 2021, d3phys
#
#
# Awesome flags collection
# Copyright (C) 2021, 2022 ded32, the TXLib creator
#
TXXFLAGS = -g --static-pie -std=c++14 -fmax-errors=100 -Wall -Wextra \
-Weffc++ -Waggressive-loop-optimizations -Wc++0x-compat \
-Wc++11-compat -Wc++14-compat -Wcast-align -Wcast-qual \
-Wchar-subscripts -Wconditionally-supported -Wconversion \
-Wctor-dtor-privacy -Wempty-body -Wfloat-equal \
-Wformat-nonliteral -Wformat-security -Wformat-signedness \
-Wformat=2 -Winline -Wlarger-than=8192 -Wlogical-op \
-Wmissing-declarations -Wnon-virtual-dtor -Wopenmp-simd \
-Woverloaded-virtual -Wpointer-arith -Wredundant-decls \
-Wshadow -Wsign-conversion -Wsign-promo -Wstack-usage=8192 \
-Wstrict-null-sentinel -Wstrict-overflow=2 \
-Wsuggest-attribute=noreturn -Wsuggest-final-methods \
-Wsuggest-final-types -Wsuggest-override -Wswitch-default \
-Wswitch-enum -Wsync-nand -Wundef -Wunreachable-code -Wunused \
-Wuseless-cast -Wvariadic-macros -Wno-literal-suffix \
-Wno-missing-field-initializers -Wno-narrowing \
-Wno-old-style-cast -Wno-varargs -fcheck-new \
-fsized-deallocation -fstack-check -fstack-protector \
-fstrict-overflow -flto-odr-type-merging \
-fno-omit-frame-pointer \
-fPIE \
-fsanitize=address \
-fsanitize=alignment \
-fsanitize=bool \
-fsanitize=bounds \
-fsanitize=enum \
-fsanitize=float-cast-overflow \
-fsanitize=float-divide-by-zero \
-fsanitize=integer-divide-by-zero \
-fsanitize=leak \
-fsanitize=nonnull-attribute \
-fsanitize=null \
-fsanitize=object-size \
-fsanitize=return \
-fsanitize=returns-nonnull-attribute \
-fsanitize=shift \
-fsanitize=signed-integer-overflow \
-fsanitize=undefined \
-fsanitize=unreachable \
-fsanitize=vla-bound \
-fsanitize=vptr \
-lm -pie
SUBDIRS = lib frontend ast backend/llvm backend/legacy trans
CXX = g++
CPP = $(CXX) -E
TOPDIR := $(shell if [ "$$PWD" != "" ]; then echo $$PWD; else pwd; fi)
CXXFLAGS = $(HFLAGS) $(LOGSFLAGS) $(TXXFLAGS)
LOGSFLAGS = -D 'LOGS_FILE="logs.html"' -D LOGS_COLORS -D LOGS_DEBUG
# Header files
HFLAGS = $(addprefix -I, $(HPATH))
HPATH = $(TOPDIR)/include \
$(TOPDIR)/lib/logs
ASSEMBLY_PATH = $(TOPDIR)/assembly/include
make: dep front back trans back-llvm
nasm -f elf64 -o asslib.o asslib.s
gcc asslib-llvm.c -c asslib-llvm.o
@printf "\n\n\n\n\n\n"
@echo "Assert language is compiled now!"
@echo "Read: https://d3phys.github.io/assert-book/"
commit: clean rmdep
@echo "Ready for commit"
test: front back-llvm
./tr examples/fucktorial2 fuck.tree
./cum-llvm fuck.tree fuck.ir
cat fuck.ir
llc fuck.ir -filetype=obj -o test.o
gcc test.o asslib-llvm.o
quadr: back front
./tr examples/quadratic-integer test_tree
./cum test_tree asm
ld -o test asm asslib.o /lib64/libc.so.6 -I/lib64/ld-linux-x86-64.so.2
fuck: back front
./tr examples/fucktorial test_tree
./cum test_tree asm
ld -o test asm asslib.o /lib64/libc.so.6 -I/lib64/ld-linux-x86-64.so.2
test-elf: subdirs backend/legacy/test/main.o
$(OBJS)
$(CXX) $(CXXFLAGS) -o test-elf lib/lib.o backend/legacy/backend.o \
frontend/frontend.o ast/ast.o backend/legacy/test/main.o
./test-elf
front: subdirs frontend/main.o
$(OBJS)
$(CXX) $(CXXFLAGS) -o tr lib/lib.o \
frontend/frontend.o ast/ast.o frontend/main.o
back: subdirs backend/legacy/main.o
$(OBJS)
$(CXX) $(CXXFLAGS) -o cum lib/lib.o backend/legacy/backend.o \
frontend/frontend.o ast/ast.o backend/legacy/main.o
back-llvm: CXXFLAGS+=$(shell llvm-config --cppflags)
back-llvm: LDFLAGS+=$(shell llvm-config --ldflags)
back-llvm: LIBS+=$(shell llvm-config --libs)
back-llvm: subdirs backend/llvm/main.o
$(OBJS)
$(CXX) $(CXXFLAGS) $(LDFLAGS) $(LIBS) -o cum-llvm lib/lib.o backend/llvm/backend.o \
frontend/frontend.o ast/ast.o backend/llvm/main.o
trans: subdirs trans/main.o
$(OBJS)
$(CXX) $(CXXFLAGS) -o rev lib/lib.o frontend/frontend.o\
trans/trans.o ast/ast.o trans/main.o
mur: subdirs
$(CXX) $(CXXFLAGS) -o mur utils/mur.o lib/lib.o
touch:
@find $(HPATH) -print -exec touch {} \;
.EXPORT_ALL_VARIABLES: CXX CXXFLAGS CPP
include $(TOPDIR)/Rules.makefile
### Dependencies ###