This repository has been archived by the owner on Mar 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathbuild.sh
executable file
·85 lines (81 loc) · 2.2 KB
/
build.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#!/bin/bash
if [ ! $# -eq 2 ] #FIXME:normal way of chceking whether -n argument used
then
echo "╔╦╗╔╦╗╔═╗╔═╗╔═╗╦═╗"
echo " ║║ ║║║ ║╚═╗║╣ ╠╦╝"
echo "═╩╝═╩╝╚═╝╚═╝╚═╝╩╚═ v1.2 builder"
fi
if [ $# -eq 0 ]
then
echo -n "Usage:"
echo -n $0
echo " [-h] [debug|release|clean|update] [-n]"
echo " -h - display this message"
echo " -n - do not display logo"
echo " debug - build for debug(no optimization)"
echo " release - build for release(maximum optimization)"
echo " clean - delete old build"
echo " update - try automatically download new version and build it for release"
exit -1
fi
if [ $1 == "-h" ]
then
echo -n "Usage:"
echo -n $0
echo " [-h] [debug|release|clean|update] [-n]"
echo " -h - display this message"
echo " -n - do not display logo"
echo " debug - build for debug(no optimization)"
echo " release - build for release(maximum optimization)"
echo " clean - delete old build"
echo " update - try automatically download new version and build it for release"
exit 0
fi
if [ $1 = "clean" ]
then
echo -n "Cleaning up..."
if [ ! -f "ddos" ]
then
echo "Already cleaned"
exit
fi
rm ddos
if [ $? -eq 0 ]
then
echo "OK"
fi
exit
fi
if [ $1 = "debug" ]
then
echo "Building debug"
gcc packet.c memcrashed.c ping.c util.c message.c socket.c ddos.c main.c -v -lm -lpthread -o ddos
exit
fi
if [ $1 = "release" ]
then
echo "Building release"
gcc packet.c ping.c util.c message.c socket.c ddos.c main.c -lm -Ofast -Os -lpthread -o ddos
exit
fi
if [ $1 = "update" ]
then
echo "Updating..."
git pull
if [ $? != 0 ]
then
echo "+----------------|ERROR!!!|----------------+"
echo "|git pull failed! |"
echo "|It seems that you need to update manually |"
echo "|To update manually clone repository again |"
echo "|(using git clone) and build (using this |"
echo "|script) |"
echo "+------------------------------------------+"
exit -1
fi
./$0 clean -n
./$0 release -n
exit
fi
echo -n "Unknown option:"
echo $1