device-mapper-multipath/0018-multipath-tools-Makefiles-move-common-code-to-rules..patch
Benjamin Marzinski c5432960d9 device-mapper-multipath-0.9.3-1
Update to the head of the upstream staging branch
  * Previous patches 0001-0042 are included in the source tarball
  * Patches 0001-0032 are from the upstream staging branch
Rename redhat patches
  * Previous patches 0043-0053 are now patches 0033-0043
Change back to using readline instead of libedit
  * The code the uses readline has been isolated from the code that
    is licensed gpl v2 only.
Add libmpathutil libraries to spec file
Add multipathc program to spec file
Add multipath.conf systemd tempfile configuration to spec file
Misc spec file cleanups
2022-11-16 14:11:59 -06:00

173 lines
5.4 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Thu, 27 Oct 2022 22:18:22 +0200
Subject: [PATCH] multipath-tools: Makefiles: move common code to rules.mk
The library Makefiles contain a lot of similar rules. Just
maintain them in a single file.
Signed-off-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmpathcmd/Makefile | 13 +------------
libmpathpersist/Makefile | 13 +------------
libmpathutil/Makefile | 13 +------------
libmpathvalid/Makefile | 13 ++-----------
libmultipath/Makefile | 16 ++--------------
rules.mk | 15 +++++++++++++++
6 files changed, 22 insertions(+), 61 deletions(-)
create mode 100644 rules.mk
diff --git a/libmpathcmd/Makefile b/libmpathcmd/Makefile
index f705c7f0..cfb202b8 100644
--- a/libmpathcmd/Makefile
+++ b/libmpathcmd/Makefile
@@ -6,18 +6,7 @@ OBJS := mpath_cmd.o
all: $(DEVLIB)
-$(LIBS): $(OBJS) $(VERSION_SCRIPT)
- $(CC) $(LDFLAGS) $(SHARED_FLAGS) -Wl,-soname=$@ \
- -Wl,--version-script=$(VERSION_SCRIPT) -o $@ $(OBJS) $(LIBDEPS)
-
-$(LIBS:%.so.$(SONAME)=%-nv.so): $(OBJS) $(NV_VERSION_SCRIPT)
- $(CC) $(LDFLAGS) $(SHARED_FLAGS) -Wl,-soname=$@ \
- -Wl,--version-script=$(NV_VERSION_SCRIPT) -o $@ $(OBJS) $(LIBDEPS)
-
-abi: $(LIBS:%.so.$(SONAME)=%-nv.abi)
-
-$(DEVLIB): $(LIBS)
- $(LN) $(LIBS) $@
+include $(TOPDIR)/rules.mk
install: all
$(INSTALL_PROGRAM) -d $(DESTDIR)$(syslibdir)
diff --git a/libmpathpersist/Makefile b/libmpathpersist/Makefile
index 6f69168f..94672556 100644
--- a/libmpathpersist/Makefile
+++ b/libmpathpersist/Makefile
@@ -9,18 +9,7 @@ OBJS := mpath_persist.o mpath_updatepr.o mpath_pr_ioctl.o mpath_persist_int.o
all: $(DEVLIB)
-$(LIBS): $(OBJS) $(VERSION_SCRIPT)
- $(CC) $(LDFLAGS) $(SHARED_FLAGS) -Wl,-soname=$@ \
- -Wl,--version-script=$(VERSION_SCRIPT) -o $@ $(OBJS) $(LIBDEPS)
-
-$(LIBS:%.so.$(SONAME)=%-nv.so): $(OBJS) $(NV_VERSION_SCRIPT)
- $(CC) $(LDFLAGS) $(SHARED_FLAGS) -Wl,-soname=$@ \
- -Wl,--version-script=$(NV_VERSION_SCRIPT) -o $@ $(OBJS) $(LIBDEPS)
-
-abi: $(LIBS:%.so.$(SONAME)=%-nv.abi)
-
-$(DEVLIB): $(LIBS)
- $(LN) $(LIBS) $@
+include $(TOPDIR)/rules.mk
install: all
$(INSTALL_PROGRAM) -d $(DESTDIR)$(syslibdir)
diff --git a/libmpathutil/Makefile b/libmpathutil/Makefile
index 5665af28..5ab33c09 100644
--- a/libmpathutil/Makefile
+++ b/libmpathutil/Makefile
@@ -17,18 +17,7 @@ OBJS := parser.o vector.o util.o debug.o time-util.o \
all: $(DEVLIB)
-$(LIBS): $(OBJS) $(VERSION_SCRIPT)
- $(CC) $(LDFLAGS) $(SHARED_FLAGS) -Wl,-soname=$@ \
- -Wl,--version-script=$(VERSION_SCRIPT) -o $@ $(OBJS) $(LIBDEPS)
-
-$(DEVLIB): $(LIBS)
- $(LN) $(LIBS) $@
-
-$(LIBS:%.so.$(SONAME)=%-nv.so): $(OBJS) $(NV_VERSION_SCRIPT)
- $(CC) $(LDFLAGS) $(SHARED_FLAGS) -Wl,-soname=$@ \
- -Wl,--version-script=$(NV_VERSION_SCRIPT) -o $@ $(OBJS) $(LIBDEPS)
-
-abi: $(LIBS:%.so.$(SONAME)=%-nv.abi)
+include $(TOPDIR)/rules.mk
install: all
$(INSTALL_PROGRAM) -d $(DESTDIR)$(syslibdir)
diff --git a/libmpathvalid/Makefile b/libmpathvalid/Makefile
index bd4ccc0d..88034df3 100644
--- a/libmpathvalid/Makefile
+++ b/libmpathvalid/Makefile
@@ -8,18 +8,9 @@ LIBDEPS += -lpthread -ldevmapper -ldl -L$(multipathdir) -lmultipath \
OBJS := mpath_valid.o
-all: $(LIBS)
+all: $(DEVLIB)
-$(LIBS): $(OBJS) $(VERSION_SCRIPT)
- $(CC) $(LDFLAGS) $(SHARED_FLAGS) -Wl,-soname=$@ -o $@ $(OBJS) $(LIBDEPS) \
- -Wl,--version-script=$(VERSION_SCRIPT)
- $(LN) $(LIBS) $(DEVLIB)
-
-$(LIBS:%.so.$(SONAME)=%-nv.so): $(OBJS) $(NV_VERSION_SCRIPT)
- $(CC) $(LDFLAGS) $(SHARED_FLAGS) -Wl,-soname=$@ \
- -Wl,--version-script=$(NV_VERSION_SCRIPT) -o $@ $(OBJS) $(LIBDEPS)
-
-abi: $(LIBS:%.so.$(SONAME)=%-nv.abi)
+include $(TOPDIR)/rules.mk
install: $(LIBS)
$(INSTALL_PROGRAM) -m 755 -d $(DESTDIR)$(syslibdir)
diff --git a/libmultipath/Makefile b/libmultipath/Makefile
index 9dc229ae..e24eab8a 100644
--- a/libmultipath/Makefile
+++ b/libmultipath/Makefile
@@ -56,6 +56,8 @@ OBJS := $(OBJS-O) $(OBJS-U)
all: $(DEVLIB)
+include $(TOPDIR)/rules.mk
+
nvme-lib.o: nvme-lib.c nvme-ioctl.c nvme-ioctl.h
$(CC) $(CPPFLAGS) $(CFLAGS) -Wno-unused-function -c -o $@ $<
@@ -72,20 +74,6 @@ nvme-ioctl.c: nvme/nvme-ioctl.c
nvme-ioctl.h: nvme/nvme-ioctl.h
$(call make_static,$<,$@)
-
-$(LIBS): $(OBJS) $(VERSION_SCRIPT)
- $(CC) $(LDFLAGS) $(SHARED_FLAGS) -Wl,-soname=$@ \
- -Wl,--version-script=$(VERSION_SCRIPT) -o $@ $(OBJS) $(LIBDEPS)
-
-$(DEVLIB): $(LIBS)
- $(LN) $(LIBS) $@
-
-$(LIBS:%.so.$(SONAME)=%-nv.so): $(OBJS) $(NV_VERSION_SCRIPT)
- $(CC) $(LDFLAGS) $(SHARED_FLAGS) -Wl,-soname=$@ \
- -Wl,--version-script=$(NV_VERSION_SCRIPT) -o $@ $(OBJS) $(LIBDEPS)
-
-abi: $(LIBS:%.so.$(SONAME)=%-nv.abi)
-
../tests/$(LIBS): $(OBJS-O) $(OBJS-T) $(VERSION_SCRIPT)
$(CC) $(LDFLAGS) $(SHARED_FLAGS) -Wl,-soname=`basename $@` \
-o $@ $(OBJS-O) $(OBJS-T) $(LIBDEPS)
diff --git a/rules.mk b/rules.mk
new file mode 100644
index 00000000..c1d80820
--- /dev/null
+++ b/rules.mk
@@ -0,0 +1,15 @@
+# Copyright (c) SUSE LLC
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+$(DEVLIB): $(LIBS)
+ $(LN) $(LIBS) $@
+
+$(LIBS): $(OBJS) $(VERSION_SCRIPT)
+ $(CC) $(LDFLAGS) $(SHARED_FLAGS) -Wl,-soname=$@ \
+ -Wl,--version-script=$(VERSION_SCRIPT) -o $@ $(OBJS) $(LIBDEPS)
+
+$(LIBS:%.so.$(SONAME)=%-nv.so): $(OBJS) $(NV_VERSION_SCRIPT)
+ $(CC) $(LDFLAGS) $(SHARED_FLAGS) -Wl,-soname=$@ \
+ -Wl,--version-script=$(NV_VERSION_SCRIPT) -o $@ $(OBJS) $(LIBDEPS)
+
+abi: $(LIBS:%.so.$(SONAME)=%-nv.abi)