-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
29 lines (24 loc) · 948 Bytes
/
Makefile
File metadata and controls
29 lines (24 loc) · 948 Bytes
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
ALL_PACKAGES := asdf cursor-agent git mutt neovim taskwarrior
CLEAN_PACKAGES := $(ALL_PACKAGES:%=clean_%)
INSTALL_PACKAGES := $(ALL_PACKAGES:%=install_%)
all: $(ALL_PACKAGES)
clean: $(CLEAN_PACKAGES)
install: $(INSTALL_PACKAGES)
.PHONY: all clean install $(ALL_PACKAGES) $(CLEAN_PACKAGES) $(INSTALL_PACKAGES)
# Helper function to check if a command exists
check_command = $(shell command -v $(1) >/dev/null 2>&1 && echo "exists" || echo "missing")
$(ALL_PACKAGES):
@echo "Installing $@ configuration..."
stow --no-folding --target=${HOME} --ignore='Makefile' $@
@if [ -f ./$@/Makefile ]; then \
$(MAKE) -C $@ install; \
fi
$(CLEAN_PACKAGES):
@echo "Removing $(@:clean_%=%) configuration..."
stow --target=${HOME} --delete --ignore='Makefile' $(@:clean_%=%)
$(INSTALL_PACKAGES):
@if [ -f ./$(@:install_%=%)/Makefile ]; then \
$(MAKE) -C $(@:install_%=%) install; \
else \
echo "No installation target for $(@:install_%=%)"; \
fi