-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·55 lines (43 loc) · 1.65 KB
/
Copy pathbuild.sh
File metadata and controls
executable file
·55 lines (43 loc) · 1.65 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
#!/bin/sh
# This script compiles the cpu emulator and assembler.
# They are compiled to the bin/ directory.
# Use "chmod +x build.sh" if you're getting permission denied.
# Create bin directory if it does not exist
# Dont print the "it already exists" error
mkdir bin 2>/dev/null
# Remove the the existing execs just because
rm bin/cpu 2>/dev/null
rm bin/assembler 2>/dev/null
rm bin/run 2>/dev/null
rm bin/ish 2>/dev/null
rm bin/test 2>/dev/null
echo ""
echo "Compiling:"
# New Line
echo "==================================="
echo ""
# Compile to bin/cpu
c++ -std=c++17 -O3 src/cpu_main.cpp src/instr.cpp -o bin/cpu
echo "Compiled cpu to bin/cpu"
# Compile to bin/assembler
c++ -std=c++17 -O3 src/assembler_main.cpp src/assembler.cpp -o bin/assembler
echo "Compiled assembler to bin/assembler"
# Compile to bin/run
c++ -std=c++17 -Wall -O3 src/main.cpp src/instr.cpp src/assembler.cpp -o bin/run
echo "Compiled build+run to bin/run"
# Compile to bin/run
c++ -std=c++17 -Wall -O3 src/shell.cpp src/instr.cpp src/assembler.cpp -o bin/ish
echo "Compiled test shell to bin/ish"
# Compile to bin/test -- secret testing file
c++ -std=c++17 -Wall -O3 src/testing.cpp src/instr.cpp src/assembler.cpp -o bin/test
echo "Compiled test program to bin/test"
echo ""
echo "==================================="
# Print some instructions
echo ""
echo "To assemble the test files use this: \"bin/assembler filename\""
echo "To run the test files use this: \"bin/cpu filename.inst\""
echo "To assemble and run use this: \"bin/run filename\""
echo "Note: the cpu only runs the .inst files. These are what the assembler generates"
echo "Check the programs folder for the test programs."
echo ""