PREFIX ?= ${HOME}
BIN_DIR ?= ${PREFIX}/bin
HERE := ${.PARSEDIR:tA}
.ifndef PLATFORM
PLATFORM != uname -s | tr A-Z a-z
.endif
# Any variable names in FACTS will be printed as part of the help text. This can
# be useful for debugging and just for making it clear where something's going
# to end up before it's run.
FACTS += PLATFORM PREFIX BIN_DIR
SYMLINK ?= ln -snf
VERSION_CONTROL ?= numbered
.export-env VERSION_CONTROL
INSTALL ?= install -b
GMAKE ?= make
help::
all::
# This structure is based on katef's Makefiles: https://github.com/katef/kmkf
# It's not quite as nice because the original structure was refactored to act
# more like it.
#
# Essentially, every subdir listed here has a Makefile that's included, defines
# its own targets, and sets both the HELP and TARGET variables. These are used
# to construct the `help` target. A target to be installed by `all` should add
# its target to the TARGETS variable.
SUBDIRS += dunst
SUBDIRS += git
SUBDIRS += herbstluftwm
SUBDIRS += kitty
SUBDIRS += pact
SUBDIRS += polybar
SUBDIRS += tmux
SUBDIRS += vim
SUBDIRS += zsh
.for dir in ${SUBDIRS}
.include "${dir}/Makefile"
HELP_install-${dir} := ${HELP}
TARGET.${dir} := ${TARGET}
CONF_TARGETS += ${TARGET.${dir}}
.endfor
CONF_TARGETS += init
CONF_TARGETS += submodules
# Init
HELP_init := Initialize the repository
TARGET_init := init
init:: submodules
# Submodules
HELP_submodules := Initialize submodules
TARGET_submodules := submodules
submodules::
git submodule update --init --reference=${HERE:Q}
# All targets for the current platform.
all:: init .WAIT ${TARGETS}
help::
@echo "Install one or more configs from dotfiles using bmake."
@echo ""
@echo "Targets:"
@echo " * help: Print this help text (default)"
@echo " * all: Install all config for the current platform (${PLATFORM:Q})"
.for target in ${CONF_TARGETS:O}
@echo " * ${target:Q}: ${HELP_${target}}"
.endfor
@echo ""
@echo "Facts:"
.for fact in ${FACTS:O}
@echo " ${fact:Q}=${${fact}:Q}"
.endfor