diff options
author | Kelvin M. Klann <kmk3.code@protonmail.com> | 2022-05-07 02:46:17 -0300 |
---|---|---|
committer | Kelvin M. Klann <kmk3.code@protonmail.com> | 2022-11-21 17:18:53 -0300 |
commit | f5b1ccaad25b26a8bb383a268532f269411e512c (patch) | |
tree | 1dcf23a0dddf90a5e6f6d5f9216a110a3aa7495a /src/fseccomp/Makefile | |
parent | makefiles: expand HDRS, SRCS and OBJS immediately (diff) | |
download | firejail-f5b1ccaad25b26a8bb383a268532f269411e512c.tar.gz firejail-f5b1ccaad25b26a8bb383a268532f269411e512c.tar.zst firejail-f5b1ccaad25b26a8bb383a268532f269411e512c.zip |
makefiles: move extra deps into new MOD vars
To make the makefiles more similar.
That is, add the following new variables:
* MOD_HDRS
* MOD_SRCS
* MOD_OBJS
And move existing module-specific header and object dependencies into
`MOD_HDRS` and `MOD_OBJS`, respectively. `MOD_SRCS` is added mostly for
symmetry/consistency.
Note: Use `MOD_` as a prefix instead of `EXTRA_` to avoid confusion, as
the latter is currently used for global variables (such as
`EXTRA_CFLAGS`), as opposed to module-specific variables.
Note2: Add them directly into the HDRS/SRCS/OBJS variables to avoid
cluttering the existing recipes with an extra variables unnecessarily.
This also allows, for example, referencing all of the object
dependencies with `$<` if `$(OBJS)` is the first dependency (at least in
GNU make).
Note3: Since HDRS/SRCS/OBJS use simple assignment (through `:=`), the
MOD variables should appear before including src/common.mk (or
src/so.mk).
Diffstat (limited to 'src/fseccomp/Makefile')
-rw-r--r-- | src/fseccomp/Makefile | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/fseccomp/Makefile b/src/fseccomp/Makefile index ed779afde..532ffb2e8 100644 --- a/src/fseccomp/Makefile +++ b/src/fseccomp/Makefile | |||
@@ -1,16 +1,19 @@ | |||
1 | ROOT = ../.. | 1 | ROOT = ../.. |
2 | -include $(ROOT)/config.mk | 2 | -include $(ROOT)/config.mk |
3 | 3 | ||
4 | MOD_HDRS = ../include/common.h ../include/syscall.h | ||
5 | MOD_OBJS = ../lib/common.o ../lib/errno.o ../lib/syscall.o | ||
6 | |||
4 | .PHONY: all | 7 | .PHONY: all |
5 | all: fseccomp | 8 | all: fseccomp |
6 | 9 | ||
7 | include $(ROOT)/src/common.mk | 10 | include $(ROOT)/src/common.mk |
8 | 11 | ||
9 | %.o : %.c $(HDRS) ../include/common.h ../include/syscall.h $(ROOT)/config.mk | 12 | %.o : %.c $(HDRS) $(ROOT)/config.mk |
10 | $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(INCLUDE) -c $< -o $@ | 13 | $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(INCLUDE) -c $< -o $@ |
11 | 14 | ||
12 | fseccomp: $(OBJS) ../lib/common.o ../lib/errno.o ../lib/syscall.o $(ROOT)/config.mk | 15 | fseccomp: $(OBJS) $(ROOT)/config.mk |
13 | $(CC) $(LDFLAGS) -o $@ $(OBJS) ../lib/common.o ../lib/errno.o ../lib/syscall.o $(LIBS) $(EXTRA_LDFLAGS) | 16 | $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS) $(EXTRA_LDFLAGS) |
14 | 17 | ||
15 | .PHONY: clean | 18 | .PHONY: clean |
16 | clean:; rm -fr *.o fseccomp *.gcov *.gcda *.gcno *.plist | 19 | clean:; rm -fr *.o fseccomp *.gcov *.gcda *.gcno *.plist |