From a1e29acb44b706d56609204bb791afc2aa6a7d10 Mon Sep 17 00:00:00 2001 From: "Kelvin M. Klann" Date: Fri, 15 Jul 2022 02:40:30 -0300 Subject: 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. --- src/libtracelog/Makefile | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/libtracelog/Makefile') diff --git a/src/libtracelog/Makefile b/src/libtracelog/Makefile index 7f74df339..e272fd77e 100644 --- a/src/libtracelog/Makefile +++ b/src/libtracelog/Makefile @@ -1,6 +1,9 @@ ROOT = ../.. -include $(ROOT)/config.mk +SO = libtracelog.so +TARGET = $(SO) + MOD_HDRS = ../include/rundefs.h HDRS := $(sort $(wildcard *.h)) $(MOD_HDRS) @@ -10,16 +13,16 @@ CFLAGS += -ggdb $(HAVE_FATAL_WARNINGS) -O2 -DVERSION='"$(VERSION)"' -fstack-prot LDFLAGS += -pie -fPIE -Wl,-z,relro -Wl,-z,now .PHONY: all -all: libtracelog.so +all: $(TARGET) %.o : %.c $(HDRS) $(ROOT)/config.mk $(CC) $(CFLAGS) $(INCLUDE) -c $< -o $@ -libtracelog.so: $(OBJS) $(ROOT)/config.mk +$(SO): $(OBJS) $(ROOT)/config.mk $(CC) $(LDFLAGS) -shared -fPIC -z relro -o $@ $(OBJS) -ldl .PHONY: clean -clean:; rm -fr $(OBJS) libtracelog.so *.plist +clean:; rm -fr $(OBJS) $(SO) *.plist .PHONY: distclean distclean: clean -- cgit v1.2.3-54-g00ecf