diff options
author | 2022-05-07 02:46:17 -0300 | |
---|---|---|
committer | 2022-11-21 17:18:53 -0300 | |
commit | f5b1ccaad25b26a8bb383a268532f269411e512c (patch) | |
tree | 1dcf23a0dddf90a5e6f6d5f9216a110a3aa7495a /src/libtracelog | |
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/libtracelog')
-rw-r--r-- | src/libtracelog/Makefile | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/libtracelog/Makefile b/src/libtracelog/Makefile index 97f33003e..7f74df339 100644 --- a/src/libtracelog/Makefile +++ b/src/libtracelog/Makefile | |||
@@ -1,16 +1,18 @@ | |||
1 | ROOT = ../.. | 1 | ROOT = ../.. |
2 | -include $(ROOT)/config.mk | 2 | -include $(ROOT)/config.mk |
3 | 3 | ||
4 | HDRS := $(sort $(wildcard *.h)) | 4 | MOD_HDRS = ../include/rundefs.h |
5 | SRCS := $(sort $(wildcard *.c)) | 5 | |
6 | OBJS := $(SRCS:.c=.o) | 6 | HDRS := $(sort $(wildcard *.h)) $(MOD_HDRS) |
7 | SRCS := $(sort $(wildcard *.c)) $(MOD_SRCS) | ||
8 | OBJS := $(SRCS:.c=.o) $(MOD_OBJS) | ||
7 | CFLAGS += -ggdb $(HAVE_FATAL_WARNINGS) -O2 -DVERSION='"$(VERSION)"' -fstack-protector-all -D_FORTIFY_SOURCE=2 -fPIC -Wformat -Wformat-security | 9 | CFLAGS += -ggdb $(HAVE_FATAL_WARNINGS) -O2 -DVERSION='"$(VERSION)"' -fstack-protector-all -D_FORTIFY_SOURCE=2 -fPIC -Wformat -Wformat-security |
8 | LDFLAGS += -pie -fPIE -Wl,-z,relro -Wl,-z,now | 10 | LDFLAGS += -pie -fPIE -Wl,-z,relro -Wl,-z,now |
9 | 11 | ||
10 | .PHONY: all | 12 | .PHONY: all |
11 | all: libtracelog.so | 13 | all: libtracelog.so |
12 | 14 | ||
13 | %.o : %.c $(HDRS) ../include/rundefs.h $(ROOT)/config.mk | 15 | %.o : %.c $(HDRS) $(ROOT)/config.mk |
14 | $(CC) $(CFLAGS) $(INCLUDE) -c $< -o $@ | 16 | $(CC) $(CFLAGS) $(INCLUDE) -c $< -o $@ |
15 | 17 | ||
16 | libtracelog.so: $(OBJS) $(ROOT)/config.mk | 18 | libtracelog.so: $(OBJS) $(ROOT)/config.mk |