Cleanup Makefile and shell configs

This commit is contained in:
2023-04-06 06:45:09 +02:00
parent 4f2a71c217
commit 3cf804b159
4 changed files with 58 additions and 50 deletions

View File

@@ -1,10 +1,19 @@
Q := @ # Override on the command line, for example
ECHO := @echo # make Q=""
LN := ln -sf # would print on the console all the commands being run, instead of just their outputs
MKDIR := ${Q}mkdir -p Q := @
MV := ${Q}mv
OMYZSH_GET := curl -L https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh # The role of echo is to print, so never print the command itsef
ECHO := @echo
LN := ${Q}ln -sf
MKDIR := ${Q}mkdir -p
MV := ${Q}mv
# Make sure that all files moved during this invokation of make get the same
# timestamp.
TS := $(shell date -Iseconds)
OMYZSH_URL := https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh
VUNDLE_URL := https://github.com/gmarik/vundle.git VUNDLE_URL := https://github.com/gmarik/vundle.git
.PHONY: help .PHONY: help
@@ -36,10 +45,10 @@ bash: profile bashrc bash_aliases bash_logout
zsh: profile zprofile zshrc oh-my-zsh/themes/lsambuc.zsh-theme zsh: profile zprofile zshrc oh-my-zsh/themes/lsambuc.zsh-theme
oh-my-zsh/themes/lsambuc.zsh-theme: oh-my-zsh/themes/dir oh-my-zsh/themes/lsambuc.zsh-theme: oh-my-zsh/themes/dir
.PHONY: omz omz-setup .PHONY: omz
omz: omz:
${MV} $@ $@-$(shell date -Iseconds) ${MV} "$@" "$@-${TS}"
$(Q) $(OMYZSH_GET) | sh ${Q} ${CURL} "${OMYZSH_URL}" | sh
.PHONY: vim vim/bundle/dir vimrc vim/filetype.vim vim/syntax .PHONY: vim vim/bundle/dir vimrc vim/filetype.vim vim/syntax
vim: ~/.vim/bundle/vundle vim: ~/.vim/bundle/vundle
@@ -49,8 +58,8 @@ vim: ~/.vim/bundle/vundle
${ECHO} Do not forget to install and set a Nerdfont enhanced font. ${ECHO} Do not forget to install and set a Nerdfont enhanced font.
~/.vim/bundle/vundle: vim/bundle/dir vimrc vim/filetype.vim vim/syntax ~/.vim/bundle/vundle: vim/bundle/dir vimrc vim/filetype.vim vim/syntax
${MV} $@ $@-$(shell date -Iseconds) ${MV} "$@" "$@-${TS}"
git clone ${VUNDLE_URL} $@ git clone "${VUNDLE_URL}" "$@"
vim/filetype.vim vim/syntax: vim/dir vim/filetype.vim vim/syntax: vim/dir
@@ -66,10 +75,10 @@ config/i3 config/i3status.conf: config/dir
x11: Xdefaults xinitrc xsession x11: Xdefaults xinitrc xsession
%/dir: %/dir:
${MKDIR} ~/.$(shell dirname $@) ${MKDIR} "~/.$(shell dirname $@)"
%: %:
@# Prevent generating link within links to folders @# Prevent generating link within links to folders
${MV} ~/.$@ ~/.$@-$(shell date -Iseconds) ${MV} "~/.$@" "~/.$@-${TS}"
${LN} $(shell pwd)/_$@ ~/.$@ ${LN} "$(shell pwd)/_$@" "~/.$@"

46
_bashrc
View File

@@ -80,9 +80,9 @@ if [ -x /bin/dircolors ]; then
alias ls='ls --color=auto' alias ls='ls --color=auto'
fi fi
# Alias definitions. # Alias definitions
if [ -f ~/.bash_aliases ]; then if [ -f "${HOME}/.bash_aliases" ]; then
. ~/.bash_aliases . "${HOME}/.bash_aliases"
fi fi
#colorize stderr #colorize stderr
@@ -90,28 +90,28 @@ function swapandcolorize()
{ {
# "$@" 3>&2 2>&1 1>&3 | while read line # "$@" 3>&2 2>&1 1>&3 | while read line
# do # do
# echo -e "\e[91m$line\e[0m" # echo -e "\e[91m$line\e[0m"
# done # done
"$@" 3>&2 2>&1 1>&3 | perl -e 'while(<>) "$@" 3>&2 2>&1 1>&3 | perl -e 'while(<>)
{ {
chomp; chomp;
#Print in LYELLOW and blue background xenomai stuff warning and such #Print in LYELLOW and blue background xenomai stuff warning and such
if (m/^xenomai.+:\d+:(\d+:)?\s+warning.*/) if (m/^xenomai.+:\d+:(\d+:)?\s+warning.*/)
{print "\033[1;45m".$_."\033[m\n"; next;} {print "\033[1;45m".$_."\033[m\n"; next;}
#Print in DARKBLUE forced warnings #Print in DARKBLUE forced warnings
if (m/.*\#warning.*/) if (m/.*\#warning.*/)
{print "\033[1;34m".$_."\033[m\n"; next;} {print "\033[1;34m".$_."\033[m\n"; next;}
#Print in LYELLOW warning and such #Print in LYELLOW warning and such
if (m/.+:\d+:(\d+:)?\s+warning.*/) if (m/.+:\d+:(\d+:)?\s+warning.*/)
{print "\033[1;33m".$_."\033[m\n"; next;} {print "\033[1;33m".$_."\033[m\n"; next;}
#print in LRED errors #print in LRED errors
if (m/.+:\d+:(\d+:)?\s+error.*/ || if (m/.+:\d+:(\d+:)?\s+error.*/ ||
m/.+:\d+:(\d+:)? undefined reference to `/) m/.+:\d+:(\d+:)? undefined reference to `/)
{print "\033[1;31m".$_."\033[m\n"; next;} {print "\033[1;31m".$_."\033[m\n"; next;}
#Print in default colors #Print in default colors
{print "\033[m".$_."\n"; next;} {print "\033[m".$_."\n"; next;}
};' };'
return ${PIPESTATUS[0]} return ${PIPESTATUS[0]}
} }
export -f swapandcolorize export -f swapandcolorize

View File

@@ -9,26 +9,25 @@
#umask 022 #umask 022
# When running bash # When running bash
if [ -n "$BASH_VERSION" ]; then if [ -n "${BASH_VERSION}" ]; then
# include .bashrc if it exists # include .bashrc if it exists
if [ -f "$HOME/.bashrc" ]; then if [ -f "${HOME}/.bashrc" ]; then
. "$HOME/.bashrc" . "${HOME}/.bashrc"
fi fi
fi fi
# Add brew # Add brew
if [ -x /opt/homebrew/bin/brew ]; then if [ -x "/opt/homebrew/bin/brew" ]; then
eval "$(/opt/homebrew/bin/brew shellenv)" eval "$(/opt/homebrew/bin/brew shellenv)"
fi fi
# Add ~/bin # Add ~/bin
if [ -e "$HOME/bin" ]; then if [ -e "${HOME}/bin" ]; then
PATH="$HOME/bin:$PATH" PATH="${HOME}/bin:${PATH}"
fi fi
# Add cargo # Add cargo
if [ -e "$HOME/.cargo/bin" ]; then if [ -e "${HOME}/.cargo/bin" ]; then
PATH="$HOME/.cargo/bin:$PATH" PATH="${HOME}/.cargo/bin:${PATH}"
fi fi

6
_zshrc
View File

@@ -109,7 +109,7 @@ unsetopt correct_all
export VISUAL=vi export VISUAL=vi
export EDITOR=vi export EDITOR=vi
# Alias definitions. # Alias definitions
if [ -f ~/.bash_aliases ]; then if [ -f "${HOME}/.bash_aliases" ]; then
. ~/.bash_aliases . "${HOME}/.bash_aliases"
fi fi