-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
46 lines (30 loc) · 1.33 KB
/
Makefile
File metadata and controls
46 lines (30 loc) · 1.33 KB
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
.DEFAULT_GOAL := help
# Use force targets instead of listing all the targets we have via .PHONY
# https://www.gnu.org/software/make/manual/html_node/Force-Targets.html#Force-Targets
.FORCE:
# Root directory with Makefile
ROOT_DIR = $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
# Help prelude
define PRELUDE
Usage:
make [target]
endef
##@ Check
check/nix: ## Build Nix config for all users without creating result links
nix build .#homeConfigurations.thrix.activationPackage --no-link
nix build .#homeConfigurations.mvadkert.activationPackage --no-link
check/bats: ## Run bats unit tests
bats tests/
check: check/nix check/bats ## Run all checks
##@ Home Manager
switch: ## Run home-manager switch
home-manager switch
##@ Install
install/pre-commit: ## Install pre-commit hooks
pre-commit install
install/system: ## Install system packages
flatpak-spawn --host rpm-ostree install -A rpm/*.rpm
# See https://www.thapaliya.com/en/writings/well-documented-makefiles/ for details.
reverse = $(if $(1),$(call reverse,$(wordlist 2,$(words $(1)),$(1)))) $(firstword $(1))
help: .FORCE ## Show this help
@awk 'BEGIN {FS = ":.*##"; printf "$(info $(PRELUDE))"} /^[a-zA-Z_/-]+:.*?##/ { printf " \033[36m%-35s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(call reverse, $(MAKEFILE_LIST))