diff options
author | Kelvin M. Klann <kmk3.code@protonmail.com> | 2024-02-24 04:43:08 -0300 |
---|---|---|
committer | Kelvin M. Klann <kmk3.code@protonmail.com> | 2024-05-29 17:35:35 -0300 |
commit | fb11081becb80d681c2c8ab61125b42b12961314 (patch) | |
tree | 65ec3be0da6000b92dd65ef98b388e5636b8759d /Makefile | |
parent | build: define CC/GAWK if undefined (diff) | |
download | firejail-fb11081becb80d681c2c8ab61125b42b12961314.tar.gz firejail-fb11081becb80d681c2c8ab61125b42b12961314.tar.zst firejail-fb11081becb80d681c2c8ab61125b42b12961314.zip |
build: allow overriding common tools
Tools:
* gzip
* install
* rm
* strip
* tar
For the programs not checked in configure.ac:
From the manual of GNU Autoconf (version 2.71):
> If you use `AC_PROG_INSTALL`, you must include `install-sh` in your
> distribution
So set `install` just in the Makefile. Use `$(RM)` to ensure that `-f`
is always used and to make it easier to spot when `-r` is used.
See commit 93d623fdf ("build: allow overriding certain tools",
2024-02-23) / PR #6222.
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 149 |
1 files changed, 78 insertions, 71 deletions
@@ -2,12 +2,19 @@ | |||
2 | ROOT = . | 2 | ROOT = . |
3 | -include config.mk | 3 | -include config.mk |
4 | 4 | ||
5 | # Default programs | 5 | # Default programs (in configure.ac). |
6 | CC ?= cc | 6 | CC ?= cc |
7 | CODESPELL ?= codespell | 7 | CODESPELL ?= codespell |
8 | CPPCHECK ?= cppcheck | 8 | CPPCHECK ?= cppcheck |
9 | GAWK ?= gawk | 9 | GAWK ?= gawk |
10 | GZIP ?= gzip | ||
10 | SCAN_BUILD ?= scan-build | 11 | SCAN_BUILD ?= scan-build |
12 | STRIP ?= strip | ||
13 | TAR ?= tar | ||
14 | |||
15 | # Default programs (not in configure.ac). | ||
16 | INSTALL ?= install | ||
17 | RM ?= rm -f | ||
11 | 18 | ||
12 | ifneq ($(HAVE_MAN),no) | 19 | ifneq ($(HAVE_MAN),no) |
13 | MAN_TARGET = man | 20 | MAN_TARGET = man |
@@ -71,7 +78,7 @@ $(MYDIRS): | |||
71 | 78 | ||
72 | .PHONY: strip | 79 | .PHONY: strip |
73 | strip: all | 80 | strip: all |
74 | strip $(ALL_ITEMS) | 81 | $(STRIP) $(ALL_ITEMS) |
75 | 82 | ||
76 | .PHONY: filters | 83 | .PHONY: filters |
77 | filters: $(SECCOMP_FILTERS) | 84 | filters: $(SECCOMP_FILTERS) |
@@ -183,115 +190,115 @@ clean: | |||
183 | done | 190 | done |
184 | $(MAKE) -C src/man clean | 191 | $(MAKE) -C src/man clean |
185 | $(MAKE) -C test clean | 192 | $(MAKE) -C test clean |
186 | rm -f $(SECCOMP_FILTERS) | 193 | $(RM) $(SECCOMP_FILTERS) |
187 | rm -f $(SYNTAX_FILES) | 194 | $(RM) $(SYNTAX_FILES) |
188 | rm -fr ./$(TARNAME)-$(VERSION) ./$(TARNAME)-$(VERSION).tar.xz | 195 | $(RM) -r ./$(TARNAME)-$(VERSION) ./$(TARNAME)-$(VERSION).tar.xz |
189 | rm -f ./$(TARNAME)*.deb | 196 | $(RM) ./$(TARNAME)*.deb |
190 | rm -f ./$(TARNAME)*.rpm | 197 | $(RM) ./$(TARNAME)*.rpm |
191 | 198 | ||
192 | .PHONY: distclean | 199 | .PHONY: distclean |
193 | distclean: clean | 200 | distclean: clean |
194 | rm -fr autom4te.cache config.log config.mk config.sh config.status | 201 | $(RM) -r autom4te.cache config.log config.mk config.sh config.status |
195 | 202 | ||
196 | .PHONY: install | 203 | .PHONY: install |
197 | install: all config.mk | 204 | install: all config.mk |
198 | # firejail executable | 205 | # firejail executable |
199 | install -m 0755 -d $(DESTDIR)$(bindir) | 206 | $(INSTALL) -m 0755 -d $(DESTDIR)$(bindir) |
200 | install -m 0755 src/firejail/firejail $(DESTDIR)$(bindir) | 207 | $(INSTALL) -m 0755 src/firejail/firejail $(DESTDIR)$(bindir) |
201 | ifeq ($(HAVE_SUID),-DHAVE_SUID) | 208 | ifeq ($(HAVE_SUID),-DHAVE_SUID) |
202 | chmod u+s $(DESTDIR)$(bindir)/firejail | 209 | chmod u+s $(DESTDIR)$(bindir)/firejail |
203 | endif | 210 | endif |
204 | # firemon executable | 211 | # firemon executable |
205 | install -m 0755 src/firemon/firemon $(DESTDIR)$(bindir) | 212 | $(INSTALL) -m 0755 src/firemon/firemon $(DESTDIR)$(bindir) |
206 | # firecfg executable | 213 | # firecfg executable |
207 | install -m 0755 src/firecfg/firecfg $(DESTDIR)$(bindir) | 214 | $(INSTALL) -m 0755 src/firecfg/firecfg $(DESTDIR)$(bindir) |
208 | # jailcheck executable | 215 | # jailcheck executable |
209 | install -m 0755 src/jailcheck/jailcheck $(DESTDIR)$(bindir) | 216 | $(INSTALL) -m 0755 src/jailcheck/jailcheck $(DESTDIR)$(bindir) |
210 | # libraries and plugins | 217 | # libraries and plugins |
211 | install -m 0755 -d $(DESTDIR)$(libdir)/firejail | 218 | $(INSTALL) -m 0755 -d $(DESTDIR)$(libdir)/firejail |
212 | install -m 0755 -t $(DESTDIR)$(libdir)/firejail src/firecfg/firejail-welcome.sh | 219 | $(INSTALL) -m 0755 -t $(DESTDIR)$(libdir)/firejail src/firecfg/firejail-welcome.sh |
213 | install -m 0644 -t $(DESTDIR)$(libdir)/firejail $(MYLIBS) $(SECCOMP_FILTERS) | 220 | $(INSTALL) -m 0644 -t $(DESTDIR)$(libdir)/firejail $(MYLIBS) $(SECCOMP_FILTERS) |
214 | install -m 0755 -t $(DESTDIR)$(libdir)/firejail $(SBOX_APPS) | 221 | $(INSTALL) -m 0755 -t $(DESTDIR)$(libdir)/firejail $(SBOX_APPS) |
215 | install -m 0755 -t $(DESTDIR)$(libdir)/firejail src/profstats/profstats | 222 | $(INSTALL) -m 0755 -t $(DESTDIR)$(libdir)/firejail src/profstats/profstats |
216 | install -m 0755 -t $(DESTDIR)$(libdir)/firejail src/etc-cleanup/etc-cleanup | 223 | $(INSTALL) -m 0755 -t $(DESTDIR)$(libdir)/firejail src/etc-cleanup/etc-cleanup |
217 | # plugins w/o read permission (non-dumpable) | 224 | # plugins w/o read permission (non-dumpable) |
218 | install -m 0711 -t $(DESTDIR)$(libdir)/firejail $(SBOX_APPS_NON_DUMPABLE) | 225 | $(INSTALL) -m 0711 -t $(DESTDIR)$(libdir)/firejail $(SBOX_APPS_NON_DUMPABLE) |
219 | install -m 0711 -t $(DESTDIR)$(libdir)/firejail src/fshaper/fshaper.sh | 226 | $(INSTALL) -m 0711 -t $(DESTDIR)$(libdir)/firejail src/fshaper/fshaper.sh |
220 | install -m 0644 -t $(DESTDIR)$(libdir)/firejail src/fnettrace/static-ip-map | 227 | $(INSTALL) -m 0644 -t $(DESTDIR)$(libdir)/firejail src/fnettrace/static-ip-map |
221 | ifeq ($(HAVE_CONTRIB_INSTALL),yes) | 228 | ifeq ($(HAVE_CONTRIB_INSTALL),yes) |
222 | # contrib scripts | 229 | # contrib scripts |
223 | install -m 0755 -t $(DESTDIR)$(libdir)/firejail contrib/*.py contrib/*.sh | 230 | $(INSTALL) -m 0755 -t $(DESTDIR)$(libdir)/firejail contrib/*.py contrib/*.sh |
224 | # vim syntax | 231 | # vim syntax |
225 | install -m 0755 -d $(DESTDIR)$(datarootdir)/vim/vimfiles/ftdetect | 232 | $(INSTALL) -m 0755 -d $(DESTDIR)$(datarootdir)/vim/vimfiles/ftdetect |
226 | install -m 0755 -d $(DESTDIR)$(datarootdir)/vim/vimfiles/syntax | 233 | $(INSTALL) -m 0755 -d $(DESTDIR)$(datarootdir)/vim/vimfiles/syntax |
227 | install -m 0644 contrib/vim/ftdetect/firejail.vim $(DESTDIR)$(datarootdir)/vim/vimfiles/ftdetect | 234 | $(INSTALL) -m 0644 contrib/vim/ftdetect/firejail.vim $(DESTDIR)$(datarootdir)/vim/vimfiles/ftdetect |
228 | install -m 0644 contrib/syntax/files/firejail.vim $(DESTDIR)$(datarootdir)/vim/vimfiles/syntax | 235 | $(INSTALL) -m 0644 contrib/syntax/files/firejail.vim $(DESTDIR)$(datarootdir)/vim/vimfiles/syntax |
229 | # gtksourceview language-specs | 236 | # gtksourceview language-specs |
230 | install -m 0755 -d $(DESTDIR)$(datarootdir)/gtksourceview-5/language-specs | 237 | $(INSTALL) -m 0755 -d $(DESTDIR)$(datarootdir)/gtksourceview-5/language-specs |
231 | install -m 0644 contrib/syntax/files/firejail-profile.lang $(DESTDIR)$(datarootdir)/gtksourceview-5/language-specs | 238 | $(INSTALL) -m 0644 contrib/syntax/files/firejail-profile.lang $(DESTDIR)$(datarootdir)/gtksourceview-5/language-specs |
232 | endif | 239 | endif |
233 | # documents | 240 | # documents |
234 | install -m 0755 -d $(DESTDIR)$(docdir) | 241 | $(INSTALL) -m 0755 -d $(DESTDIR)$(docdir) |
235 | install -m 0644 -t $(DESTDIR)$(docdir) COPYING README RELNOTES etc/templates/* | 242 | $(INSTALL) -m 0644 -t $(DESTDIR)$(docdir) COPYING README RELNOTES etc/templates/* |
236 | # profiles and settings | 243 | # profiles and settings |
237 | install -m 0755 -d $(DESTDIR)$(sysconfdir)/firejail | 244 | $(INSTALL) -m 0755 -d $(DESTDIR)$(sysconfdir)/firejail |
238 | install -m 0755 -d $(DESTDIR)$(sysconfdir)/firejail/firecfg.d | 245 | $(INSTALL) -m 0755 -d $(DESTDIR)$(sysconfdir)/firejail/firecfg.d |
239 | install -m 0644 -t $(DESTDIR)$(sysconfdir)/firejail src/firecfg/firecfg.config | 246 | $(INSTALL) -m 0644 -t $(DESTDIR)$(sysconfdir)/firejail src/firecfg/firecfg.config |
240 | install -m 0644 -t $(DESTDIR)$(sysconfdir)/firejail etc/profile-a-l/*.profile etc/profile-m-z/*.profile etc/inc/*.inc etc/net/*.net etc/firejail.config | 247 | $(INSTALL) -m 0644 -t $(DESTDIR)$(sysconfdir)/firejail etc/profile-a-l/*.profile etc/profile-m-z/*.profile etc/inc/*.inc etc/net/*.net etc/firejail.config |
241 | sh -c "if [ ! -f $(DESTDIR)/$(sysconfdir)/firejail/login.users ]; then install -c -m 0644 etc/login.users $(DESTDIR)/$(sysconfdir)/firejail/.; fi;" | 248 | sh -c "if [ ! -f $(DESTDIR)/$(sysconfdir)/firejail/login.users ]; then $(INSTALL) -c -m 0644 etc/login.users $(DESTDIR)/$(sysconfdir)/firejail/.; fi;" |
242 | ifeq ($(HAVE_IDS),-DHAVE_IDS) | 249 | ifeq ($(HAVE_IDS),-DHAVE_IDS) |
243 | install -m 0644 -t $(DESTDIR)$(sysconfdir)/firejail etc/ids.config | 250 | $(INSTALL) -m 0644 -t $(DESTDIR)$(sysconfdir)/firejail etc/ids.config |
244 | endif | 251 | endif |
245 | ifeq ($(BUSYBOX_WORKAROUND),yes) | 252 | ifeq ($(BUSYBOX_WORKAROUND),yes) |
246 | ./mketc.sh $(DESTDIR)$(sysconfdir)/firejail/disable-common.inc | 253 | ./mketc.sh $(DESTDIR)$(sysconfdir)/firejail/disable-common.inc |
247 | endif | 254 | endif |
248 | ifeq ($(HAVE_APPARMOR),-DHAVE_APPARMOR) | 255 | ifeq ($(HAVE_APPARMOR),-DHAVE_APPARMOR) |
249 | # install apparmor profile | 256 | # install apparmor profile |
250 | sh -c "if [ ! -d $(DESTDIR)/$(sysconfdir)/apparmor.d ]; then install -d -m 755 $(DESTDIR)/$(sysconfdir)/apparmor.d; fi;" | 257 | sh -c "if [ ! -d $(DESTDIR)/$(sysconfdir)/apparmor.d ]; then $(INSTALL) -d -m 755 $(DESTDIR)/$(sysconfdir)/apparmor.d; fi;" |
251 | install -m 0644 etc/apparmor/firejail-default $(DESTDIR)$(sysconfdir)/apparmor.d | 258 | $(INSTALL) -m 0644 etc/apparmor/firejail-default $(DESTDIR)$(sysconfdir)/apparmor.d |
252 | # install apparmor profile customization file | 259 | # install apparmor profile customization file |
253 | sh -c "if [ ! -d $(DESTDIR)/$(sysconfdir)/apparmor.d/local ]; then install -d -m 755 $(DESTDIR)/$(sysconfdir)/apparmor.d/local; fi;" | 260 | sh -c "if [ ! -d $(DESTDIR)/$(sysconfdir)/apparmor.d/local ]; then $(INSTALL) -d -m 755 $(DESTDIR)/$(sysconfdir)/apparmor.d/local; fi;" |
254 | sh -c "if [ ! -f $(DESTDIR)/$(sysconfdir)/apparmor.d/local/firejail-default ]; then install -c -m 0644 etc/apparmor/firejail-local $(DESTDIR)/$(sysconfdir)/apparmor.d/local/firejail-default; fi;" | 261 | sh -c "if [ ! -f $(DESTDIR)/$(sysconfdir)/apparmor.d/local/firejail-default ]; then $(INSTALL) -c -m 0644 etc/apparmor/firejail-local $(DESTDIR)/$(sysconfdir)/apparmor.d/local/firejail-default; fi;" |
255 | # install apparmor base abstraction drop-in | 262 | # install apparmor base abstraction drop-in |
256 | sh -c "if [ ! -d $(DESTDIR)/$(sysconfdir)/apparmor.d/abstractions ]; then install -d -m 755 $(DESTDIR)/$(sysconfdir)/apparmor.d/abstractions; fi;" | 263 | sh -c "if [ ! -d $(DESTDIR)/$(sysconfdir)/apparmor.d/abstractions ]; then $(INSTALL) -d -m 755 $(DESTDIR)/$(sysconfdir)/apparmor.d/abstractions; fi;" |
257 | sh -c "if [ ! -d $(DESTDIR)/$(sysconfdir)/apparmor.d/abstractions/base.d ]; then install -d -m 755 $(DESTDIR)/$(sysconfdir)/apparmor.d/abstractions/base.d; fi;" | 264 | sh -c "if [ ! -d $(DESTDIR)/$(sysconfdir)/apparmor.d/abstractions/base.d ]; then $(INSTALL) -d -m 755 $(DESTDIR)/$(sysconfdir)/apparmor.d/abstractions/base.d; fi;" |
258 | install -m 0644 etc/apparmor/firejail-base $(DESTDIR)$(sysconfdir)/apparmor.d/abstractions/base.d | 265 | $(INSTALL) -m 0644 etc/apparmor/firejail-base $(DESTDIR)$(sysconfdir)/apparmor.d/abstractions/base.d |
259 | endif | 266 | endif |
260 | ifneq ($(HAVE_MAN),no) | 267 | ifneq ($(HAVE_MAN),no) |
261 | # man pages | 268 | # man pages |
262 | install -m 0755 -d $(DESTDIR)$(mandir)/man1 $(DESTDIR)$(mandir)/man5 | 269 | $(INSTALL) -m 0755 -d $(DESTDIR)$(mandir)/man1 $(DESTDIR)$(mandir)/man5 |
263 | install -m 0644 $(MANPAGES1_GZ) $(DESTDIR)$(mandir)/man1/ | 270 | $(INSTALL) -m 0644 $(MANPAGES1_GZ) $(DESTDIR)$(mandir)/man1/ |
264 | install -m 0644 $(MANPAGES5_GZ) $(DESTDIR)$(mandir)/man5/ | 271 | $(INSTALL) -m 0644 $(MANPAGES5_GZ) $(DESTDIR)$(mandir)/man5/ |
265 | endif | 272 | endif |
266 | # bash completion | 273 | # bash completion |
267 | install -m 0755 -d $(DESTDIR)$(datarootdir)/bash-completion/completions | 274 | $(INSTALL) -m 0755 -d $(DESTDIR)$(datarootdir)/bash-completion/completions |
268 | install -m 0644 src/bash_completion/firejail.bash_completion $(DESTDIR)$(datarootdir)/bash-completion/completions/firejail | 275 | $(INSTALL) -m 0644 src/bash_completion/firejail.bash_completion $(DESTDIR)$(datarootdir)/bash-completion/completions/firejail |
269 | install -m 0644 src/bash_completion/firemon.bash_completion $(DESTDIR)$(datarootdir)/bash-completion/completions/firemon | 276 | $(INSTALL) -m 0644 src/bash_completion/firemon.bash_completion $(DESTDIR)$(datarootdir)/bash-completion/completions/firemon |
270 | install -m 0644 src/bash_completion/firecfg.bash_completion $(DESTDIR)$(datarootdir)/bash-completion/completions/firecfg | 277 | $(INSTALL) -m 0644 src/bash_completion/firecfg.bash_completion $(DESTDIR)$(datarootdir)/bash-completion/completions/firecfg |
271 | # zsh completion | 278 | # zsh completion |
272 | install -m 0755 -d $(DESTDIR)$(datarootdir)/zsh/site-functions | 279 | $(INSTALL) -m 0755 -d $(DESTDIR)$(datarootdir)/zsh/site-functions |
273 | install -m 0644 src/zsh_completion/_firejail $(DESTDIR)$(datarootdir)/zsh/site-functions/ | 280 | $(INSTALL) -m 0644 src/zsh_completion/_firejail $(DESTDIR)$(datarootdir)/zsh/site-functions/ |
274 | 281 | ||
275 | .PHONY: install-strip | 282 | .PHONY: install-strip |
276 | install-strip: strip install | 283 | install-strip: strip install |
277 | 284 | ||
278 | .PHONY: uninstall | 285 | .PHONY: uninstall |
279 | uninstall: config.mk | 286 | uninstall: config.mk |
280 | rm -f $(DESTDIR)$(bindir)/firejail | 287 | $(RM) $(DESTDIR)$(bindir)/firejail |
281 | rm -f $(DESTDIR)$(bindir)/firemon | 288 | $(RM) $(DESTDIR)$(bindir)/firemon |
282 | rm -f $(DESTDIR)$(bindir)/firecfg | 289 | $(RM) $(DESTDIR)$(bindir)/firecfg |
283 | rm -f $(DESTDIR)$(bindir)/jailcheck | 290 | $(RM) $(DESTDIR)$(bindir)/jailcheck |
284 | rm -fr $(DESTDIR)$(libdir)/firejail | 291 | $(RM) -r $(DESTDIR)$(libdir)/firejail |
285 | rm -fr $(DESTDIR)$(datarootdir)/doc/firejail | 292 | $(RM) -r $(DESTDIR)$(datarootdir)/doc/firejail |
286 | rm -f $(addprefix $(DESTDIR)$(mandir)/man1/,$(notdir $(MANPAGES1_GZ))) | 293 | $(RM) $(addprefix $(DESTDIR)$(mandir)/man1/,$(notdir $(MANPAGES1_GZ))) |
287 | rm -f $(addprefix $(DESTDIR)$(mandir)/man5/,$(notdir $(MANPAGES5_GZ))) | 294 | $(RM) $(addprefix $(DESTDIR)$(mandir)/man5/,$(notdir $(MANPAGES5_GZ))) |
288 | rm -f $(DESTDIR)$(datarootdir)/bash-completion/completions/firejail | 295 | $(RM) $(DESTDIR)$(datarootdir)/bash-completion/completions/firejail |
289 | rm -f $(DESTDIR)$(datarootdir)/bash-completion/completions/firemon | 296 | $(RM) $(DESTDIR)$(datarootdir)/bash-completion/completions/firemon |
290 | rm -f $(DESTDIR)$(datarootdir)/bash-completion/completions/firecfg | 297 | $(RM) $(DESTDIR)$(datarootdir)/bash-completion/completions/firecfg |
291 | rm -f $(DESTDIR)$(datarootdir)/zsh/site-functions/_firejail | 298 | $(RM) $(DESTDIR)$(datarootdir)/zsh/site-functions/_firejail |
292 | rm -f $(DESTDIR)$(datarootdir)/vim/vimfiles/ftdetect/firejail.vim | 299 | $(RM) $(DESTDIR)$(datarootdir)/vim/vimfiles/ftdetect/firejail.vim |
293 | rm -f $(DESTDIR)$(datarootdir)/vim/vimfiles/syntax/firejail.vim | 300 | $(RM) $(DESTDIR)$(datarootdir)/vim/vimfiles/syntax/firejail.vim |
294 | rm -f $(DESTDIR)$(datarootdir)/gtksourceview-5/language-specs/firejail-profile.lang | 301 | $(RM) $(DESTDIR)$(datarootdir)/gtksourceview-5/language-specs/firejail-profile.lang |
295 | @echo "If you want to install a different version of firejail, you might also need to run 'rm -fr $(DESTDIR)$(sysconfdir)/firejail', see #2038." | 302 | @echo "If you want to install a different version of firejail, you might also need to run 'rm -fr $(DESTDIR)$(sysconfdir)/firejail', see #2038." |
296 | 303 | ||
297 | # Note: Keep this list in sync with `paths` in .github/workflows/build.yml. | 304 | # Note: Keep this list in sync with `paths` in .github/workflows/build.yml. |
@@ -336,9 +343,9 @@ dist: clean config.mk | |||
336 | mkdir -p $(TARNAME)-$(VERSION)/test | 343 | mkdir -p $(TARNAME)-$(VERSION)/test |
337 | cp -a $(DISTFILES) $(TARNAME)-$(VERSION) | 344 | cp -a $(DISTFILES) $(TARNAME)-$(VERSION) |
338 | cp -a $(DISTFILES_TEST) $(TARNAME)-$(VERSION)/test | 345 | cp -a $(DISTFILES_TEST) $(TARNAME)-$(VERSION)/test |
339 | rm -rf $(TARNAME)-$(VERSION)/src/tools | 346 | $(RM) -r $(TARNAME)-$(VERSION)/src/tools |
340 | tar -cJvf $(TARNAME)-$(VERSION).tar.xz $(TARNAME)-$(VERSION) | 347 | $(TAR) -cJvf $(TARNAME)-$(VERSION).tar.xz $(TARNAME)-$(VERSION) |
341 | rm -fr $(TARNAME)-$(VERSION) | 348 | $(RM) -r $(TARNAME)-$(VERSION) |
342 | 349 | ||
343 | .PHONY: asc | 350 | .PHONY: asc |
344 | asc: config.sh | 351 | asc: config.sh |