forked from zhenrong-wang/hpc-now
-
Notifications
You must be signed in to change notification settings - Fork 0
/
make_linux.sh
executable file
·66 lines (62 loc) · 3.07 KB
/
make_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
54
55
56
57
58
59
60
61
62
63
64
65
66
# Copyright (C) 2022-present Shanghai HPC-NOW Technologies Co., Ltd.
# This code is distributed under the license: MIT License
# Originally written by Zhenrong WANG
# mailto: zhenrongwang@live.com | wangzhenrong@hpc-now.com
#!/bin/bash
hpcopr_version_code=`cat ./hpcopr/now_macros.h | grep CORE_VERSION_CODE | awk -F"\"" '{print $2}'`
installer_version_code=`cat ./installer/installer.h | grep INSTALLER_VERSION_CODE | awk -F"\"" '{print $2}'`
which gcc >> /dev/null 2>&1
if [ $? -eq 0 ]; then
compiler='gcc'
else
which clang >> /dev/null 2>&1
if [ $? -eq 0 ]; then
compiler='clang'
else
echo -e "[ FATAL: ] No compiler (gcc/clang) found. Please install one. Exit now."
exit 1
fi
fi
echo -e "[ -INFO- ] Using the compiler ${compiler} to build this project."
if [ ! -n "$1" ]; then
echo -e "[ -INFO- ] Please specify an option: 'build', 'delete', or 'clear'"
echo -e "| build - (re)build the binaries"
echo -e "| delete - delete the previous binaries"
echo -e "| clear - remove the 'build' folder and binaries in it"
echo -e "[ -DONE- ] Exit now."
exit 1
elif [ "$1" = "build" ]; then
echo -e "[ START: ] Building the binaries now (including hpcmgr and now-server) ..."
mkdir -p ./build
rm -rf ./build/*
${compiler} ./hpcopr/*.c -Wall -o ./build/hpcopr-lin-${hpcopr_version_code}.exe
${compiler} -c ./hpcopr/general_funcs.c -Wall -o ./installer/gfuncs.o
${compiler} -c ./hpcopr/opr_crypto.c -Wall -o ./installer/ocrypto.o
${compiler} -c ./hpcopr/cluster_general_funcs.c -Wall -o ./installer/cgfuncs.o
${compiler} -c ./hpcopr/time_process.c -Wall -o ./installer/tproc.o
${compiler} -c ./hpcopr/general_print_info.c -Wall -o ./installer/gprint.o
${compiler} -c ./hpcopr/now_md5.c -Wall -o ./installer/md5.o
${compiler} -c ./hpcopr/now_sha256.c -Wall -o ./installer/sha256.o
ar -rc ./installer/libnow.a ./installer/gfuncs.o ./installer/ocrypto.o ./installer/cgfuncs.o ./installer/tproc.o ./installer/md5.o ./installer/gprint.o ./installer/sha256.o
${compiler} ./installer/installer.c -Wall ./installer/libnow.a -o ./build/installer-lin-${installer_version_code}.exe
${compiler} ./now-crypto/now-crypto-v3-aes.c -Wall -Ofast -o ./build/now-crypto-aes-lin.exe
${compiler} ./hpcmgr/hpcmgr.c -Wall -o ./build/hpcmgr.exe
${compiler} ./now-server/now-server.c -Wall -o ./build/now-server.exe
chmod +x ./build/*
rm -rf ./installer/*.a
rm -rf ./installer/*.o
elif [ "$1" = "delete" ]; then
echo -e "[ START: ] Deleting the binaries now ..."
rm -rf ./build/*
elif [ "$1" = "clear" ]; then
echo -e "[ START: ] Removing the build folder now ..."
rm -rf ./build
else
echo -e "[ -INFO- ] Please specify an option: 'build', 'delete', or 'clear'"
echo -e "| build - (re)build the binaries"
echo -e "| delete - delete the previous binaries"
echo -e "| clear - remove the 'build' folder and binaries in it"
echo -e "[ -DONE- ] Exit now."
exit 1
fi
echo -e "[ -DONE- ] Please check the console output for building results."