33 lines
655 B
Bash
Executable file
33 lines
655 B
Bash
Executable file
#!/bin/bash
|
|
|
|
# SIC/XE Simulator - build and run script
|
|
|
|
# compile source files
|
|
echo "Compiling..."
|
|
g++ -std=c++11 -pthread -c Device.cpp InputDevice.cpp OutputDevice.cpp FileDevice.cpp Utils.cpp Machine.cpp main.cpp
|
|
|
|
if [ $? -ne 0 ]; then
|
|
echo "Compilation failed!"
|
|
exit 1
|
|
fi
|
|
|
|
# link
|
|
g++ -std=c++11 -pthread -o simulator *.o
|
|
|
|
if [ $? -ne 0 ]; then
|
|
echo "Linking failed!"
|
|
exit 1
|
|
fi
|
|
|
|
echo "Build successful!"
|
|
|
|
# run with argument if provided
|
|
if [ $# -gt 0 ]; then
|
|
echo ""
|
|
./simulator "$1"
|
|
else
|
|
echo "Usage: ./run.sh <file.obj>"
|
|
echo ""
|
|
echo "Available .obj files:"
|
|
ls -1 *.obj 2>/dev/null || echo " (none found)"
|
|
fi
|