diff options
author | Kelvin M. Klann <kmk3.code@protonmail.com> | 2022-06-23 07:35:19 -0300 |
---|---|---|
committer | Kelvin M. Klann <kmk3.code@protonmail.com> | 2022-06-30 05:32:07 -0300 |
commit | e21637ca82199d9b659f34d71674090e45fc89db (patch) | |
tree | 2a0629d8202ee179124ff7466165aa65cd937e22 /Makefile | |
parent | makefiles: stop failing when config.mk does not exist (diff) | |
download | firejail-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-- | Makefile | 23 |
1 files changed, 14 insertions, 9 deletions
@@ -21,6 +21,10 @@ MANPAGES = firejail.1 firemon.1 firecfg.1 firejail-profile.5 firejail-login.5 fi | |||
21 | SECCOMP_FILTERS = seccomp seccomp.debug seccomp.32 seccomp.block_secondary seccomp.mdwx seccomp.mdwx.32 | 21 | SECCOMP_FILTERS = seccomp seccomp.debug seccomp.32 seccomp.block_secondary seccomp.mdwx seccomp.mdwx.32 |
22 | ALL_ITEMS = $(APPS) $(SBOX_APPS) $(SBOX_APPS_NON_DUMPABLE) $(MYLIBS) | 22 | ALL_ITEMS = $(APPS) $(SBOX_APPS) $(SBOX_APPS_NON_DUMPABLE) $(MYLIBS) |
23 | 23 | ||
24 | config.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) |
25 | all_items: $(ALL_ITEMS) | 29 | all_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 | ||
37 | man: $(MANPAGES) | 41 | man: $(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 | ||
90 | realinstall: | 94 | realinstall: 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 | ||
174 | uninstall: | 178 | uninstall: 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 | ||
209 | 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 | 213 | 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 |
210 | 214 | ||
211 | dist: | 215 | dist: 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 | ||
226 | asc:; ./mkasc.sh $(VERSION) | 230 | asc: config.mk |
231 | ./mkasc.sh $(VERSION) | ||
227 | 232 | ||
228 | deb: dist | 233 | deb: dist config.sh |
229 | ./mkdeb.sh | 234 | ./mkdeb.sh |
230 | 235 | ||
231 | deb-apparmor: dist | 236 | deb-apparmor: dist config.sh |
232 | ./mkdeb.sh -apparmor --enable-apparmor | 237 | ./mkdeb.sh -apparmor --enable-apparmor |
233 | 238 | ||
234 | test-compile: dist | 239 | test-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 |
238 | rpms: src/man | 243 | rpms: src/man config.mk |
239 | ./platform/rpm/mkrpm.sh $(NAME) $(VERSION) | 244 | ./platform/rpm/mkrpm.sh $(NAME) $(VERSION) |
240 | 245 | ||
241 | extras: all | 246 | extras: all |