-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
49 lines (39 loc) · 1.68 KB
/
build.sh
File metadata and controls
49 lines (39 loc) · 1.68 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
#!/bin/bash
echo "=== Building SimpleFS for Windows ==="
# Clean
echo "Cleaning..."
rm -f src/library/*.o src/shell/*.o lib/*.a bin/*.exe
# Create directories
echo "Creating directories..."
mkdir -p bin lib data
# Compile library files
echo "Compiling disk.cpp..."
g++ -g -std=c++11 -Wall -Iinclude -c -o src/library/disk.o src/library/disk.cpp
if [ $? -ne 0 ]; then echo "Failed to compile disk.cpp"; exit 1; fi
echo "Compiling fs_layer_1.cpp..."
g++ -g -std=c++11 -Wall -Iinclude -c -o src/library/fs_layer_1.o src/library/fs_layer_1.cpp
if [ $? -ne 0 ]; then echo "Failed to compile fs_layer_1.cpp"; exit 1; fi
echo "Compiling fs_layer_2.cpp..."
g++ -g -std=c++11 -Wall -Iinclude -c -o src/library/fs_layer_2.o src/library/fs_layer_2.cpp
if [ $? -ne 0 ]; then echo "Failed to compile fs_layer_2.cpp"; exit 1; fi
echo "Compiling sha256.cpp..."
g++ -g -std=c++11 -Wall -Iinclude -c -o src/library/sha256.o src/library/sha256.cpp
if [ $? -ne 0 ]; then echo "Failed to compile sha256.cpp"; exit 1; fi
# Create library
echo "Creating library archive..."
ar rcs lib/libsfs.a src/library/disk.o src/library/fs_layer_1.o src/library/fs_layer_2.o src/library/sha256.o
if [ $? -ne 0 ]; then echo "Failed to create library"; exit 1; fi
# Compile shell
echo "Compiling shell..."
g++ -g -std=c++11 -Wall -Iinclude -c -o src/shell/sfssh.o src/shell/sfssh.cpp
if [ $? -ne 0 ]; then echo "Failed to compile shell"; exit 1; fi
# Link executable
echo "Linking executable..."
g++ -Llib -o bin/sfssh.exe src/shell/sfssh.o -lsfs
if [ $? -ne 0 ]; then echo "Failed to link executable"; exit 1; fi
echo ""
echo "=== Build Complete! ==="
echo ""
ls -lh bin/sfssh.exe
echo ""
echo "Run with: ./bin/sfssh.exe data/mydisk.img 200"