Skip to content

Commit

Permalink
refactors Makefile; attempt to simplify rules.
Browse files Browse the repository at this point in the history
  • Loading branch information
gzagatti committed Oct 18, 2022
1 parent 002fb17 commit f178261
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 44 deletions.
83 changes: 39 additions & 44 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,6 @@ workspace := $(HOME)

.PHONY: all

# NIX
$(workspace)/.config/nixpkgs:
mkdir -p $@

nix/%: $(workspace)/.config/nixpkgs
ln -fs $(dotfiles)/$@ $</$*

nix: $(shell find nix -type f)

# SHELLS
inputrc:
ln -fs $(dotfiles)/shells/inputrc $(workspace)/.inputrc
Expand All @@ -28,65 +19,69 @@ tmux:

shells: bash zsh tmux

# NVIM
$(workspace)/.config/nvim:
mkdir -p $@
# NIX
nixfiles := $(shell find nix -type f -printf "$(workspace)/.config/%P\n")

$(workspace)/.config/nvim/vsnip: $(workspace)/.config/nvim
mkdir -p $@
nix: $(nixfiles)

nvim/%: $(workspace)/.config/nvim/vsnip
ln -fs $(dotfiles)/$@ $(workspace)/.config/$@
$(nixfiles): $(workspace)/.config/%: nix/%
mkdir -p $(dir $@)
ln -fs $(dotfiles)/$^ $@

nvim: $(shell find nvim -type f)
# NVIM
nvimfiles := $(shell find nvim -type f -printf "$(workspace)/.config/%p\n")

nvim: $(nvimfiles)

# EMACS
$(workspace)/.emacs.d:
mkdir -p $@
$(nvimfiles): $(workspace)/.config/%: %
mkdir -p $(dir $@)
ln -fs $(dotfiles)/$^ $@

emacs/%: $(workspace)/.emacs.d
ln -fs $(dotfiles)/$@ $</$*
# EMACS
emacsfiles := $(shell find emacs -type f -printf "$(workspace)/.emacs.d/%p\n")

emacs: $(shell find emacs -type f)
emacs: $(emacsfiles)

$(emacsfiles): $(workspace)/.emacs.d/%: %
mkdir -p $(dir $@)
ln -fs $(dotfiles)/$^ $@

# KITTY
$(workspace)/.config/kitty/themes:
mkdir -p $@
kittyfiles := $(shell find kitty -type f -printf "$(workspace)/.config/%p\n")

kitty/%: $(workspace)/.config/kitty/themes
ln -fs $(dotfiles)/$@ $(workspace)/.config/$@

kitty: $(shell find kitty -type f)
kitty: $(kittyfiles)

$(kittyfiles): $(workspace)/.config/%: %
mkdir -p $(dir $@)
ln -fs $(dotfiles)/$^ $@

# ROFI
$(workspace)/.config/rofi:
mkdir -p $@
rofifiles := $(shell find rofi -type f -printf "$(workspace)/.config/%p\n")

rofi/%: $(workspace)/.config/rofi
ln -fs $(dotfiles)/$@ $</$*
rofi: $(rofifiles)

rofi: $(shell find rofi -type f)
$(rofifiles): $(workspace)/.config/%: %
mkdir -p $(dir $@)
ln -fs $(dotfiles)/$^ $@

# NNN
$(workspace)/.config/nnn/plugins:
mkdir -p $@
nnnfiles := $(shell find nnn -type f -printf "$(workspace)/.config/%p\n")

nnn/%: $(workspace)/.config/nnn/plugins
ln -fs $(dotfiles)/$@ $(workspace)/.config/$@
nnn: $(nnnfiles)

nnn: $(shell find nnn -type f)
$(nnnfiles): $(workspace)/.config/%: %
mkdir -p $(dir $@)
ln -fs $(dotfiles)/$^ $@

# BINARIES
$(workspace)/.local/bin:
mkdir -p $@
binfiles := $(shell find bin -type f -printf "$(workspace)/.local/%p\n")

bin: $(binfiles)

bin/%: $(workspace)/.local/bin
ln -fs $(dotfiles)/$@ $(workspace)/.local/$@
$(binfiles): $(workspace)/.local/%: %
mkdir -p $(dir $@)
ln -fs $(dotfiles)/$^ $@

bin: $(wildcard bin/*)

# SINGLE FILE CONFIGS
alacritty:
Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit f178261

Please sign in to comment.