From 011d84b462a78703b9b939cb5e48b4cc75ebe015 Mon Sep 17 00:00:00 2001 From: "Kelvin M. Klann" Date: Tue, 10 May 2022 15:47:44 -0300 Subject: [PATCH 1/3] build: reduce autoconf input files from 32 to 2 Configure summary: autoconf essentially only parses configure.ac and generates the configure script (that is, the "./configure" shell script). The latter is what actually checks what is available on the system and internally sets the value of the output variables. It then, for every filename foo in AC_CONFIG_FILES (and for every output variable name BAR in AC_SUBST), reads foo.in, replaces every occurrence of `@BAR@` with the value of the shell variable `$BAR` and generates the file foo from the result. After this, configure is finished and `make` could be executed to start the build. Now that (as of #5140) all output variables are only defined on config.mk.in and on config.sh.in, there is no need to generate any makefile nor any other mkfile or shell script at configure time. So rename every "Makefile.in" to "Makefile", mkdeb.sh.in to mkdeb.sh, src/common.mk.in to src/common.mk and leave just config.mk and config.sh as the files to be generated at configure time. This allows editing and committing all makefiles directly, without potentially having to run ./configure in between. Commands used to rename the makefiles: $ git ls-files -z -- '*Makefile.in' | xargs -0 -I '{}' sh -c \ "git mv '{}' \"\$(dirname '{}')/Makefile\"" Additionally, from my (rudimentary) testing, this commit reduces the time it takes to run ./configure by about 20~25% compared to commit 72ece92ea ("Transmission fixes: drop private-lib (#5213)", 2022-06-22). Environment: dash 0.5.11.5-1, gcc 12.1.0-2, Artix Linux, ext4 on an HDD. Commands used for benchmarking each commit: $ : >time_configure && ./configure && make distclean && for i in $(seq 1 10); do { time -p ./configure; } 2>>time_configure; done $ grep real time_configure | awk '{ total += $2 } END { print total/NR }' --- .gitignore | 3 -- Makefile.in => Makefile | 10 ++--- configure | 39 +------------------ configure.ac | 35 +---------------- contrib/fj-mkdeb.py | 8 ++-- mkdeb.sh.in => mkdeb.sh | 0 src/bash_completion/{Makefile.in => Makefile} | 1 - src/{common.mk.in => common.mk} | 0 src/fbuilder/{Makefile.in => Makefile} | 1 - src/fcopy/{Makefile.in => Makefile} | 1 - src/fids/{Makefile.in => Makefile} | 1 - src/firecfg/{Makefile.in => Makefile} | 1 - src/firejail/{Makefile.in => Makefile} | 1 - src/firemon/{Makefile.in => Makefile} | 1 - src/fldd/{Makefile.in => Makefile} | 1 - src/fnet/{Makefile.in => Makefile} | 1 - src/fnetfilter/{Makefile.in => Makefile} | 1 - src/fnettrace-dns/{Makefile.in => Makefile} | 1 - src/fnettrace-sni/{Makefile.in => Makefile} | 1 - src/fnettrace/{Makefile.in => Makefile} | 1 - src/fsec-optimize/{Makefile.in => Makefile} | 1 - src/fsec-print/{Makefile.in => Makefile} | 1 - src/fseccomp/{Makefile.in => Makefile} | 1 - src/ftee/{Makefile.in => Makefile} | 1 - src/fzenity/{Makefile.in => Makefile} | 1 - src/jailcheck/{Makefile.in => Makefile} | 1 - src/lib/{Makefile.in => Makefile} | 1 - .../{Makefile.in => Makefile} | 1 - src/libtrace/{Makefile.in => Makefile} | 1 - src/libtracelog/{Makefile.in => Makefile} | 1 - src/man/{Makefile.in => Makefile} | 1 - src/profstats/{Makefile.in => Makefile} | 1 - src/zsh_completion/{Makefile.in => Makefile} | 1 - test/{Makefile.in => Makefile} | 1 - 34 files changed, 10 insertions(+), 112 deletions(-) rename Makefile.in => Makefile (96%) rename mkdeb.sh.in => mkdeb.sh (100%) rename src/bash_completion/{Makefile.in => Makefile} (95%) rename src/{common.mk.in => common.mk} (100%) rename src/fbuilder/{Makefile.in => Makefile} (95%) rename src/fcopy/{Makefile.in => Makefile} (95%) rename src/fids/{Makefile.in => Makefile} (96%) rename src/firecfg/{Makefile.in => Makefile} (96%) rename src/firejail/{Makefile.in => Makefile} (97%) rename src/firemon/{Makefile.in => Makefile} (96%) rename src/fldd/{Makefile.in => Makefile} (96%) rename src/fnet/{Makefile.in => Makefile} (96%) rename src/fnetfilter/{Makefile.in => Makefile} (96%) rename src/fnettrace-dns/{Makefile.in => Makefile} (95%) rename src/fnettrace-sni/{Makefile.in => Makefile} (95%) rename src/fnettrace/{Makefile.in => Makefile} (95%) rename src/fsec-optimize/{Makefile.in => Makefile} (96%) rename src/fsec-print/{Makefile.in => Makefile} (96%) rename src/fseccomp/{Makefile.in => Makefile} (96%) rename src/ftee/{Makefile.in => Makefile} (95%) rename src/fzenity/{Makefile.in => Makefile} (95%) rename src/jailcheck/{Makefile.in => Makefile} (95%) rename src/lib/{Makefile.in => Makefile} (93%) rename src/libpostexecseccomp/{Makefile.in => Makefile} (97%) rename src/libtrace/{Makefile.in => Makefile} (97%) rename src/libtracelog/{Makefile.in => Makefile} (97%) rename src/man/{Makefile.in => Makefile} (94%) rename src/profstats/{Makefile.in => Makefile} (95%) rename src/zsh_completion/{Makefile.in => Makefile} (94%) rename test/{Makefile.in => Makefile} (94%) diff --git a/.gitignore b/.gitignore index 70dba09b292..66daccf5d35 100644 --- a/.gitignore +++ b/.gitignore @@ -10,7 +10,6 @@ .directory *.man .vscode -Makefile autom4te.cache/ config.log config.mk @@ -25,7 +24,6 @@ firejail.1 firemon.1 firecfg.1 jailcheck.1 -mkdeb.sh src/fnettrace-dns/fnettrace-dns src/fnettrace-sni/fnettrace-sni src/firejail/firejail @@ -57,7 +55,6 @@ seccomp.64 seccomp.block_secondary seccomp.mdwx seccomp.mdwx.32 -src/common.mk aclocal.m4 __pycache__ *.pyc diff --git a/Makefile.in b/Makefile similarity index 96% rename from Makefile.in rename to Makefile index 4d99836721a..c235aff7c0f 100644 --- a/Makefile.in +++ b/Makefile @@ -85,7 +85,7 @@ distclean: clean $(MAKE) -C $$dir distclean; \ done $(MAKE) -C test distclean - rm -fr Makefile autom4te.cache config.log config.mk config.sh config.status src/common.mk mkdeb.sh + rm -fr autom4te.cache config.log config.mk config.sh config.status realinstall: # firejail executable @@ -189,7 +189,7 @@ uninstall: DISTFILES = \ COPYING \ -Makefile.in \ +Makefile \ README \ RELNOTES \ config.mk.in \ @@ -200,20 +200,18 @@ contrib \ etc \ install.sh \ m4 \ -mkdeb.sh.in \ +mkdeb.sh \ mketc.sh \ mkman.sh \ platform \ src -DISTFILES_TEST = test/Makefile.in test/apps test/apps-x11 test/apps-x11-xorg test/root test/private-lib test/fnetfilter test/fcopy test/environment test/profiles test/utils test/compile test/filters test/network test/fs test/sysutils test/chroot +DISTFILES_TEST = test/Makefile test/apps test/apps-x11 test/apps-x11-xorg test/root test/private-lib test/fnetfilter test/fcopy test/environment test/profiles test/utils test/compile test/filters test/network test/fs test/sysutils test/chroot dist: mv config.sh config.sh.old mv config.status config.status.old - mv mkdeb.sh mkdeb.sh.old make distclean - mv mkdeb.sh.old mkdeb.sh mv config.status.old config.status mv config.sh.old config.sh rm -fr $(NAME)-$(VERSION) $(NAME)-$(VERSION).tar.xz diff --git a/configure b/configure index a2d2e753096..f3bd771691f 100755 --- a/configure +++ b/configure @@ -4085,9 +4085,7 @@ if test "$prefix" = /usr; then test "$sysconfdir" = '${prefix}/etc' && sysconfdir="/etc" fi -ac_config_files="$ac_config_files mkdeb.sh" - -ac_config_files="$ac_config_files Makefile config.mk config.sh src/bash_completion/Makefile src/common.mk src/fbuilder/Makefile src/fcopy/Makefile src/fids/Makefile src/firecfg/Makefile src/firejail/Makefile src/firemon/Makefile src/fldd/Makefile src/fnet/Makefile src/fnetfilter/Makefile src/fnettrace-dns/Makefile src/fnettrace-sni/Makefile src/fnettrace/Makefile src/fsec-optimize/Makefile src/fsec-print/Makefile src/fseccomp/Makefile src/ftee/Makefile src/fzenity/Makefile src/jailcheck/Makefile src/lib/Makefile src/libpostexecseccomp/Makefile src/libtrace/Makefile src/libtracelog/Makefile src/man/Makefile src/profstats/Makefile src/zsh_completion/Makefile test/Makefile" +ac_config_files="$ac_config_files config.mk config.sh" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure @@ -4795,38 +4793,8 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 for ac_config_target in $ac_config_targets do case $ac_config_target in - "mkdeb.sh") CONFIG_FILES="$CONFIG_FILES mkdeb.sh" ;; - "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "config.mk") CONFIG_FILES="$CONFIG_FILES config.mk" ;; "config.sh") CONFIG_FILES="$CONFIG_FILES config.sh" ;; - "src/bash_completion/Makefile") CONFIG_FILES="$CONFIG_FILES src/bash_completion/Makefile" ;; - "src/common.mk") CONFIG_FILES="$CONFIG_FILES src/common.mk" ;; - "src/fbuilder/Makefile") CONFIG_FILES="$CONFIG_FILES src/fbuilder/Makefile" ;; - "src/fcopy/Makefile") CONFIG_FILES="$CONFIG_FILES src/fcopy/Makefile" ;; - "src/fids/Makefile") CONFIG_FILES="$CONFIG_FILES src/fids/Makefile" ;; - "src/firecfg/Makefile") CONFIG_FILES="$CONFIG_FILES src/firecfg/Makefile" ;; - "src/firejail/Makefile") CONFIG_FILES="$CONFIG_FILES src/firejail/Makefile" ;; - "src/firemon/Makefile") CONFIG_FILES="$CONFIG_FILES src/firemon/Makefile" ;; - "src/fldd/Makefile") CONFIG_FILES="$CONFIG_FILES src/fldd/Makefile" ;; - "src/fnet/Makefile") CONFIG_FILES="$CONFIG_FILES src/fnet/Makefile" ;; - "src/fnetfilter/Makefile") CONFIG_FILES="$CONFIG_FILES src/fnetfilter/Makefile" ;; - "src/fnettrace-dns/Makefile") CONFIG_FILES="$CONFIG_FILES src/fnettrace-dns/Makefile" ;; - "src/fnettrace-sni/Makefile") CONFIG_FILES="$CONFIG_FILES src/fnettrace-sni/Makefile" ;; - "src/fnettrace/Makefile") CONFIG_FILES="$CONFIG_FILES src/fnettrace/Makefile" ;; - "src/fsec-optimize/Makefile") CONFIG_FILES="$CONFIG_FILES src/fsec-optimize/Makefile" ;; - "src/fsec-print/Makefile") CONFIG_FILES="$CONFIG_FILES src/fsec-print/Makefile" ;; - "src/fseccomp/Makefile") CONFIG_FILES="$CONFIG_FILES src/fseccomp/Makefile" ;; - "src/ftee/Makefile") CONFIG_FILES="$CONFIG_FILES src/ftee/Makefile" ;; - "src/fzenity/Makefile") CONFIG_FILES="$CONFIG_FILES src/fzenity/Makefile" ;; - "src/jailcheck/Makefile") CONFIG_FILES="$CONFIG_FILES src/jailcheck/Makefile" ;; - "src/lib/Makefile") CONFIG_FILES="$CONFIG_FILES src/lib/Makefile" ;; - "src/libpostexecseccomp/Makefile") CONFIG_FILES="$CONFIG_FILES src/libpostexecseccomp/Makefile" ;; - "src/libtrace/Makefile") CONFIG_FILES="$CONFIG_FILES src/libtrace/Makefile" ;; - "src/libtracelog/Makefile") CONFIG_FILES="$CONFIG_FILES src/libtracelog/Makefile" ;; - "src/man/Makefile") CONFIG_FILES="$CONFIG_FILES src/man/Makefile" ;; - "src/profstats/Makefile") CONFIG_FILES="$CONFIG_FILES src/profstats/Makefile" ;; - "src/zsh_completion/Makefile") CONFIG_FILES="$CONFIG_FILES src/zsh_completion/Makefile" ;; - "test/Makefile") CONFIG_FILES="$CONFIG_FILES test/Makefile" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac @@ -5240,11 +5208,6 @@ which seems to be undefined. Please make sure it is defined" >&2;} esac - - case $ac_file$ac_mode in - "mkdeb.sh":F) chmod +x mkdeb.sh ;; - - esac done # for ac_tag diff --git a/configure.ac b/configure.ac index 53de0eb1dbc..8a488ff4301 100644 --- a/configure.ac +++ b/configure.ac @@ -282,40 +282,7 @@ if test "$prefix" = /usr; then test "$sysconfdir" = '${prefix}/etc' && sysconfdir="/etc" fi -AC_CONFIG_FILES([mkdeb.sh], [chmod +x mkdeb.sh]) -AC_CONFIG_FILES([ -Makefile -config.mk -config.sh -src/bash_completion/Makefile -src/common.mk -src/fbuilder/Makefile -src/fcopy/Makefile -src/fids/Makefile -src/firecfg/Makefile -src/firejail/Makefile -src/firemon/Makefile -src/fldd/Makefile -src/fnet/Makefile -src/fnetfilter/Makefile -src/fnettrace-dns/Makefile -src/fnettrace-sni/Makefile -src/fnettrace/Makefile -src/fsec-optimize/Makefile -src/fsec-print/Makefile -src/fseccomp/Makefile -src/ftee/Makefile -src/fzenity/Makefile -src/jailcheck/Makefile -src/lib/Makefile -src/libpostexecseccomp/Makefile -src/libtrace/Makefile -src/libtracelog/Makefile -src/man/Makefile -src/profstats/Makefile -src/zsh_completion/Makefile -test/Makefile -]) +AC_CONFIG_FILES([config.mk config.sh]) AC_OUTPUT cat < Date: Thu, 23 Jun 2022 02:51:52 -0300 Subject: [PATCH 2/3] makefiles: stop failing when config.mk does not exist This allows running `make clean` and `make distclean` (and possibly others) without having to run ./configure beforehand. Note that some packaging-related targets still depend on the existence of generated files. For example: * dist: config.mk * deb: config.sh Commands used to search and replace: $ git grep -Elz 'include *([^ ]*/)?config.mk' | xargs -0 -I '{}' \ sh -c "printf '%s\n' \ \"\$(sed -E 's|^include *(([^ ]*/)?config.mk)|-include \1|' '{}')\" >'{}'" Relates to #5140. --- Makefile | 2 +- src/bash_completion/Makefile | 2 +- src/common.mk | 2 +- src/libpostexecseccomp/Makefile | 2 +- src/libtrace/Makefile | 2 +- src/libtracelog/Makefile | 2 +- src/man/Makefile | 2 +- src/zsh_completion/Makefile | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index c235aff7c0f..5d14ce4679e 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -include config.mk +-include config.mk ifneq ($(HAVE_MAN),no) MAN_TARGET = man diff --git a/src/bash_completion/Makefile b/src/bash_completion/Makefile index 9157c92253c..16c4a31ee4c 100644 --- a/src/bash_completion/Makefile +++ b/src/bash_completion/Makefile @@ -2,7 +2,7 @@ all: firejail.bash_completion ROOT = ../.. -include $(ROOT)/config.mk +-include $(ROOT)/config.mk firejail.bash_completion: firejail.bash_completion.in gawk -f ../man/preproc.awk -- $(MANFLAGS) < $< > $@.tmp diff --git a/src/common.mk b/src/common.mk index 2b87c33f0ba..07b5e373ded 100644 --- a/src/common.mk +++ b/src/common.mk @@ -2,7 +2,7 @@ # # Note: "ROOT" must be defined before including this file. -include $(ROOT)/config.mk +-include $(ROOT)/config.mk H_FILE_LIST = $(sort $(wildcard *.h)) C_FILE_LIST = $(sort $(wildcard *.c)) diff --git a/src/libpostexecseccomp/Makefile b/src/libpostexecseccomp/Makefile index 2f108d8b9e0..14e0cdb1d19 100644 --- a/src/libpostexecseccomp/Makefile +++ b/src/libpostexecseccomp/Makefile @@ -1,5 +1,5 @@ ROOT = ../.. -include $(ROOT)/config.mk +-include $(ROOT)/config.mk H_FILE_LIST = $(sort $(wildcard *.h)) C_FILE_LIST = $(sort $(wildcard *.c)) diff --git a/src/libtrace/Makefile b/src/libtrace/Makefile index 11c75136dc1..46a8f97c2f0 100644 --- a/src/libtrace/Makefile +++ b/src/libtrace/Makefile @@ -1,5 +1,5 @@ ROOT = ../.. -include $(ROOT)/config.mk +-include $(ROOT)/config.mk H_FILE_LIST = $(sort $(wildcard *.h)) C_FILE_LIST = $(sort $(wildcard *.c)) diff --git a/src/libtracelog/Makefile b/src/libtracelog/Makefile index d09a8aa1cca..1a3ab1ba5a0 100644 --- a/src/libtracelog/Makefile +++ b/src/libtracelog/Makefile @@ -1,5 +1,5 @@ ROOT = ../.. -include $(ROOT)/config.mk +-include $(ROOT)/config.mk H_FILE_LIST = $(sort $(wildcard *.h)) C_FILE_LIST = $(sort $(wildcard *.c)) diff --git a/src/man/Makefile b/src/man/Makefile index c83a4b7ebd4..b786e1ca99c 100644 --- a/src/man/Makefile +++ b/src/man/Makefile @@ -2,7 +2,7 @@ all: firecfg.man firejail.man firejail-login.man firejail-users.man firejail-profile.man firemon.man jailcheck.man ROOT = ../.. -include $(ROOT)/config.mk +-include $(ROOT)/config.mk %.man: %.txt gawk -f ./preproc.awk -- $(MANFLAGS) < $< > $@ diff --git a/src/zsh_completion/Makefile b/src/zsh_completion/Makefile index 303057b0b46..bec0150495a 100644 --- a/src/zsh_completion/Makefile +++ b/src/zsh_completion/Makefile @@ -2,7 +2,7 @@ all: _firejail ROOT = ../.. -include $(ROOT)/config.mk +-include $(ROOT)/config.mk _firejail: _firejail.in gawk -f ../man/preproc.awk -- $(MANFLAGS) < $< > $@.tmp From e21637ca82199d9b659f34d71674090e45fc89db Mon Sep 17 00:00:00 2001 From: "Kelvin M. Klann" Date: Thu, 23 Jun 2022 07:35:19 -0300 Subject: [PATCH 3/3] makefiles: add generated files as dependencies With the previous commit ("makefiles: stop failing when config.mk does not exist", 2022-06-23), make will not immediately fail when trying to build a target without having the proper compile-time flags (which are defined on common.mk). For example, when running the command below: make distclean && make It will throw an error only after (mis-)compiling multiple objects. So add a dependency on config.mk on every target that uses output variables (such as @NAME@ / $(NAME)) on its recipe. And add a dependency on config.sh on targets that call shell scripts that use output variables (such as @NAME@ / $NAME). Also, add a recipe for config.mk / config.sh telling to run ./configure, to make it a bit more obvious just in case. With this commit, make will abort earlier, by detecting that the config.mk / config.sh dependency does not exist. This happens before trying to execute the recipe. This also makes the dependencies more accurate, since if config.mk (which defines some CFLAGS) is changed, the CFLAGS may also have changed, so a target that uses CFLAGS should probably be considered out of date in this case anyway. Relates to #5140. --- Makefile | 23 ++++++++++++++--------- src/bash_completion/Makefile | 2 +- src/fbuilder/Makefile | 4 ++-- src/fcopy/Makefile | 4 ++-- src/fids/Makefile | 4 ++-- src/firecfg/Makefile | 4 ++-- src/firejail/Makefile | 4 ++-- src/firemon/Makefile | 4 ++-- src/fldd/Makefile | 4 ++-- src/fnet/Makefile | 4 ++-- src/fnetfilter/Makefile | 4 ++-- src/fnettrace-dns/Makefile | 4 ++-- src/fnettrace-sni/Makefile | 4 ++-- src/fnettrace/Makefile | 4 ++-- src/fsec-optimize/Makefile | 4 ++-- src/fsec-print/Makefile | 4 ++-- src/fseccomp/Makefile | 4 ++-- src/ftee/Makefile | 4 ++-- src/fzenity/Makefile | 4 ++-- src/jailcheck/Makefile | 4 ++-- src/lib/Makefile | 2 +- src/libpostexecseccomp/Makefile | 4 ++-- src/libtrace/Makefile | 4 ++-- src/libtracelog/Makefile | 4 ++-- src/man/Makefile | 2 +- src/profstats/Makefile | 4 ++-- src/zsh_completion/Makefile | 2 +- 27 files changed, 62 insertions(+), 57 deletions(-) diff --git a/Makefile b/Makefile index 5d14ce4679e..11e19ec37ee 100644 --- a/Makefile +++ b/Makefile @@ -21,6 +21,10 @@ MANPAGES = firejail.1 firemon.1 firecfg.1 firejail-profile.5 firejail-login.5 fi SECCOMP_FILTERS = seccomp seccomp.debug seccomp.32 seccomp.block_secondary seccomp.mdwx seccomp.mdwx.32 ALL_ITEMS = $(APPS) $(SBOX_APPS) $(SBOX_APPS_NON_DUMPABLE) $(MYLIBS) +config.mk config.sh: + printf 'run ./configure to generate %s\n' "$@" >&2 + false + .PHONY: all_items $(ALL_ITEMS) all_items: $(ALL_ITEMS) $(ALL_ITEMS): $(MYDIRS) @@ -31,7 +35,7 @@ mydirs: $(MYDIRS) $(MYDIRS): $(MAKE) -C $@ -$(MANPAGES): src/man +$(MANPAGES): src/man config.mk ./mkman.sh $(VERSION) src/man/$(basename $@).man $@ man: $(MANPAGES) @@ -87,7 +91,7 @@ distclean: clean $(MAKE) -C test distclean rm -fr autom4te.cache config.log config.mk config.sh config.status -realinstall: +realinstall: config.mk # firejail executable install -m 0755 -d $(DESTDIR)$(bindir) install -m 0755 src/firejail/firejail $(DESTDIR)$(bindir) @@ -171,7 +175,7 @@ install-strip: all strip $(ALL_ITEMS) $(MAKE) realinstall -uninstall: +uninstall: config.mk rm -f $(DESTDIR)$(bindir)/firejail rm -f $(DESTDIR)$(bindir)/firemon rm -f $(DESTDIR)$(bindir)/firecfg @@ -208,7 +212,7 @@ src DISTFILES_TEST = test/Makefile test/apps test/apps-x11 test/apps-x11-xorg test/root test/private-lib test/fnetfilter test/fcopy test/environment test/profiles test/utils test/compile test/filters test/network test/fs test/sysutils test/chroot -dist: +dist: config.mk mv config.sh config.sh.old mv config.status config.status.old make distclean @@ -223,19 +227,20 @@ dist: tar -cJvf $(NAME)-$(VERSION).tar.xz $(NAME)-$(VERSION) rm -fr $(NAME)-$(VERSION) -asc:; ./mkasc.sh $(VERSION) +asc: config.mk + ./mkasc.sh $(VERSION) -deb: dist +deb: dist config.sh ./mkdeb.sh -deb-apparmor: dist +deb-apparmor: dist config.sh ./mkdeb.sh -apparmor --enable-apparmor -test-compile: dist +test-compile: dist config.mk cd test/compile; ./compile.sh $(NAME)-$(VERSION) .PHONY: rpms -rpms: src/man +rpms: src/man config.mk ./platform/rpm/mkrpm.sh $(NAME) $(VERSION) extras: all diff --git a/src/bash_completion/Makefile b/src/bash_completion/Makefile index 16c4a31ee4c..e787a7b921f 100644 --- a/src/bash_completion/Makefile +++ b/src/bash_completion/Makefile @@ -4,7 +4,7 @@ all: firejail.bash_completion ROOT = ../.. -include $(ROOT)/config.mk -firejail.bash_completion: firejail.bash_completion.in +firejail.bash_completion: firejail.bash_completion.in $(ROOT)/config.mk gawk -f ../man/preproc.awk -- $(MANFLAGS) < $< > $@.tmp sed "s|_SYSCONFDIR_|$(sysconfdir)|" < $@.tmp > $@ rm $@.tmp diff --git a/src/fbuilder/Makefile b/src/fbuilder/Makefile index b769deac962..da0403c6ebd 100644 --- a/src/fbuilder/Makefile +++ b/src/fbuilder/Makefile @@ -4,10 +4,10 @@ all: fbuilder ROOT = ../.. include $(ROOT)/src/common.mk -%.o : %.c $(H_FILE_LIST) ../include/common.h ../include/syscall.h +%.o : %.c $(H_FILE_LIST) ../include/common.h ../include/syscall.h $(ROOT)/config.mk $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(INCLUDE) -c $< -o $@ -fbuilder: $(OBJS) +fbuilder: $(OBJS) $(ROOT)/config.mk $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS) $(EXTRA_LDFLAGS) .PHONY: clean diff --git a/src/fcopy/Makefile b/src/fcopy/Makefile index 8016158780a..ae128df9b46 100644 --- a/src/fcopy/Makefile +++ b/src/fcopy/Makefile @@ -4,10 +4,10 @@ all: fcopy ROOT = ../.. include $(ROOT)/src/common.mk -%.o : %.c $(H_FILE_LIST) ../include/common.h ../include/syscall.h +%.o : %.c $(H_FILE_LIST) ../include/common.h ../include/syscall.h $(ROOT)/config.mk $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(INCLUDE) -c $< -o $@ -fcopy: $(OBJS) ../lib/common.o +fcopy: $(OBJS) ../lib/common.o $(ROOT)/config.mk $(CC) $(LDFLAGS) -o $@ $(OBJS) ../lib/common.o $(LIBS) $(EXTRA_LDFLAGS) .PHONY: clean diff --git a/src/fids/Makefile b/src/fids/Makefile index eed6e44ea7f..e57c56b5bbf 100644 --- a/src/fids/Makefile +++ b/src/fids/Makefile @@ -4,11 +4,11 @@ all: fids ROOT = ../.. include $(ROOT)/src/common.mk -%.o : %.c $(H_FILE_LIST) ../include/common.h +%.o : %.c $(H_FILE_LIST) ../include/common.h $(ROOT)/config.mk $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(INCLUDE) -c $< -o $@ #fseccomp: $(OBJS) ../lib/common.o ../lib/errno.o ../lib/syscall.o -fids: $(OBJS) +fids: $(OBJS) $(ROOT)/config.mk $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS) $(EXTRA_LDFLAGS) .PHONY: clean diff --git a/src/firecfg/Makefile b/src/firecfg/Makefile index c06bb5338a7..3b0daed7111 100644 --- a/src/firecfg/Makefile +++ b/src/firecfg/Makefile @@ -4,10 +4,10 @@ all: firecfg ROOT = ../.. include $(ROOT)/src/common.mk -%.o : %.c $(H_FILE_LIST) ../include/common.h ../include/euid_common.h ../include/libnetlink.h ../include/firejail_user.h ../include/pid.h +%.o : %.c $(H_FILE_LIST) ../include/common.h ../include/euid_common.h ../include/libnetlink.h ../include/firejail_user.h ../include/pid.h $(ROOT)/config.mk $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(INCLUDE) -c $< -o $@ -firecfg: $(OBJS) ../lib/common.o ../lib/firejail_user.o +firecfg: $(OBJS) ../lib/common.o ../lib/firejail_user.o $(ROOT)/config.mk $(CC) $(LDFLAGS) -o $@ $(OBJS) ../lib/common.o ../lib/firejail_user.o $(LIBS) $(EXTRA_LDFLAGS) .PHONY: clean diff --git a/src/firejail/Makefile b/src/firejail/Makefile index ffe978957cf..23444107f4b 100644 --- a/src/firejail/Makefile +++ b/src/firejail/Makefile @@ -4,10 +4,10 @@ all: firejail ROOT = ../.. include $(ROOT)/src/common.mk -%.o : %.c $(H_FILE_LIST) ../include/rundefs.h ../include/common.h ../include/ldd_utils.h ../include/euid_common.h ../include/pid.h ../include/seccomp.h ../include/syscall_i386.h ../include/syscall_x86_64.h ../include/firejail_user.h +%.o : %.c $(H_FILE_LIST) ../include/rundefs.h ../include/common.h ../include/ldd_utils.h ../include/euid_common.h ../include/pid.h ../include/seccomp.h ../include/syscall_i386.h ../include/syscall_x86_64.h ../include/firejail_user.h $(ROOT)/config.mk $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(INCLUDE) -c $< -o $@ -firejail: $(OBJS) ../lib/libnetlink.o ../lib/common.o ../lib/ldd_utils.o ../lib/firejail_user.o ../lib/errno.o ../lib/syscall.o +firejail: $(OBJS) ../lib/libnetlink.o ../lib/common.o ../lib/ldd_utils.o ../lib/firejail_user.o ../lib/errno.o ../lib/syscall.o $(ROOT)/config.mk $(CC) $(LDFLAGS) -o $@ $(OBJS) ../lib/common.o ../lib/ldd_utils.o ../lib/firejail_user.o ../lib/errno.o ../lib/syscall.o $(LIBS) $(EXTRA_LDFLAGS) .PHONY: clean diff --git a/src/firemon/Makefile b/src/firemon/Makefile index 45203673b56..b2d2f4d1471 100644 --- a/src/firemon/Makefile +++ b/src/firemon/Makefile @@ -4,10 +4,10 @@ all: firemon ROOT = ../.. include $(ROOT)/src/common.mk -%.o : %.c $(H_FILE_LIST) ../include/common.h ../include/pid.h +%.o : %.c $(H_FILE_LIST) ../include/common.h ../include/pid.h $(ROOT)/config.mk $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(INCLUDE) -c $< -o $@ -firemon: $(OBJS) ../lib/common.o ../lib/pid.o +firemon: $(OBJS) ../lib/common.o ../lib/pid.o $(ROOT)/config.mk $(CC) $(LDFLAGS) -o $@ $(OBJS) ../lib/common.o ../lib/pid.o $(LIBS) $(EXTRA_LDFLAGS) .PHONY: clean diff --git a/src/fldd/Makefile b/src/fldd/Makefile index fdaa202fda4..d9a70529bdc 100644 --- a/src/fldd/Makefile +++ b/src/fldd/Makefile @@ -4,10 +4,10 @@ all: fldd ROOT = ../.. include $(ROOT)/src/common.mk -%.o : %.c $(H_FILE_LIST) ../include/common.h ../include/syscall.h ../include/ldd_utils.h +%.o : %.c $(H_FILE_LIST) ../include/common.h ../include/syscall.h ../include/ldd_utils.h $(ROOT)/config.mk $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(INCLUDE) -c $< -o $@ -fldd: $(OBJS) ../lib/common.o ../lib/ldd_utils.o +fldd: $(OBJS) ../lib/common.o ../lib/ldd_utils.o $(ROOT)/config.mk $(CC) $(LDFLAGS) -o $@ $(OBJS) ../lib/common.o ../lib/ldd_utils.o $(LIBS) $(EXTRA_LDFLAGS) .PHONY: clean diff --git a/src/fnet/Makefile b/src/fnet/Makefile index 2642fea381e..36e95522fe0 100644 --- a/src/fnet/Makefile +++ b/src/fnet/Makefile @@ -4,10 +4,10 @@ all: fnet ROOT = ../.. include $(ROOT)/src/common.mk -%.o : %.c $(H_FILE_LIST) ../include/common.h ../include/libnetlink.h +%.o : %.c $(H_FILE_LIST) ../include/common.h ../include/libnetlink.h $(ROOT)/config.mk $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(INCLUDE) -c $< -o $@ -fnet: $(OBJS) ../lib/common.o ../lib/libnetlink.o +fnet: $(OBJS) ../lib/common.o ../lib/libnetlink.o $(ROOT)/config.mk $(CC) $(LDFLAGS) -o $@ $(OBJS) ../lib/common.o ../lib/libnetlink.o $(LIBS) $(EXTRA_LDFLAGS) .PHONY: clean diff --git a/src/fnetfilter/Makefile b/src/fnetfilter/Makefile index e0738281ac6..758561b9e89 100644 --- a/src/fnetfilter/Makefile +++ b/src/fnetfilter/Makefile @@ -4,10 +4,10 @@ all: fnetfilter ROOT = ../.. include $(ROOT)/src/common.mk -%.o : %.c $(H_FILE_LIST) ../include/common.h ../include/syscall.h +%.o : %.c $(H_FILE_LIST) ../include/common.h ../include/syscall.h $(ROOT)/config.mk $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(INCLUDE) -c $< -o $@ -fnetfilter: $(OBJS) ../lib/common.o +fnetfilter: $(OBJS) ../lib/common.o $(ROOT)/config.mk $(CC) $(LDFLAGS) -o $@ $(OBJS) ../lib/common.o $(LIBS) $(EXTRA_LDFLAGS) .PHONY: clean diff --git a/src/fnettrace-dns/Makefile b/src/fnettrace-dns/Makefile index 9946f545dc0..101abd4d4d0 100644 --- a/src/fnettrace-dns/Makefile +++ b/src/fnettrace-dns/Makefile @@ -4,10 +4,10 @@ all: fnettrace-dns ROOT = ../.. include $(ROOT)/src/common.mk -%.o : %.c $(H_FILE_LIST) +%.o : %.c $(H_FILE_LIST) $(ROOT)/config.mk $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(INCLUDE) -c $< -o $@ -fnettrace-dns: $(OBJS) +fnettrace-dns: $(OBJS) $(ROOT)/config.mk $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS) $(EXTRA_LDFLAGS) .PHONY: clean diff --git a/src/fnettrace-sni/Makefile b/src/fnettrace-sni/Makefile index 556727831d3..da7c1ca4e33 100644 --- a/src/fnettrace-sni/Makefile +++ b/src/fnettrace-sni/Makefile @@ -4,10 +4,10 @@ all: fnettrace-sni ROOT = ../.. include $(ROOT)/src/common.mk -%.o : %.c $(H_FILE_LIST) +%.o : %.c $(H_FILE_LIST) $(ROOT)/config.mk $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(INCLUDE) -c $< -o $@ -fnettrace-sni: $(OBJS) +fnettrace-sni: $(OBJS) $(ROOT)/config.mk $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS) $(EXTRA_LDFLAGS) .PHONY: clean diff --git a/src/fnettrace/Makefile b/src/fnettrace/Makefile index 406d095ff93..f41a4d36d26 100644 --- a/src/fnettrace/Makefile +++ b/src/fnettrace/Makefile @@ -4,10 +4,10 @@ all: fnettrace ROOT = ../.. include $(ROOT)/src/common.mk -%.o : %.c $(H_FILE_LIST) +%.o : %.c $(H_FILE_LIST) $(ROOT)/config.mk $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(INCLUDE) -c $< -o $@ -fnettrace: $(OBJS) +fnettrace: $(OBJS) $(ROOT)/config.mk $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS) $(EXTRA_LDFLAGS) .PHONY: clean diff --git a/src/fsec-optimize/Makefile b/src/fsec-optimize/Makefile index 1ccc2fa8f80..1aa49d34bb5 100644 --- a/src/fsec-optimize/Makefile +++ b/src/fsec-optimize/Makefile @@ -4,10 +4,10 @@ all: fsec-optimize ROOT = ../.. include $(ROOT)/src/common.mk -%.o : %.c $(H_FILE_LIST) ../include/common.h ../include/seccomp.h ../include/syscall.h +%.o : %.c $(H_FILE_LIST) ../include/common.h ../include/seccomp.h ../include/syscall.h $(ROOT)/config.mk $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(INCLUDE) -c $< -o $@ -fsec-optimize: $(OBJS) ../lib/common.o ../lib/libnetlink.o +fsec-optimize: $(OBJS) ../lib/common.o ../lib/libnetlink.o $(ROOT)/config.mk $(CC) $(LDFLAGS) -o $@ $(OBJS) ../lib/common.o ../lib/errno.o $(LIBS) $(EXTRA_LDFLAGS) .PHONY: clean diff --git a/src/fsec-print/Makefile b/src/fsec-print/Makefile index b5ba6f1609e..b076c0588b8 100644 --- a/src/fsec-print/Makefile +++ b/src/fsec-print/Makefile @@ -4,10 +4,10 @@ all: fsec-print ROOT = ../.. include $(ROOT)/src/common.mk -%.o : %.c $(H_FILE_LIST) ../include/common.h ../include/seccomp.h ../include/syscall.h +%.o : %.c $(H_FILE_LIST) ../include/common.h ../include/seccomp.h ../include/syscall.h $(ROOT)/config.mk $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(INCLUDE) -c $< -o $@ -fsec-print: $(OBJS) ../lib/common.o ../lib/libnetlink.o ../lib/errno.o ../lib/syscall.o +fsec-print: $(OBJS) ../lib/common.o ../lib/libnetlink.o ../lib/errno.o ../lib/syscall.o $(ROOT)/config.mk $(CC) $(LDFLAGS) -o $@ $(OBJS) ../lib/common.o ../lib/errno.o ../lib/syscall.o $(LIBS) $(EXTRA_LDFLAGS) .PHONY: clean diff --git a/src/fseccomp/Makefile b/src/fseccomp/Makefile index 527ec0a68e8..9bf4c050b7e 100644 --- a/src/fseccomp/Makefile +++ b/src/fseccomp/Makefile @@ -4,10 +4,10 @@ all: fseccomp ROOT = ../.. include $(ROOT)/src/common.mk -%.o : %.c $(H_FILE_LIST) ../include/common.h ../include/syscall.h +%.o : %.c $(H_FILE_LIST) ../include/common.h ../include/syscall.h $(ROOT)/config.mk $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(INCLUDE) -c $< -o $@ -fseccomp: $(OBJS) ../lib/common.o ../lib/errno.o ../lib/syscall.o +fseccomp: $(OBJS) ../lib/common.o ../lib/errno.o ../lib/syscall.o $(ROOT)/config.mk $(CC) $(LDFLAGS) -o $@ $(OBJS) ../lib/common.o ../lib/errno.o ../lib/syscall.o $(LIBS) $(EXTRA_LDFLAGS) .PHONY: clean diff --git a/src/ftee/Makefile b/src/ftee/Makefile index 00c1a2662df..535d7ff63bb 100644 --- a/src/ftee/Makefile +++ b/src/ftee/Makefile @@ -4,10 +4,10 @@ all: ftee ROOT = ../.. include $(ROOT)/src/common.mk -%.o : %.c $(H_FILE_LIST) +%.o : %.c $(H_FILE_LIST) $(ROOT)/config.mk $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(INCLUDE) -c $< -o $@ -ftee: $(OBJS) +ftee: $(OBJS) $(ROOT)/config.mk $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS) $(EXTRA_LDFLAGS) .PHONY: clean diff --git a/src/fzenity/Makefile b/src/fzenity/Makefile index 169b78f091f..0358dd3e9fe 100644 --- a/src/fzenity/Makefile +++ b/src/fzenity/Makefile @@ -4,10 +4,10 @@ all: fzenity ROOT = ../.. include $(ROOT)/src/common.mk -%.o : %.c $(H_FILE_LIST) ../include/common.h +%.o : %.c $(H_FILE_LIST) ../include/common.h $(ROOT)/config.mk $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(INCLUDE) -c $< -o $@ -fzenity: $(OBJS) +fzenity: $(OBJS) $(ROOT)/config.mk $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS) $(EXTRA_LDFLAGS) .PHONY: clean diff --git a/src/jailcheck/Makefile b/src/jailcheck/Makefile index 62e82c9b342..52feb86e6fc 100644 --- a/src/jailcheck/Makefile +++ b/src/jailcheck/Makefile @@ -4,10 +4,10 @@ all: jailcheck ROOT = ../.. include $(ROOT)/src/common.mk -%.o : %.c $(H_FILE_LIST) ../include/common.h ../include/pid.h +%.o : %.c $(H_FILE_LIST) ../include/common.h ../include/pid.h $(ROOT)/config.mk $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(INCLUDE) -c $< -o $@ -jailcheck: $(OBJS) +jailcheck: $(OBJS) $(ROOT)/config.mk $(CC) $(LDFLAGS) -o $@ $(OBJS) ../lib/common.o ../lib/pid.o $(LIBS) $(EXTRA_LDFLAGS) .PHONY: clean diff --git a/src/lib/Makefile b/src/lib/Makefile index bac2d4e9397..d9bc63ef7b5 100644 --- a/src/lib/Makefile +++ b/src/lib/Makefile @@ -4,7 +4,7 @@ include $(ROOT)/src/common.mk .PHONY: all all: $(OBJS) -%.o : %.c $(H_FILE_LIST) +%.o : %.c $(H_FILE_LIST) $(ROOT)/config.mk $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(INCLUDE) -c $< -o $@ .PHONY: clean diff --git a/src/libpostexecseccomp/Makefile b/src/libpostexecseccomp/Makefile index 14e0cdb1d19..5386af58bbf 100644 --- a/src/libpostexecseccomp/Makefile +++ b/src/libpostexecseccomp/Makefile @@ -11,10 +11,10 @@ LDFLAGS += -pie -fPIE -Wl,-z,relro -Wl,-z,now .PHONY: all all: libpostexecseccomp.so -%.o : %.c $(H_FILE_LIST) ../include/seccomp.h ../include/rundefs.h +%.o : %.c $(H_FILE_LIST) ../include/seccomp.h ../include/rundefs.h $(ROOT)/config.mk $(CC) $(CFLAGS) $(INCLUDE) -c $< -o $@ -libpostexecseccomp.so: $(OBJS) +libpostexecseccomp.so: $(OBJS) $(ROOT)/config.mk $(CC) $(LDFLAGS) -shared -fPIC -z relro -o $@ $(OBJS) -ldl .PHONY: clean diff --git a/src/libtrace/Makefile b/src/libtrace/Makefile index 46a8f97c2f0..6f28b3442ea 100644 --- a/src/libtrace/Makefile +++ b/src/libtrace/Makefile @@ -11,10 +11,10 @@ LDFLAGS += -pie -fPIE -Wl,-z,relro -Wl,-z,now .PHONY: all all: libtrace.so -%.o : %.c $(H_FILE_LIST) +%.o : %.c $(H_FILE_LIST) $(ROOT)/config.mk $(CC) $(CFLAGS) $(INCLUDE) -c $< -o $@ -libtrace.so: $(OBJS) +libtrace.so: $(OBJS) $(ROOT)/config.mk $(CC) $(LDFLAGS) -shared -fPIC -z relro -o $@ $(OBJS) -ldl .PHONY: clean diff --git a/src/libtracelog/Makefile b/src/libtracelog/Makefile index 1a3ab1ba5a0..c5d9c131d0c 100644 --- a/src/libtracelog/Makefile +++ b/src/libtracelog/Makefile @@ -11,10 +11,10 @@ LDFLAGS += -pie -fPIE -Wl,-z,relro -Wl,-z,now .PHONY: all all: libtracelog.so -%.o : %.c $(H_FILE_LIST) ../include/rundefs.h +%.o : %.c $(H_FILE_LIST) ../include/rundefs.h $(ROOT)/config.mk $(CC) $(CFLAGS) $(INCLUDE) -c $< -o $@ -libtracelog.so: $(OBJS) +libtracelog.so: $(OBJS) $(ROOT)/config.mk $(CC) $(LDFLAGS) -shared -fPIC -z relro -o $@ $(OBJS) -ldl .PHONY: clean diff --git a/src/man/Makefile b/src/man/Makefile index b786e1ca99c..283822d1f23 100644 --- a/src/man/Makefile +++ b/src/man/Makefile @@ -4,7 +4,7 @@ all: firecfg.man firejail.man firejail-login.man firejail-users.man firejail-pro ROOT = ../.. -include $(ROOT)/config.mk -%.man: %.txt +%.man: %.txt $(ROOT)/config.mk gawk -f ./preproc.awk -- $(MANFLAGS) < $< > $@ .PHONY: clean diff --git a/src/profstats/Makefile b/src/profstats/Makefile index 0e3b101efbc..0274aead288 100644 --- a/src/profstats/Makefile +++ b/src/profstats/Makefile @@ -4,10 +4,10 @@ all: profstats ROOT = ../.. include $(ROOT)/src/common.mk -%.o : %.c $(H_FILE_LIST) ../include/common.h +%.o : %.c $(H_FILE_LIST) ../include/common.h $(ROOT)/config.mk $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(INCLUDE) -c $< -o $@ -profstats: $(OBJS) +profstats: $(OBJS) $(ROOT)/config.mk $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS) $(EXTRA_LDFLAGS) .PHONY: clean diff --git a/src/zsh_completion/Makefile b/src/zsh_completion/Makefile index bec0150495a..d7bc1038a16 100644 --- a/src/zsh_completion/Makefile +++ b/src/zsh_completion/Makefile @@ -4,7 +4,7 @@ all: _firejail ROOT = ../.. -include $(ROOT)/config.mk -_firejail: _firejail.in +_firejail: _firejail.in $(ROOT)/config.mk gawk -f ../man/preproc.awk -- $(MANFLAGS) < $< > $@.tmp sed "s|_SYSCONFDIR_|$(sysconfdir)|" < $@.tmp > $@ rm $@.tmp