diff options
author | 2022-06-23 07:35:19 -0300 | |
---|---|---|
committer | 2022-06-30 05:32:07 -0300 | |
commit | e21637ca82199d9b659f34d71674090e45fc89db (patch) | |
tree | 2a0629d8202ee179124ff7466165aa65cd937e22 /src/fbuilder | |
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 'src/fbuilder')
-rw-r--r-- | src/fbuilder/Makefile | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/fbuilder/Makefile b/src/fbuilder/Makefile index b769deac9..da0403c6e 100644 --- a/src/fbuilder/Makefile +++ b/src/fbuilder/Makefile | |||
@@ -4,10 +4,10 @@ all: fbuilder | |||
4 | ROOT = ../.. | 4 | ROOT = ../.. |
5 | include $(ROOT)/src/common.mk | 5 | include $(ROOT)/src/common.mk |
6 | 6 | ||
7 | %.o : %.c $(H_FILE_LIST) ../include/common.h ../include/syscall.h | 7 | %.o : %.c $(H_FILE_LIST) ../include/common.h ../include/syscall.h $(ROOT)/config.mk |
8 | $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(INCLUDE) -c $< -o $@ | 8 | $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(INCLUDE) -c $< -o $@ |
9 | 9 | ||
10 | fbuilder: $(OBJS) | 10 | fbuilder: $(OBJS) $(ROOT)/config.mk |
11 | $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS) $(EXTRA_LDFLAGS) | 11 | $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS) $(EXTRA_LDFLAGS) |
12 | 12 | ||
13 | .PHONY: clean | 13 | .PHONY: clean |