-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
66 lines (51 loc) · 1.7 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# ifndef XDG_CONFIG_HOME
# $(error XDG_CONFIG_HOME is undefined)
# endif
#
# ifndef XDG_DATA_HOME
# $(error XDG_DATA_HOME is undefined) is undefined)
# endif
# local_config_dir := $(XDG_CONFIG_HOME)
# local_data_dir := $(XDG_DATA_HOME)
# local_bin_dir ?= $(HOME)/.local/bin
# local_home_dir ?= $(HOME)
local_config_dir := test/config
local_data_dir := test/data
local_bin_dir := test/bin
local_home_dir := test/home
REPO_DIRS := config data bin home
# Program-specific
# $(local_config_dir)/%: config/% | $(local_config_dir)
# ln -i -s $(abspath $<) $(abspath $(dir $@))
#
# $(local_data_dir)/%: data/% | $(local_data_dir)
# ln -s $(abspath $<) $(abspath $(dir $@))
#
# $(local_home_dir)/%: home/% | $(local_home_dir)
# ln -s $(abspath $<) $(abspath $(dir $@))
#
# $(local_bin_dir)/%: bin/% | $(local_bin_dir)
# ln -s $(abspath $<) $(abspath $(dir $@))
# Whole source dir: config|data|bin|home
config_dirs := $(notdir $(wildcard config/*))
config_targets := $(addprefix $(local_config_dir)/,$(config_dirs))
config: $(config_targets)
data_dirs := $(notdir $(wildcard data/*))
data_targets := $(addprefix $(local_data_dir)/,$(data_dirs))
data: $(data_targets)
bin_files := $(notdir $(wildcard bin/*))
bin_targets := $(addprefix $(local_bin_dir)/,$(bin_files))
bin: $(bin_targets)
home_files := $(notdir $(wildcard home/*))
home_targets := $(addprefix $(local_home_dir)/,$(home_files))
home: $(home_targets)
all: $(REPO_DIRS)
.PHONY: all $(REPO_DIRS)
DOTS := $(config_targets) $(data_targets) $(home_targets) $(bin_targets)
$(filter %/nvim, $(DOTS)):
echo $*
# Remove program files from system
clean-config:
find $(local_config_dir) -type l -lname '$(shell pwd)*' -exec rm -v {} +
# TODO: individual cleans?
.PHONY: clean