aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorLibravatar Kelvin M. Klann <kmk3.code@protonmail.com>2022-06-23 07:35:19 -0300
committerLibravatar Kelvin M. Klann <kmk3.code@protonmail.com>2022-06-30 05:32:07 -0300
commite21637ca82199d9b659f34d71674090e45fc89db (patch)
tree2a0629d8202ee179124ff7466165aa65cd937e22 /Makefile
parentmakefiles: stop failing when config.mk does not exist (diff)
downloadfirejail-e21637ca82199d9b659f34d71674090e45fc89db.tar.gz
firejail-e21637ca82199d9b659f34d71674090e45fc89db.tar.zst
firejail-e21637ca82199d9b659f34d71674090e45fc89db.zip
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.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile23
1 files changed, 14 insertions, 9 deletions
diff --git a/Makefile b/Makefile
index 5d14ce467..11e19ec37 100644
--- a/Makefile
+++ b/Makefile
@@ -21,6 +21,10 @@ MANPAGES = firejail.1 firemon.1 firecfg.1 firejail-profile.5 firejail-login.5 fi
21SECCOMP_FILTERS = seccomp seccomp.debug seccomp.32 seccomp.block_secondary seccomp.mdwx seccomp.mdwx.32 21SECCOMP_FILTERS = seccomp seccomp.debug seccomp.32 seccomp.block_secondary seccomp.mdwx seccomp.mdwx.32
22ALL_ITEMS = $(APPS) $(SBOX_APPS) $(SBOX_APPS_NON_DUMPABLE) $(MYLIBS) 22ALL_ITEMS = $(APPS) $(SBOX_APPS) $(SBOX_APPS_NON_DUMPABLE) $(MYLIBS)
23 23
24config.mk config.sh:
25 printf 'run ./configure to generate %s\n' "$@" >&2
26 false
27
24.PHONY: all_items $(ALL_ITEMS) 28.PHONY: all_items $(ALL_ITEMS)
25all_items: $(ALL_ITEMS) 29all_items: $(ALL_ITEMS)
26$(ALL_ITEMS): $(MYDIRS) 30$(ALL_ITEMS): $(MYDIRS)
@@ -31,7 +35,7 @@ mydirs: $(MYDIRS)
31$(MYDIRS): 35$(MYDIRS):
32 $(MAKE) -C $@ 36 $(MAKE) -C $@
33 37
34$(MANPAGES): src/man 38$(MANPAGES): src/man config.mk
35 ./mkman.sh $(VERSION) src/man/$(basename $@).man $@ 39 ./mkman.sh $(VERSION) src/man/$(basename $@).man $@
36 40
37man: $(MANPAGES) 41man: $(MANPAGES)
@@ -87,7 +91,7 @@ distclean: clean
87 $(MAKE) -C test distclean 91 $(MAKE) -C test distclean
88 rm -fr autom4te.cache config.log config.mk config.sh config.status 92 rm -fr autom4te.cache config.log config.mk config.sh config.status
89 93
90realinstall: 94realinstall: config.mk
91 # firejail executable 95 # firejail executable
92 install -m 0755 -d $(DESTDIR)$(bindir) 96 install -m 0755 -d $(DESTDIR)$(bindir)
93 install -m 0755 src/firejail/firejail $(DESTDIR)$(bindir) 97 install -m 0755 src/firejail/firejail $(DESTDIR)$(bindir)
@@ -171,7 +175,7 @@ install-strip: all
171 strip $(ALL_ITEMS) 175 strip $(ALL_ITEMS)
172 $(MAKE) realinstall 176 $(MAKE) realinstall
173 177
174uninstall: 178uninstall: config.mk
175 rm -f $(DESTDIR)$(bindir)/firejail 179 rm -f $(DESTDIR)$(bindir)/firejail
176 rm -f $(DESTDIR)$(bindir)/firemon 180 rm -f $(DESTDIR)$(bindir)/firemon
177 rm -f $(DESTDIR)$(bindir)/firecfg 181 rm -f $(DESTDIR)$(bindir)/firecfg
@@ -208,7 +212,7 @@ src
208 212
209DISTFILES_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 213DISTFILES_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
210 214
211dist: 215dist: config.mk
212 mv config.sh config.sh.old 216 mv config.sh config.sh.old
213 mv config.status config.status.old 217 mv config.status config.status.old
214 make distclean 218 make distclean
@@ -223,19 +227,20 @@ dist:
223 tar -cJvf $(NAME)-$(VERSION).tar.xz $(NAME)-$(VERSION) 227 tar -cJvf $(NAME)-$(VERSION).tar.xz $(NAME)-$(VERSION)
224 rm -fr $(NAME)-$(VERSION) 228 rm -fr $(NAME)-$(VERSION)
225 229
226asc:; ./mkasc.sh $(VERSION) 230asc: config.mk
231 ./mkasc.sh $(VERSION)
227 232
228deb: dist 233deb: dist config.sh
229 ./mkdeb.sh 234 ./mkdeb.sh
230 235
231deb-apparmor: dist 236deb-apparmor: dist config.sh
232 ./mkdeb.sh -apparmor --enable-apparmor 237 ./mkdeb.sh -apparmor --enable-apparmor
233 238
234test-compile: dist 239test-compile: dist config.mk
235 cd test/compile; ./compile.sh $(NAME)-$(VERSION) 240 cd test/compile; ./compile.sh $(NAME)-$(VERSION)
236 241
237.PHONY: rpms 242.PHONY: rpms
238rpms: src/man 243rpms: src/man config.mk
239 ./platform/rpm/mkrpm.sh $(NAME) $(VERSION) 244 ./platform/rpm/mkrpm.sh $(NAME) $(VERSION)
240 245
241extras: all 246extras: all