summary refs log tree commit diff
diff options
context:
space:
mode:
authorFranck Cuny <franck@fcuny.net>2020-10-01 17:58:02 -0700
committerFranck Cuny <franck@fcuny.net>2020-10-01 17:58:02 -0700
commit42b51366a1a897effc0035577746d4b57adcd813 (patch)
tree3ba6af7737f5cc821139b5897b634c33413cab56
parent[desktop] more configuration files for linux (diff)
downloademacs.d-42b51366a1a897effc0035577746d4b57adcd813.tar.gz
Update makefile
Start to re-organize the Makefile to install the configuration for both
linux and darwin. This is work in progress.
-rw-r--r--Makefile77
-rwxr-xr-xscripts/osx.sh3
2 files changed, 64 insertions, 16 deletions
diff --git a/Makefile b/Makefile
index dd498ce..f77ae93 100644
--- a/Makefile
+++ b/Makefile
@@ -1,3 +1,5 @@
+CURRENT_OS:=$(shell uname -s)
+
 INTO      = $(HOME)
 
 
@@ -5,18 +7,12 @@ INSTALL = \
 	agignore \
 	aspell.en.pws \
 	ctags \
-  config/i3 \
-	emacs.d \
-	gitconfig \
-	gitignore \
-	tmux.conf \
-	Xresources \
-	xsession \
 	zshenv \
 	zshrc
 
 INSTALLED = $(patsubst %,$(INTO)/.%,$(INSTALL))
 LN        = @ln -sf
+PACMAN    = @sudo pacman -Sy --needed --quiet
 
 $(INTO)/.% : %
 	@[ ! -e $@ ] || [ -h $@ ] || mv -f $@ $@.bak
@@ -25,29 +21,78 @@ $(INTO)/.% : %
 $(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: screenshots
 $(HOME)/Documents/screenshots:
 	@mkdir -p $(HOME)/Documents/screenshots
 
-.PHONE: osx
-osx:
-	@./scripts/osx.sh
-
 .PHONY: go-setup
-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/user-dirs.dirs $(HOME)/.config/user-dirs.dirs
+
+.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: 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
@@ -57,4 +102,10 @@ clean-dead:
 	@find ~ -maxdepth 1 -name '.*' -type l -exec test ! -e {} \; -delete
 
 .PHONY: install
-install: $(INSTALLED) $(HOME)/workspace $(HOME)/.ssh/authorized_keys $(HOME)/Documents/screenshots osx
+install: $(HOME)/workspace $(HOME)/.ssh/authorized_keys git tmux emacs
+
+.PHONY: install-linux
+install-linux: redshift desktop
+
+.PHONY: install-darwin
+install-darwin: screenshots
diff --git a/scripts/osx.sh b/scripts/osx.sh
deleted file mode 100755
index 6c92b2c..0000000
--- a/scripts/osx.sh
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/bash
-
-defaults write com.apple.screencapture location ~/Gdrive/screenshots