HOST=$(shell hostname)

server: mkdirs softlinks gitconfig
	@echo "Running firstrun and Linking softlinks (server)"

nonserver: mkdirs softlinks-non-server softlinks gitconfig
	@echo "Running firstrun and Linking softlinks (non-server)"


softlinks: dependencies 
	@test -L ${HOME}/.mutt || ln -s ${HOME}/dotfiles/.mutt ${HOME}/.mutt
	@test -L ${HOME}/.muttrc || ln -s ${HOME}/dotfiles/.muttrc ${HOME}/.muttrc
	@test -L ${HOME}/.elinks || ln -s ${HOME}/dotfiles/.elinks ${HOME}/.elinks
	@test -L ${HOME}/.irssi || ln -s ${HOME}/dotfiles/.irssi ${HOME}/.irssi
	@test -L ${HOME}/.gitconfig || ln -s ${HOME}/dotfiles/.gitconfig ${HOME}/.gitconfig
	@test -L ${HOME}/.gitignore || ln -s ${HOME}/dotfiles/.gitignore ${HOME}/.gitignore
	@test -L ${HOME}/.tmux.conf || ln -s ${HOME}/dotfiles/.tmux.conf ${HOME}/.tmux.conf

softlinks-non-server: dependencies-nonserver
	@test -L ${HOME}/.abcde.conf || ln -s ${HOME}/dotfiles/.abcde.config ${HOME}/.abcde.conf
	@test -L ${HOME}/.crawlrc || ln -s ${HOME}/dotfiles/.crawlrc ${HOME}/.crawlrc
	@test -L ${HOME}/.dosbox || ln -s ${HOME}/dotfiles/.dosbox ${HOME}/.dosbox

gitconfig: dependencies softlinks
	git config --global user.name "${USER} ($(HOST))"
	git config --global user.email chawley@planethawleywood.com

dependencies:
	sudo apt install mutt || sudo yum install mutt
	sudo apt install tmux || sudo yum install tmux
	sudo apt install elinks || sudo yum install elinks
	sudo apt install irssi || sudo yum install irssi
	sudo apt install git || sudo yum install git

dependencies-non-server: dependencies
	sudo apt install abcde || sudo yum install abcde
	sudo apt install dosbox || sudo yum install dosbox

mkdirs:
	mkdir -p ${HOME}/bin
	mkdir -p ${HOME}/.ssh

