-
-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathbuild-linux.sh
executable file
·53 lines (46 loc) · 973 Bytes
/
build-linux.sh
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
#!/bin/bash
output="salam"
sources=(
"src/log.c"
"src/file.c"
"src/memory.c"
"src/array.c"
"src/parser.c"
"src/downloader.c"
"src/parser_layout.c"
"src/generator.c"
"src/generator_layout.c"
"src/generator_salam.c"
"src/generator_layout_style.c"
"src/generator_identifier.c"
"src/string_buffer.c"
"src/validator.c"
"src/validator_style.c"
"src/hashmap.c"
"src/hashmap_custom.c"
"src/array_custom.c"
"src/lexer.c"
"src/ast.c"
"src/ast_layout.c"
"src/ast_layout_style.c"
"src/main.c"
)
for src in "${sources[@]}"; do
echo "Compiling $src..."
if ! gcc -c "$src" -o "${src%.c}.o"; then
echo "Error: Compilation failed for $src"
exit 1
fi
done
echo "Linking object files..."
if ! gcc -o "$output" ./*.o; then
echo "Error: Linking failed"
exit 1
fi
# rm ./*.o
echo "Running the executable..."
if ! ./"$output" ../example/test6.salam ../out/; then
echo "Error: Execution failed"
exit 1
fi
echo "Build and execution completed successfully."