Improve Makefile & shell configs
* Add cross platform support in Makefile * Add host-specific configurations support.
This commit is contained in:
87
Makefile
87
Makefile
@@ -16,7 +16,37 @@ 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
|
||||
|
||||
.PHONY: help
|
||||
|
||||
# Some things have to be done in varying ways depending on the OS
|
||||
ARCH := $(shell uname -s)
|
||||
|
||||
# For GNU/Linux
|
||||
ifeq (${ARCH},Linux)
|
||||
ARCH_DEFINED := ok
|
||||
HOSTNAME := $(shell hostname)
|
||||
endif
|
||||
|
||||
# For MacOS X
|
||||
ifeq (${ARCH},Darwin)
|
||||
ARCH_DEFINED := ok
|
||||
HOSTNAME := $(shell hostname -s)
|
||||
endif
|
||||
|
||||
# For Windows
|
||||
ifeq ($(word 2,$(subst -, ,$(subst _, ,${ARCH}))),NT)
|
||||
ARCH_DEFINED := ok
|
||||
HOSTNAME := $(shell hostname)
|
||||
endif
|
||||
|
||||
ifneq (${ARCH_DEFINED},ok)
|
||||
$(info )
|
||||
$(info :: ERROR: Please add the necessary support or use one of:)
|
||||
$(info :: Linux, Mac OS X (Darwin), Windows.)
|
||||
$(info )
|
||||
$(error Unsupported architecture: $(ARCH))
|
||||
else
|
||||
|
||||
.PHONY:
|
||||
help:
|
||||
${ECHO} "help:\tShow this help"
|
||||
${ECHO} "all:\tSetup all the dot files in one go"
|
||||
@@ -31,54 +61,59 @@ help:
|
||||
${ECHO} "i3:\tInstall i3wm configuration files"
|
||||
${ECHO}
|
||||
|
||||
.PHONY: all
|
||||
.PHONY:
|
||||
all: bash zsh git vim x11 i3
|
||||
|
||||
.PHONY: git config/git
|
||||
git: config/git
|
||||
config/git: config/dir
|
||||
.PHONY:
|
||||
git: .config/git
|
||||
.config/git: .config/dir
|
||||
|
||||
.PHONY: bash profile bashrc bash_aliases bash_logout
|
||||
bash: profile bashrc bash_aliases bash_logout
|
||||
.PHONY:
|
||||
sh: .profile
|
||||
|
||||
.PHONY: zsh 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
|
||||
.PHONY:
|
||||
bash: .profile .bashrc .bash_aliases .bash_logout
|
||||
|
||||
.PHONY: omz
|
||||
.PHONY:
|
||||
zsh: .profile .zprofile .zshrc .oh-my-zsh/themes/lsambuc.zsh-theme
|
||||
.oh-my-zsh/themes/lsambuc.zsh-theme: .oh-my-zsh/themes/dir
|
||||
|
||||
.PHONY:
|
||||
omz:
|
||||
${MV} "$@" "$@-${TS}"
|
||||
${Q} ${CURL} "${OMYZSH_URL}" | sh
|
||||
|
||||
.PHONY: vim vim/bundle/dir vimrc vim/filetype.vim vim/syntax
|
||||
.PHONY:
|
||||
vim: ~/.vim/bundle/vundle
|
||||
${ECHO}
|
||||
vim +BundleInstall +qall
|
||||
${ECHO}
|
||||
${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} "$@" "$@-${TS}"
|
||||
git clone "${VUNDLE_URL}" "$@"
|
||||
|
||||
vim/filetype.vim vim/syntax: vim/dir
|
||||
.vim/filetype.vim .vim/syntax: .vim/dir
|
||||
|
||||
.PHONY: tmux config/tmux config/dir
|
||||
tmux: config/tmux
|
||||
config/tmux: config/dir
|
||||
.PHONY:
|
||||
tmux: .config/tmux
|
||||
.config/tmux: .config/dir
|
||||
|
||||
.PHONY: i3 config/i3 config/i3status.conf
|
||||
i3: config/i3 config/i3status.conf
|
||||
config/i3 config/i3status.conf: config/dir
|
||||
.PHONY:
|
||||
i3: .config/i3 .config/i3status.conf
|
||||
.config/i3 .config/i3status.conf: .config/dir
|
||||
|
||||
.PHONY: x11 Xdefaults xinitrc xsession
|
||||
x11: Xdefaults xinitrc xsession
|
||||
.PHONY:
|
||||
x11: .Xdefaults .xinitrc .xsession
|
||||
|
||||
%/dir:
|
||||
${MKDIR} "~/.$(shell dirname $@)"
|
||||
${MKDIR} "~/$(shell dirname $@)"
|
||||
|
||||
%:
|
||||
.%:
|
||||
@# Prevent generating link within links to folders
|
||||
${MV} "~/.$@" "~/.$@-${TS}"
|
||||
${LN} "$(shell pwd)/_$@" "~/.$@"
|
||||
@[ -e ~/.$* ] && mv ~/.$* ~/.$*-${TS} || true
|
||||
${LN} $(shell pwd)/_$* ~/.$*
|
||||
@[ -e ${HOSTNAME}.$* ] && ( [ -e ~/.host.$* ] && mv ~/.host.$* ~/.host.$*-${TS}; ln -s $(shell pwd)/${HOSTNAME}.$* ~/.host.$* ) || true
|
||||
|
||||
endif
|
||||
|
||||
22
README.md
22
README.md
@@ -2,11 +2,27 @@
|
||||
|
||||
This repository contains my personal profile configuration.
|
||||
|
||||
## VIM
|
||||
## Notes
|
||||
|
||||
### VIM
|
||||
|
||||
The configuration relies on Vundle and expects a Nerd Font.
|
||||
|
||||
### ZSH
|
||||
|
||||
The configuration relies on [Ho My Zsh](https://ohmyz.sh).
|
||||
|
||||
The target to install it is **not** automatically triggered at this time, even with `make all`.
|
||||
|
||||
### Host-specific config
|
||||
|
||||
You can add host specific configuration by adding named it the following way:
|
||||
|
||||
```sh
|
||||
git clone https://github.com/gmarik/vundle.git ~/.vim/bundle/vundle
|
||||
vim +BundleInstall +qall
|
||||
${hostname}.profile # Used by both zsh & bash
|
||||
${hostname}.zshrc
|
||||
${hostname}.bashrc
|
||||
${hostname}.aliases # Used by both zsh & bash
|
||||
```
|
||||
|
||||
If such files exist when you install the configuration files, symlink will be added and they will be automatically picked up by the configuration.
|
||||
|
||||
11
_bashrc
11
_bashrc
@@ -80,11 +80,21 @@ if [ -x /bin/dircolors ]; then
|
||||
alias ls='ls --color=auto'
|
||||
fi
|
||||
|
||||
# Host-specific definitions
|
||||
if [ -f "${HOME}/.host.bashrc" ]; then
|
||||
. "${HOME}/.host.bashrc"
|
||||
fi
|
||||
|
||||
# Alias definitions
|
||||
if [ -f "${HOME}/.bash_aliases" ]; then
|
||||
. "${HOME}/.bash_aliases"
|
||||
fi
|
||||
|
||||
# Host-specific alias definitions
|
||||
if [ -f "${HOME}/.host.aliases" ]; then
|
||||
. "${HOME}/.host.aliases"
|
||||
fi
|
||||
|
||||
#colorize stderr
|
||||
function swapandcolorize()
|
||||
{
|
||||
@@ -115,3 +125,4 @@ function swapandcolorize()
|
||||
return ${PIPESTATUS[0]}
|
||||
}
|
||||
export -f swapandcolorize
|
||||
|
||||
|
||||
9
_profile
9
_profile
@@ -8,6 +8,11 @@
|
||||
# for ssh logins, install and configure the libpam-umask package.
|
||||
#umask 022
|
||||
|
||||
# Host-specific alias definitions
|
||||
if [ -f "${HOME}/.host.profile" ]; then
|
||||
. "${HOME}/.host.profile"
|
||||
fi
|
||||
|
||||
# When running bash
|
||||
if [ -n "${BASH_VERSION}" ]; then
|
||||
# include .bashrc if it exists
|
||||
@@ -27,7 +32,7 @@ if [ -e "${HOME}/bin" ]; then
|
||||
fi
|
||||
|
||||
# Add cargo
|
||||
if [ -e "${HOME}/.cargo/bin" ]; then
|
||||
PATH="${HOME}/.cargo/bin:${PATH}"
|
||||
if [ -f "${HOME}/.cargo/env" ]; then
|
||||
. "$HOME/.cargo/env"
|
||||
fi
|
||||
|
||||
|
||||
10
_zshrc
10
_zshrc
@@ -109,7 +109,17 @@ unsetopt correct_all
|
||||
export VISUAL=vi
|
||||
export EDITOR=vi
|
||||
|
||||
# Host-specific definitions
|
||||
if [ -f "${HOME}/.host.zshrc" ]; then
|
||||
. "${HOME}/.host.zshrc"
|
||||
fi
|
||||
|
||||
# Alias definitions
|
||||
if [ -f "${HOME}/.bash_aliases" ]; then
|
||||
. "${HOME}/.bash_aliases"
|
||||
fi
|
||||
|
||||
# Host-specific alias definitions
|
||||
if [ -f "${HOME}/.host.aliases" ]; then
|
||||
. "${HOME}/.host.aliases"
|
||||
fi
|
||||
|
||||
4
omoikane.profile
Normal file
4
omoikane.profile
Normal file
@@ -0,0 +1,4 @@
|
||||
# Add brew
|
||||
if [ -x "/opt/homebrew/bin/brew" ]; then
|
||||
eval "$(/opt/homebrew/bin/brew shellenv)"
|
||||
fi
|
||||
Reference in New Issue
Block a user