-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
150 lines (122 loc) · 4.19 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
##############################################################################
# Project configuration
##############################################################################
# Make configuration
ifeq ($(origin .RECIPEPREFIX), undefined)
$(error GNU Make 4.0 or later required)
endif
.RECIPEPREFIX := >
SHELL := bash
.SHELLFLAGS := -o nounset -o errexit -o pipefail -c
MAKEFLAGS += --no-builtin-rules
MAKEFLAGS += --warn-undefined-variables
.DEFAULT_GOAL := help
##############################################################################
# Functions
define all_files
find . -not -path '*/\.*' -type f
endef
define die
(echo "error: $(1)" ; false)
endef
##############################################################################
# Rules
build-debian: #internal# build Debian image
> docker build \
> --build-arg "TERM=${TERM}" \
> --build-arg "USER_GID=$(shell id -g)" \
> --build-arg "USER_UID=$(shell id -u)" \
> --file debian/$(DOCKER_TAG)/Dockerfile \
> --tag extremais/pkg-debian:$(DOCKER_TAG) \
> .
.PHONY: build-debian
build-debian-stack: #internal# build Debian Stack image
> docker build \
> --no-cache \
> --file debian-stack/$(DOCKER_TAG)/Dockerfile \
> --tag extremais/pkg-debian-stack:$(DOCKER_TAG) \
> .
.PHONY: build-debian-stack
build-fedora: #internal# build Fedora image
> docker build \
> --build-arg "TERM=${TERM}" \
> --build-arg "USER_GID=$(shell id -g)" \
> --build-arg "USER_UID=$(shell id -u)" \
> --file fedora/$(DOCKER_TAG)/Dockerfile \
> --tag extremais/pkg-fedora:$(DOCKER_TAG) \
> .
.PHONY: build-fedora
build-fedora-stack: #internal# build Fedora Stack image
> docker build \
> --no-cache \
> --file fedora-stack/$(DOCKER_TAG)/Dockerfile \
> --tag extremais/pkg-fedora-stack:$(DOCKER_TAG) \
> .
.PHONY: build-fedora-stack
grep: # grep all non-hidden files for expression E
> $(eval E:= "")
> @test -n "$(E)" || $(call die,"usage: make grep E=expression")
> @$(call all_files) | xargs grep -Hn '$(E)' || true
.PHONY: grep
help: # show this help
> @grep '^[a-zA-Z0-9._-]\+:[^#]*# ' $(MAKEFILE_LIST) \
> | sed 's/^\([^:]\+\):[^#]*# \(.*\)/make \1\t\2/' \
> | column -t -s $$'\t'
.PHONY: help
ignored: # list files ignored by git
> @git ls-files . --ignored --exclude-standard --others
.PHONY: ignored
list: # list built/tagged images
> @docker images "extremais/pkg-*"
.PHONY: list
pkg-debian-bookworm: # build extremais/pkg-debian:bookworm
pkg-debian-bookworm: DOCKER_TAG = bookworm
pkg-debian-bookworm: build-debian
.PHONY: pkg-debian-bookworm
pkg-debian-stack-bookworm: # build extremais/pkg-debian-stack:bookworm
pkg-debian-stack-bookworm: DOCKER_TAG = bookworm
pkg-debian-stack-bookworm: build-debian-stack
.PHONY: pkg-debian-stack-bookworm
pkg-debian-buster: # build extremais/pkg-debian:buster
pkg-debian-buster: DOCKER_TAG = buster
pkg-debian-buster: build-debian
.PHONY: pkg-debian-buster
pkg-debian-stack-buster: # build extremais/pkg-debian-stack:buster
pkg-debian-stack-buster: DOCKER_TAG = buster
pkg-debian-stack-buster: build-debian-stack
.PHONY: pkg-debian-stack-buster
pkg-debian-bullseye: # build extremais/pkg-debian:bullseye
pkg-debian-bullseye: DOCKER_TAG = bullseye
pkg-debian-bullseye: build-debian
.PHONY: pkg-debian-bullseye
pkg-debian-stack-bullseye: # build extremais/pkg-debian-stack:bullseye
pkg-debian-stack-bullseye: DOCKER_TAG = bullseye
pkg-debian-stack-bullseye: build-debian-stack
.PHONY: pkg-debian-stack-bullseye
pkg-fedora-41: # build extremais/pkg-fedora:41
pkg-fedora-41: DOCKER_TAG = 41
pkg-fedora-41: build-fedora
.PHONY: pkg-fedora-41
pkg-fedora-stack-41: # build extremais/pkg-fedora-stack:41
pkg-fedora-stack-41: DOCKER_TAG = 41
pkg-fedora-stack-41: build-fedora-stack
.PHONY: pkg-fedora-stack-41
recent: # show N most recently modified files
> $(eval N := "10")
> @find . -not -path '*/\.*' -type f -printf '%T+ %p\n' \
> | sort --reverse \
> | head -n $(N)
.PHONY: recent
shellcheck: # run shellcheck on scripts
> @find . -name '*.sh' | xargs shellcheck
.PHONY: shellcheck
todo: # search for TODO items
> @find . -type f \
> -not -path '*/\.*' \
> -not -path './build/*' \
> -not -path './project/*' \
> -not -path ./Makefile \
> | xargs grep -Hn TODO \
> | grep -v '^Binary file ' \
> || true
.PHONY: todo