summary refs log tree commit diff
path: root/Makefile
diff options
context:
space:
mode:
authorFranck Cuny <franck@fcuny.net>2021-01-04 19:23:03 -0800
committerFranck Cuny <franck@fcuny.net>2021-01-04 19:23:03 -0800
commit6a613d61dc235cd855bc5873b97a9f5cbd140894 (patch)
tree1332c2184ceb5e5d70b92d58311831eb3be79f67 /Makefile
parentredshift: fix longitude for Berkeley (diff)
downloademacs.d-6a613d61dc235cd855bc5873b97a9f5cbd140894.tar.gz
make: split between Darwin and Linux
There's a few things that are relevant to both OS, but there's also a
bunch of stuff specific to Linux. Split the file to make it easier to
maintain / read.

Also add a new gitconfig file to be included depending on the OS: since
Darwin is for work, let's use work email there, and personal email for
Linux.
Diffstat (limited to '')
-rw-r--r--Makefile116
-rw-r--r--Makefile.darwin6
-rw-r--r--Makefile.linux19
3 files changed, 38 insertions, 103 deletions
diff --git a/Makefile b/Makefile
index 908a6ca..38f2b61 100644
--- a/Makefile
+++ b/Makefile
@@ -1,108 +1,26 @@
-CURRENT_OS:=$(shell uname -s)
+OS := $(shell uname -s)
 
-INTO      = $(HOME)
+LN = @ln -sf
 
-
-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
+ifeq ($(OS),Darwin)
+include Makefile.darwin
+else
+include Makefile.linux
 endif
 
-$(HOME)/workspace:
+.PHONY: install-general
+install-general:
 	@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:
+	@curl -s https://github.com/fcuny.keys -o $(HOME)/.ssh/authorized_keys
+	$(LN) $(PWD)/aspell.en.pws $(HOME)/.aspell.en.pws
 	$(LN) $(PWD)/gitconfig $(HOME)/.gitconfig
 	$(LN) $(PWD)/gitignore $(HOME)/.gitignore
+	$(LN) $(PWD)/tmux.conf $(HOME)/.tmux.conf
+	$(LN) $(PWD)/zshenv $(HOME)/.zshenv
+	$(LN) $(PWD)/zshrc $(HOME)/.zshrc
 	@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
@@ -111,11 +29,3 @@ check-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
diff --git a/Makefile.darwin b/Makefile.darwin
new file mode 100644
index 0000000..3621942
--- /dev/null
+++ b/Makefile.darwin
@@ -0,0 +1,6 @@
+.PHONY: install-darwin-symlinks
+install-darwin-symlinks: install-general
+	$(LN) $(PWD)/gitconfig.twitter $(HOME)/.gitconfig.private
+	$(LN) $(PWD)/emacs.d $(HOME)/.emacs.d
+
+install: install-darwin-symlinks
diff --git a/Makefile.linux b/Makefile.linux
new file mode 100644
index 0000000..256cd33
--- /dev/null
+++ b/Makefile.linux
@@ -0,0 +1,19 @@
+.PHONY: install-linux-symlinks
+install-linux-symlinks: install-general
+	@mkdir -p $(HOME)/.config
+	@mkdir -p $(HOME)/.config/systemd
+	$(LN) $(PWD)/Xmodmap $(HOME)/.Xmodmap
+	$(LN) $(PWD)/Xresources $(HOME)/.Xresources
+	$(LN) $(PWD)/config/alacritty $(HOME)/.config/
+	$(LN) $(PWD)/config/i3/ $(HOME)/.config/
+	$(LN) $(PWD)/config/mpd/ $(HOME)/.config/
+	$(LN) $(PWD)/config/redshift.conf $(HOME)/.config/redshift.conf
+	$(LN) $(PWD)/config/systemd/user/backup.service $(HOME)/.config/systemd/user/backup.service
+	$(LN) $(PWD)/config/systemd/user/ssh-agent.service $(HOME)/.config/systemd/user/ssh-agent.service
+	$(LN) $(PWD)/config/user-dirs.dirs $(HOME)/.config/user-dirs.dirs
+	$(LN) $(PWD)/emacs.d/ $(HOME)/.config/
+	$(LN) $(PWD)/gitconfig.personal $(HOME)/.gitconfig.private
+	$(LN) $(PWD)/pam_environment $(HOME)/.pam_environment
+	$(LN) $(PWD)/xsession $(HOME)/.xsession
+
+install: install-linux-symlinks