summaryrefslogblamecommitdiff
path: root/Makefile
blob: 908a6ca7809695497876ad4073203a0b8cae637f (plain) (tree)
1
2
3
4
5
6
7
8
9
10

                             
                   
 
 
           
                  
                       

                


                                               
                                             
 




                                                    
                                                                           
 














                                                                                                         
                  
                                    
 


                                       
                
                              




                                                   
                                                              
 

           

                                                 
                                                         
                                                   
 





                                                     
                                                     
                                                                           
                                                                 
 




                                               











                                                  
                          


                                                                       







                                                                                                   






                                                 
                  

                                                                           
 
                  

                                                                            
 
               


                                                                      
                                                


                           
CURRENT_OS:=$(shell uname -s)

INTO      = $(HOME)


INSTALL = \
	agignore \
	aspell.en.pws \
	zshenv \
	zshrc

INSTALLED = $(patsubst %,$(INTO)/.%,$(INSTALL))
LN        = @ln -sf
PACMAN    = @sudo pacman -Sy --needed --quiet

$(INTO)/.% : %
	@[ ! -e $@ ] || [ -h $@ ] || mv -f $@ $@.bak
	$(LN) $(PWD)/$< $@

$(HOME)/.ssh/authorized_keys:
	@curl https://github.com/fcuny.keys -o $(HOME)/.ssh/authorized_keys

.PHONY: systemd-user
systemd-user:
	@mkdir -p $(HOME)/.config/systemd/user

.PHONY: pamenv
pamenv:
	$(LN) $(PWD)/pam_environment $(HOME)/.pam_environment

.PHONY: ssh
ssh: systemd-user pamenv
ifeq ($(CURRENT_OS),Linux)
	$(LN) $(PWD)/config/systemd/user/ssh-agent.service $(HOME)/.config/systemd/user/ssh-agent.service
	@systemctl --user enable ssh-agent
endif

$(HOME)/workspace:
	@mkdir -p $(HOME)/workspace/

$(HOME)/workspace/go: $(HOME)/workspace
	@mkdir -p $(HOME)/workspace/go

.PHONY: go-setup
go-setup: $(HOME)/workspace/go
	@go get -u github.com/kisielk/errcheck
	@go get -u github.com/rogpeppe/godef
	@go get -u github.com/zmb3/gogetdoc
	@go get -u golang.org/x/tools/cmd/goimports
	@go get -u golang.org/x/tools/cmd/guru
	@GO111MODULE=on go get golang.org/x/tools/gopls@latest

.PHONY: git
git:
	$(LN) $(PWD)/gitconfig $(HOME)/.gitconfig
	$(LN) $(PWD)/gitignore $(HOME)/.gitignore
	@git config --local user.email "franck@fcuny.net"
	@git config --local user.name "Franck Cuny"

.PHONY: desktop
desktop:
	@mkdir -p $(HOME)/.config
	@ln -sf $(PWD)/xsession $(HOME)/.xsession
	@ln -sf $(PWD)/Xresources $(HOME)/.Xresources
	@ln -sf $(PWD)/config/i3 $(HOME)/.config/i3
	@ln -sf $(PWD)/config/mpd $(HOME)/.config/mpd
	@ln -sf $(PWD)/config/user-dirs.dirs $(HOME)/.config/user-dirs.dirs
	@ln -sf $(PWD)/config/alacritty $(HOME)/.config/alacritty

.PHONY: modmap
modmap:
	$(PACMAN) xorg-xmodmap
	@ln -sf $(PWD)/Xmodmap $(HOME)/.Xmodmap

.PHONY: emacs
emacs:
ifeq ($(CURRENT_OS),Linux)
	$(PACMAN) emacs
	$(LN) $(PWD)/emacs.d $(HOME)/.config/emacs
endif
ifeq ($(CURRENT_OS),Darwin)
	$(LN) $(PWD)/emacs.d $(HOME)/.emacs.d
endif

.PHONY: redshift
redshift:
	$(PACMAN) redshift
	$(LN) $(PWD)/config/redshift.conf $(HOME)/.config/redshift.conf
	@systemctl --user enable redshift

.PHONY: resticcfg
resticcfg:
	@mkdir -p $(HOME)/.config/restic
	$(PACMAN) restic
	$(LN) $(PWD)/config/systemd/user/backup.service $(HOME)/.config/systemd/user/backup.service
	@systemctl --user daemon-reload
	@systemctl --user enable backup

.PHONY: tmux
tmux:
ifeq ($(CURRENT_OS),Linux)
	$(PACMAN) tmux
endif
	$(LN) $(PWD)/tmux.conf $(HOME)/.tmux.conf

.PHONY: check-dead
check-dead:
	@find ~ -maxdepth 1 -name '.*' -type l -exec test ! -e {} \; -print

.PHONY: clean-dead
clean-dead:
	@find ~ -maxdepth 1 -name '.*' -type l -exec test ! -e {} \; -delete

.PHONY: install
install: $(HOME)/workspace $(HOME)/.ssh/authorized_keys git tmux emacs

.PHONY: install-linux
install-linux: redshift desktop resticcfg modmap

.PHONY: install-darwin
install-darwin: screenshots