-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathmake-linux
More file actions
executable file
·40 lines (37 loc) · 1015 Bytes
/
make-linux
File metadata and controls
executable file
·40 lines (37 loc) · 1015 Bytes
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
#!/usr/bin/env bash
# Uncomment the following line to get more verbose output
# set -x
output_file=39dll-4-linux.so
echo "Cleaning up previous build..."
rm -rf obj/
mkdir obj
if [ ! $? -eq 0 ]; then
echo "Failed to clean up environment."
exit 1;
else
echo "Cleaned up previous build environment."
fi
echo "Building all source files in the current directory"
for file in $( ls | grep .cpp ); do g++ -fPIC -c -o obj/`echo $file | awk -F. '{ print $1 }'`.o $file; done
if [ ! $? -eq 0 ]; then
echo "Failed to build source files"
exit 1;
else
echo "Successfully built source files."
fi
echo "Cleaning up previous shared library"
rm -f $output_file
if [ ! $? -eq 0 ]; then
echo "Failed to remove old library."
exit 1;
else
echo "Successfully removed old library."
fi
echo "Packaging shared library"
g++ -shared obj/*.o -o $output_file
if [ ! $? -eq 0 ]; then
echo "Failed to package shared library."
exit 1;
else
echo "Successfully packaged shared library. It is located at ./$output_file"
fi