-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
79 lines (61 loc) · 1.93 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
# Makefile
# Cody Fagley
# Authored on January 25, 2019
# Last Modified December 7, 2022
# Contains build directives for XCS Cross Compiler (AArch64)
CCOMP=g++
CFLAGS=-std=c++11 -lm -Wall -I${PWD}/src
MEMTEST=-g -O0
SILENT=-Wno-unused-variable -Wno-unused-but-set-variable -Wno-switch -Wno-conversion-null -Wno-write-strings
DESTDIR=/usr/local/bin
CTXOPT=${HOME}/.ctxopt
CROSS=${CTXOPT}/cross
# Build and Install Cross Compiler
update: build tidy
sudo cp _build/xcs-aarch64 ${DESTDIR}/xita
sudo rm -rf _build
install: assemblers build tidy
sudo cp _build/xcs-aarch64 ${DESTDIR}/xita
sudo rm -rf _build
uninstall:
sudo rm -rf ${DESTDIR}/xita
rm -rf ${CROSS}
# Build XCSL Cross Compiler
build: grammar src/xcs/xcs.cc
rm -rf _build
mkdir _build
${CCOMP} ${CFLAGS} ${SILENT} src/xcs/xcs.cc -o _build/xcs-aarch64
leakTest: grammar src/xcs/xcs.cc
rm -rf _build
mkdir _build
${CCOMP} ${CFLAGS} ${MEMTEST} ${SILENT} src/xcs/xcs.cc -o _build/xcs-aarch64
# Build Grammar
grammar: src/xcs/grammar/xita.y src/xcs/grammar/xcsl.l
bison src/xcs/grammar/xita.y
flex src/xcs/grammar/xcsl.l
grammar-test: src/xcs/grammar/xita.y src/xcs/grammar/xcsl.l
bison -Wcounterexamples src/xcs/grammar/xita.y
flex src/xcs/grammar/xcsl.l
# Tidy Generated Files
tidy:
rm lex.yy.c xita.tab.c
# Grabs freestanding (OS-independent) assemblers in this order
# * ARMv7 (32-bit)
# * ARMv8 (64-bit)
assemblers:
rm -rf /home/${USER}/.ctxopt/asm
mkdir -p /home/${USER}/.ctxopt
mkdir -p /home/${USER}/.ctxopt/asm
cp asm/ARMv7.tar.gz asm/ARMv8.tar.gz ${HOME}/.ctxopt/asm
tar -xf ${HOME}/.ctxopt/asm/ARMv8.tar.gz -C ${HOME}/.ctxopt/asm/
tar -xf ${HOME}/.ctxopt/asm/ARMv7.tar.gz -C ${HOME}/.ctxopt/asm/
rm ${HOME}/.ctxopt/asm/*.tar*
unit-tests:
rm -rf _build
mkdir _build
${CCOMP} ${CFLAGS} ${SILENT} tests/unit/XitaTests.cc -o _build/test-xita
./_build/test-xita
runtime-tests:
./tests/run-tests arm64 -a
# PHONY TARGETS
.PHONY: install uninstall build