1.RECIPEPREFIX := |
2.DEFAULT_GOAL := dry-check
3.ONESHELL:
4.SECONDEXPANSION:
5.PHONY: *
6
7mkfilePath := $(abspath $(lastword $(MAKEFILE_LIST)))
8mkfileDir := $(dir $(mkfilePath))
9mkfileParent := $(abspath $(mkfileDir)/..)
10projectName := $(shell basename $(mkfileDir))
11
12define wildnValue
13$(shell echo $2 | cut -d "-" -f$1-)
14endef
15
16define wildcardValue
17$(call wildnValue,2,$1)
18endef
19
20prepare:
21|nixfmt $(mkfileDir)
22|git -C $(mkfileDir) add .
23
24dry-check-%: prepare
25|nix -L --show-trace build --rebuild --dry-run "$(mkfileDir)#checks.x86_64-linux.$(call wildnValue,3,$@)"
26
27dry-check: dry-check-$$(projectName)
28
29check-%: prepare
30|nix -L --show-trace build --rebuild "$(mkfileDir)#checks.x86_64-linux.$(call wildcardValue,$@)"
31
32check: check-$$(projectName)
33
34build-%: prepare
35|nix -L --show-trace build "$(mkfileDir)#$(call wildcardValue,$@)"
36
37build: build-$$(projectName)