Skip to content

Commit

Permalink
lint and add clean script
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex313031 committed Mar 1, 2024
1 parent 52e26fa commit 3d8073f
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 15 deletions.
18 changes: 3 additions & 15 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

# Copyright (c) 2023 Alex313031.
# Copyright (c) 2024 Alex313031.

YEL='\033[1;33m' # Yellow
CYA='\033[1;96m' # Cyan
Expand Down Expand Up @@ -35,13 +35,6 @@ printf "${YEL}Running \`make clean\` and \`make distclean\`...\n" &&
printf "${CYA}\n" &&

# Clean artifacts
export NINJA_SUMMARIZE_BUILD=1 &&

export CFLAGS="-D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600 -DNDEBUG -g0 -s -O3 -mavx -maes" &&
export CXXFLAGS="-D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600 -DNDEBUG -g0 -s -O3 -mavx -maes" &&
export CPPFLAGS="-D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600 -DNDEBUG -g0 -s -O3 -mavx -maes" &&
export LDFLAGS="-Wl,-O3 -mavx -maes" &&

make clean && make distclean &&

printf "\n" &&
Expand All @@ -59,7 +52,6 @@ printf "${YEL}Building htop (Debug Version)...\n" &&
printf "${CYA}\n" &&

# Build debug htop
export NINJA_SUMMARIZE_BUILD=1 &&

./autogen.sh &&

Expand All @@ -81,8 +73,7 @@ printf "\n" &&
printf "${YEL}Building htop (SSE4.1 Version)...\n" &&
printf "${CYA}\n" &&

# Build htop
export NINJA_SUMMARIZE_BUILD=1 &&
# Build htop without AVX

export CFLAGS="-D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600 -DNDEBUG -g0 -s -O3 -msse4.1 -flto=auto" &&
export CXXFLAGS="-D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600 -DNDEBUG -g0 -s -O3 -msse4.1 -flto=auto" &&
Expand All @@ -109,7 +100,6 @@ printf "${YEL}Building htop...\n" &&
printf "${CYA}\n" &&

# Build htop
export NINJA_SUMMARIZE_BUILD=1 &&

export CFLAGS="-D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600 -DNDEBUG -g0 -s -O3 -mavx -maes -flto=auto" &&
export CXXFLAGS="-D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600 -DNDEBUG -g0 -s -O3 -mavx -maes -flto=auto" &&
Expand All @@ -125,6 +115,4 @@ make VERBOSE=1 V=1 &&
printf "\n" &&
printf "${GRE}${bold}Build Completed. ${YEL}${bold}You can now run \`sudo make install\` or \`make install\` to install it.\n" &&
printf "\n" &&
tput sgr0 &&

exit 0
tput sgr0
39 changes: 39 additions & 0 deletions clean.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/bin/bash

# Copyright (c) 2024 Alex313031.

YEL='\033[1;33m' # Yellow
CYA='\033[1;96m' # Cyan
RED='\033[1;31m' # Red
GRE='\033[1;32m' # Green
c0='\033[0m' # Reset Text
bold='\033[1m' # Bold Text
underline='\033[4m' # Underline Text

# Error handling
yell() { echo "$0: $*" >&2; }
die() { yell "$*"; exit 111; }
try() { "$@" || die "${RED}Failed $*"; }

# --help
displayHelp () {
printf "\n" &&
printf "${bold}${GRE}Script to clean htop build artifacts.${c0}\n" &&
printf "${bold}${YEL}Use the --help flag to show this help.${c0}\n" &&
printf "\n"
}
case $1 in
--help) displayHelp; exit 0;;
esac

printf "\n" &&
printf "${YEL}Running \`make clean\` and \`make distclean\`...\n" &&
printf "${CYA}\n" &&

# Clean artifacts
make clean && make distclean &&

printf "\n" &&
printf "${GRE}${bold}Done.\n" &&
printf "\n" &&
tput sgr0

0 comments on commit 3d8073f

Please sign in to comment.