From adbd02f4213666cf68a455599dc366a840b3ad25 Mon Sep 17 00:00:00 2001 From: "Kelvin M. Klann" Date: Tue, 3 May 2022 05:47:23 -0300 Subject: makefiles: deduplicate lib makefiles into so.mk The following makefiles are nearly identical, except for the main target name and for any extra headers that they might use: * src/libpostexecseccomp/Makefile * src/libtrace/Makefile * src/libtracelog/Makefile So move all of their (duplicated) code into a new src/so.mk file, and add an include of src/so.mk, which leaves only variables, and the includes of config.mk and src/so.mk in place. With this commit, CFLAGS and LDFLAGS are only defined/changed in the following files: * config.mk.in * src/common.mk * src/so.mk --- src/libtrace/Makefile | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) (limited to 'src/libtrace') diff --git a/src/libtrace/Makefile b/src/libtrace/Makefile index cb2d66667..d45b3e2f6 100644 --- a/src/libtrace/Makefile +++ b/src/libtrace/Makefile @@ -4,23 +4,4 @@ ROOT = ../.. SO = libtrace.so TARGET = $(SO) -HDRS := $(sort $(wildcard *.h)) $(MOD_HDRS) -SRCS := $(sort $(wildcard *.c)) $(MOD_SRCS) -OBJS := $(SRCS:.c=.o) $(MOD_OBJS) -CFLAGS += -ggdb $(HAVE_FATAL_WARNINGS) -O2 -DVERSION='"$(VERSION)"' -fstack-protector-all -D_FORTIFY_SOURCE=2 -fPIC -Wformat -Wformat-security -LDFLAGS += -pie -fPIE -Wl,-z,relro -Wl,-z,now - -.PHONY: all -all: $(TARGET) - -%.o : %.c $(HDRS) $(ROOT)/config.mk - $(CC) $(CFLAGS) $(INCLUDE) -c $< -o $@ - -$(SO): $(OBJS) $(ROOT)/config.mk - $(CC) $(LDFLAGS) -shared -fPIC -z relro -o $@ $(OBJS) -ldl - -.PHONY: clean -clean:; rm -fr $(OBJS) $(SO) *.plist - -.PHONY: distclean -distclean: clean +include $(ROOT)/src/so.mk -- cgit v1.2.3-54-g00ecf