diff options
author | Kelvin M. Klann <kmk3.code@protonmail.com> | 2022-07-15 02:40:30 -0300 |
---|---|---|
committer | Kelvin M. Klann <kmk3.code@protonmail.com> | 2022-11-21 17:23:00 -0300 |
commit | a1e29acb44b706d56609204bb791afc2aa6a7d10 (patch) | |
tree | ca324f8cb4508352b8ba6b8fbfea325023100fd5 /src/libtrace | |
parent | makefiles: deduplicate many makefiles into common.mk (diff) | |
download | firejail-a1e29acb44b706d56609204bb791afc2aa6a7d10.tar.gz firejail-a1e29acb44b706d56609204bb791afc2aa6a7d10.tar.zst firejail-a1e29acb44b706d56609204bb791afc2aa6a7d10.zip |
makefiles: deduplicate main target name into new SO var
Put the main target name into a new SO variable, put SO into a new
TARGET variable, make "all" depend on `$(TARGET)` and replace every
other occurrence of the main target name with `$(SO)`.
On the makefiles that build shared objects, to make them more similar.
With this commit, all of their targets are identical.
Diffstat (limited to 'src/libtrace')
-rw-r--r-- | src/libtrace/Makefile | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/libtrace/Makefile b/src/libtrace/Makefile index 4e826b1aa..cb2d66667 100644 --- a/src/libtrace/Makefile +++ b/src/libtrace/Makefile | |||
@@ -1,6 +1,9 @@ | |||
1 | ROOT = ../.. | 1 | ROOT = ../.. |
2 | -include $(ROOT)/config.mk | 2 | -include $(ROOT)/config.mk |
3 | 3 | ||
4 | SO = libtrace.so | ||
5 | TARGET = $(SO) | ||
6 | |||
4 | HDRS := $(sort $(wildcard *.h)) $(MOD_HDRS) | 7 | HDRS := $(sort $(wildcard *.h)) $(MOD_HDRS) |
5 | SRCS := $(sort $(wildcard *.c)) $(MOD_SRCS) | 8 | SRCS := $(sort $(wildcard *.c)) $(MOD_SRCS) |
6 | OBJS := $(SRCS:.c=.o) $(MOD_OBJS) | 9 | OBJS := $(SRCS:.c=.o) $(MOD_OBJS) |
@@ -8,16 +11,16 @@ CFLAGS += -ggdb $(HAVE_FATAL_WARNINGS) -O2 -DVERSION='"$(VERSION)"' -fstack-prot | |||
8 | LDFLAGS += -pie -fPIE -Wl,-z,relro -Wl,-z,now | 11 | LDFLAGS += -pie -fPIE -Wl,-z,relro -Wl,-z,now |
9 | 12 | ||
10 | .PHONY: all | 13 | .PHONY: all |
11 | all: libtrace.so | 14 | all: $(TARGET) |
12 | 15 | ||
13 | %.o : %.c $(HDRS) $(ROOT)/config.mk | 16 | %.o : %.c $(HDRS) $(ROOT)/config.mk |
14 | $(CC) $(CFLAGS) $(INCLUDE) -c $< -o $@ | 17 | $(CC) $(CFLAGS) $(INCLUDE) -c $< -o $@ |
15 | 18 | ||
16 | libtrace.so: $(OBJS) $(ROOT)/config.mk | 19 | $(SO): $(OBJS) $(ROOT)/config.mk |
17 | $(CC) $(LDFLAGS) -shared -fPIC -z relro -o $@ $(OBJS) -ldl | 20 | $(CC) $(LDFLAGS) -shared -fPIC -z relro -o $@ $(OBJS) -ldl |
18 | 21 | ||
19 | .PHONY: clean | 22 | .PHONY: clean |
20 | clean:; rm -fr $(OBJS) libtrace.so *.plist | 23 | clean:; rm -fr $(OBJS) $(SO) *.plist |
21 | 24 | ||
22 | .PHONY: distclean | 25 | .PHONY: distclean |
23 | distclean: clean | 26 | distclean: clean |