All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anthony PERARD <anthony.perard@citrix.com>
To: <xen-devel@lists.xenproject.org>
Cc: Anthony PERARD <anthony.perard@citrix.com>, Wei Liu <wl@xen.org>
Subject: [XEN PATCH v3 08/25] tools/libfsimage: Cleanup makefiles
Date: Fri, 24 Jun 2022 17:04:05 +0100	[thread overview]
Message-ID: <20220624160422.53457-9-anthony.perard@citrix.com> (raw)
In-Reply-To: <20220624160422.53457-1-anthony.perard@citrix.com>

Remove the need for "fs-*" targets by creating a "common.mk" which
have flags that are common to libfsimage/common/ and the other
libfsimages/*/ directories.

In common.mk, make $(PIC_OBJS) a recursively expanded variable so it
doesn't matter where $(LIB_SRCS-y) is defined, and remove the extra
$(PIC_OBJS) from libfsimage/common/Makefile.

Use a $(TARGETS) variable to list things to be built. And $(TARGETS)
can be use in the clean target in common.mk.

iso9660/:
    Remove the explicit dependency between fsys_iso9660.c and
    iso9660.h, this is handled automaticaly by the .*.d dependency files,
    and iso9660.h already exist.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
---
 tools/libfsimage/common/Makefile     | 11 +++--------
 tools/libfsimage/ext2fs-lib/Makefile |  9 ---------
 tools/libfsimage/ext2fs/Makefile     |  9 ---------
 tools/libfsimage/fat/Makefile        |  9 ---------
 tools/libfsimage/iso9660/Makefile    | 11 -----------
 tools/libfsimage/reiserfs/Makefile   |  9 ---------
 tools/libfsimage/ufs/Makefile        |  9 ---------
 tools/libfsimage/xfs/Makefile        |  9 ---------
 tools/libfsimage/zfs/Makefile        |  9 ---------
 tools/libfsimage/Rules.mk            | 26 ++++++++------------------
 tools/libfsimage/common.mk           | 11 +++++++++++
 11 files changed, 22 insertions(+), 100 deletions(-)
 create mode 100644 tools/libfsimage/common.mk

diff --git a/tools/libfsimage/common/Makefile b/tools/libfsimage/common/Makefile
index 0c5a34baea..79f8cfd28e 100644
--- a/tools/libfsimage/common/Makefile
+++ b/tools/libfsimage/common/Makefile
@@ -1,5 +1,5 @@
 XEN_ROOT = $(CURDIR)/../../..
-include $(XEN_ROOT)/tools/libfsimage/Rules.mk
+include $(XEN_ROOT)/tools/libfsimage/common.mk
 
 MAJOR := $(shell $(XEN_ROOT)/version.sh $(XEN_ROOT)/xen/Makefile)
 MINOR = 0
@@ -13,12 +13,10 @@ LDFLAGS += $(PTHREAD_LDFLAGS)
 
 LIB_SRCS-y = fsimage.c fsimage_plugin.c fsimage_grub.c
 
-PIC_OBJS := $(patsubst %.c,%.opic,$(LIB_SRCS-y))
-
-LIB = libxenfsimage.so libxenfsimage.so.$(MAJOR) libxenfsimage.so.$(MAJOR).$(MINOR)
+TARGETS = libxenfsimage.so libxenfsimage.so.$(MAJOR) libxenfsimage.so.$(MAJOR).$(MINOR)
 
 .PHONY: all
-all: $(LIB)
+all: $(TARGETS)
 
 .PHONY: install
 install: all
@@ -40,9 +38,6 @@ uninstall:
 	rm -f $(DESTDIR)$(libdir)/libxenfsimage.so.$(MAJOR)
 	rm -f $(DESTDIR)$(libdir)/libxenfsimage.so.$(MAJOR).$(MINOR)
 
-clean distclean::
-	rm -f $(LIB)
-
 libxenfsimage.so: libxenfsimage.so.$(MAJOR)
 	ln -sf $< $@
 libxenfsimage.so.$(MAJOR): libxenfsimage.so.$(MAJOR).$(MINOR)
diff --git a/tools/libfsimage/ext2fs-lib/Makefile b/tools/libfsimage/ext2fs-lib/Makefile
index 431a79068e..b9b560df75 100644
--- a/tools/libfsimage/ext2fs-lib/Makefile
+++ b/tools/libfsimage/ext2fs-lib/Makefile
@@ -9,13 +9,4 @@ FS_LIBDEPS = $(EXTFS_LIBS)
 # Include configure output (config.h)
 CFLAGS += -include $(XEN_ROOT)/tools/config.h
 
-.PHONY: all
-all: fs-all
-
-.PHONY: install
-install: fs-install
-
-.PHONY: uninstall
-uninstall: fs-uninstall
-
 include $(XEN_ROOT)/tools/libfsimage/Rules.mk
diff --git a/tools/libfsimage/ext2fs/Makefile b/tools/libfsimage/ext2fs/Makefile
index c62ae359ac..fe01f98148 100644
--- a/tools/libfsimage/ext2fs/Makefile
+++ b/tools/libfsimage/ext2fs/Makefile
@@ -4,13 +4,4 @@ LIB_SRCS-y = fsys_ext2fs.c
 
 FS = ext2fs
 
-.PHONY: all
-all: fs-all
-
-.PHONY: install
-install: fs-install
-
-.PHONY: uninstall
-uninstall: fs-uninstall
-
 include $(XEN_ROOT)/tools/libfsimage/Rules.mk
diff --git a/tools/libfsimage/fat/Makefile b/tools/libfsimage/fat/Makefile
index 7ee5e7588d..58bcc0751d 100644
--- a/tools/libfsimage/fat/Makefile
+++ b/tools/libfsimage/fat/Makefile
@@ -4,13 +4,4 @@ LIB_SRCS-y = fsys_fat.c
 
 FS = fat
 
-.PHONY: all
-all: fs-all
-
-.PHONY: install
-install: fs-install
-
-.PHONY: uninstall
-uninstall: fs-uninstall
-
 include $(XEN_ROOT)/tools/libfsimage/Rules.mk
diff --git a/tools/libfsimage/iso9660/Makefile b/tools/libfsimage/iso9660/Makefile
index bc86baf2c0..acf3164046 100644
--- a/tools/libfsimage/iso9660/Makefile
+++ b/tools/libfsimage/iso9660/Makefile
@@ -4,15 +4,4 @@ LIB_SRCS-y = fsys_iso9660.c
 
 FS = iso9660
 
-.PHONY: all
-all: fs-all
-
-.PHONY: install
-install: fs-install
-
-.PHONY: uninstall
-uninstall: fs-uninstall
-
-fsys_iso9660.c: iso9660.h
-
 include $(XEN_ROOT)/tools/libfsimage/Rules.mk
diff --git a/tools/libfsimage/reiserfs/Makefile b/tools/libfsimage/reiserfs/Makefile
index 5acfedf25e..42b751e007 100644
--- a/tools/libfsimage/reiserfs/Makefile
+++ b/tools/libfsimage/reiserfs/Makefile
@@ -4,13 +4,4 @@ LIB_SRCS-y = fsys_reiserfs.c
 
 FS = reiserfs
 
-.PHONY: all
-all: fs-all
-
-.PHONY: install
-install: fs-install
-
-.PHONY: uninstall
-uninstall: fs-uninstall
-
 include $(XEN_ROOT)/tools/libfsimage/Rules.mk
diff --git a/tools/libfsimage/ufs/Makefile b/tools/libfsimage/ufs/Makefile
index f32b9178bd..cca4f0a588 100644
--- a/tools/libfsimage/ufs/Makefile
+++ b/tools/libfsimage/ufs/Makefile
@@ -4,13 +4,4 @@ LIB_SRCS-y = fsys_ufs.c
 
 FS = ufs
 
-.PHONY: all
-all: fs-all
-
-.PHONY: install
-install: fs-install
-
-.PHONY: uninstall
-uninstall: fs-uninstall
-
 include $(XEN_ROOT)/tools/libfsimage/Rules.mk
diff --git a/tools/libfsimage/xfs/Makefile b/tools/libfsimage/xfs/Makefile
index 54eeb6e35e..ebac7baf14 100644
--- a/tools/libfsimage/xfs/Makefile
+++ b/tools/libfsimage/xfs/Makefile
@@ -4,13 +4,4 @@ LIB_SRCS-y = fsys_xfs.c
 
 FS = xfs
 
-.PHONY: all
-all: fs-all
-
-.PHONY: install
-install: fs-install
-
-.PHONY: uninstall
-uninstall: fs-uninstall
-
 include $(XEN_ROOT)/tools/libfsimage/Rules.mk
diff --git a/tools/libfsimage/zfs/Makefile b/tools/libfsimage/zfs/Makefile
index 084e5ec08d..434a9c3580 100644
--- a/tools/libfsimage/zfs/Makefile
+++ b/tools/libfsimage/zfs/Makefile
@@ -28,13 +28,4 @@ LIB_SRCS-y = zfs_lzjb.c zfs_sha256.c zfs_fletcher.c fsi_zfs.c fsys_zfs.c
 
 FS = zfs
 
-.PHONY: all
-all: fs-all
-
-.PHONY: install
-install: fs-install
-
-.PHONY: uninstall
-uninstall: fs-uninstall
-
 include $(XEN_ROOT)/tools/libfsimage/Rules.mk
diff --git a/tools/libfsimage/Rules.mk b/tools/libfsimage/Rules.mk
index bb6d42abb4..cf37d6cb0d 100644
--- a/tools/libfsimage/Rules.mk
+++ b/tools/libfsimage/Rules.mk
@@ -1,25 +1,18 @@
-include $(XEN_ROOT)/tools/Rules.mk
-
-CFLAGS += -Wno-unknown-pragmas -I$(XEN_ROOT)/tools/libfsimage/common/ -DFSIMAGE_FSDIR=\"$(FSDIR)\"
-CFLAGS += -Werror -D_GNU_SOURCE
-LDFLAGS += -L../common/
-
-PIC_OBJS := $(patsubst %.c,%.opic,$(LIB_SRCS-y))
-
-FSDIR = $(libdir)/xenfsimage
+include $(XEN_ROOT)/tools/libfsimage/common.mk
 
 FSLIB = fsimage.so
+TARGETS += $(FSLIB)
 
-.PHONY: fs-all
-fs-all: $(FSLIB)
+.PHONY: all
+all: $(TARGETS)
 
-.PHONY: fs-install
-fs-install: fs-all
+.PHONY: install
+install: all
 	$(INSTALL_DIR) $(DESTDIR)$(FSDIR)/$(FS)
 	$(INSTALL_PROG) $(FSLIB) $(DESTDIR)$(FSDIR)/$(FS)
 
-.PHONY: fs-uninstall
-fs-uninstall:
+.PHONY: uninstall
+uninstall:
 	rm -f $(addprefix $(DESTDIR)$(FSDIR)/$(FS)/, $(FSLIB))
 	if [ -d $(DESTDIR)$(FSDIR)/$(FS) ]; then \
 		rmdir $(DESTDIR)$(FSDIR)/$(FS); \
@@ -28,7 +21,4 @@ fs-uninstall:
 $(FSLIB): $(PIC_OBJS)
 	$(CC) $(LDFLAGS) $(SHLIB_LDFLAGS) -o $@ $^ -lxenfsimage $(FS_LIBDEPS) $(APPEND_LDFLAGS)
 
-clean distclean::
-	rm -f $(PIC_OBJS) $(FSLIB) $(DEPS_RM)
-
 -include $(DEPS_INCLUDE)
diff --git a/tools/libfsimage/common.mk b/tools/libfsimage/common.mk
new file mode 100644
index 0000000000..77bc957f27
--- /dev/null
+++ b/tools/libfsimage/common.mk
@@ -0,0 +1,11 @@
+include $(XEN_ROOT)/tools/Rules.mk
+
+FSDIR := $(libdir)/xenfsimage
+CFLAGS += -Wno-unknown-pragmas -I$(XEN_ROOT)/tools/libfsimage/common/ -DFSIMAGE_FSDIR=\"$(FSDIR)\"
+CFLAGS += -Werror -D_GNU_SOURCE
+LDFLAGS += -L../common/
+
+PIC_OBJS = $(patsubst %.c,%.opic,$(LIB_SRCS-y))
+
+clean distclean::
+	rm -f $(PIC_OBJS) $(TARGETS) $(DEPS_RM)
-- 
Anthony PERARD



  parent reply	other threads:[~2022-06-24 16:05 UTC|newest]

Thread overview: 73+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-24 16:03 [XEN PATCH v3 00/25] Toolstack build system improvement, toward non-recursive makefiles Anthony PERARD
2022-06-24 16:03 ` [XEN PATCH v3 01/25] tools/console: have one Makefile per program/directory Anthony PERARD
2022-07-08 15:08   ` Luca Fancellu
2022-06-24 16:03 ` [XEN PATCH v3 02/25] tools/debugger/gdbsx: Fix and cleanup makefiles Anthony PERARD
2022-07-08 15:23   ` Luca Fancellu
2022-06-24 16:04 ` [XEN PATCH v3 03/25] tools/examples: cleanup Makefile Anthony PERARD
2022-07-08 15:31   ` Luca Fancellu
2022-06-24 16:04 ` [XEN PATCH v3 04/25] tools/firmware/hvmloader: rework Makefile Anthony PERARD
2022-07-08 15:39   ` Luca Fancellu
2022-07-11 13:38     ` Anthony PERARD
2022-07-11 13:40       ` Luca Fancellu
2022-07-11 13:41     ` Jan Beulich
2022-07-11 13:52   ` Jan Beulich
2022-07-11 17:01     ` Anthony PERARD
2022-06-24 16:04 ` [XEN PATCH v3 05/25] tools/fuzz/libelf: rework makefile Anthony PERARD
2022-07-11 11:23   ` Luca Fancellu
2022-06-24 16:04 ` [XEN PATCH v3 06/25] tools/fuzz/x86_instruction_emulator: " Anthony PERARD
2022-07-11 13:16   ` Luca Fancellu
2022-07-11 14:08   ` Jan Beulich
2022-08-02 17:09     ` Anthony PERARD
2022-08-03  5:56       ` Jan Beulich
2022-08-03 10:15         ` Anthony PERARD
2022-06-24 16:04 ` [XEN PATCH v3 07/25] tools/hotplug: cleanup Makefiles Anthony PERARD
2022-07-22 11:02   ` Luca Fancellu
2022-06-24 16:04 ` Anthony PERARD [this message]
2022-07-22 12:07   ` [XEN PATCH v3 08/25] tools/libfsimage: Cleanup makefiles Luca Fancellu
2022-06-24 16:04 ` [XEN PATCH v3 09/25] tools/xenpaging: Rework makefile Anthony PERARD
2022-07-22 12:17   ` Luca Fancellu
2022-06-24 16:04 ` [XEN PATCH v3 10/25] tools/xentop: rework makefile Anthony PERARD
2022-07-22 13:13   ` Luca Fancellu
2022-06-24 16:04 ` [XEN PATCH v3 11/25] tools/xentrace: rework Makefile Anthony PERARD
2022-07-22 13:30   ` Luca Fancellu
2022-08-08 15:35     ` Anthony PERARD
2022-06-24 16:04 ` [XEN PATCH v3 12/25] .gitignore: Cleanup ignores of tools/libs/*/{headers.chk,*.pc} Anthony PERARD
2022-06-29 10:15   ` Juergen Gross
2022-07-05 13:17   ` Bertrand Marquis
2022-06-24 16:04 ` [XEN PATCH v3 13/25] tools/libs/util: cleanup Makefile Anthony PERARD
2022-06-29 10:18   ` Juergen Gross
2022-07-05 13:20   ` Bertrand Marquis
2022-06-24 16:04 ` [XEN PATCH v3 14/25] tools/flask/utils: list build targets in $(TARGETS) Anthony PERARD
2022-07-12  1:30   ` Henry Wang
2022-06-24 16:04 ` [XEN PATCH v3 15/25] libs/libs.mk: Rename $(LIB) to $(TARGETS) Anthony PERARD
2022-06-29 10:19   ` Juergen Gross
2022-07-05 13:21   ` Bertrand Marquis
2022-06-24 16:04 ` [XEN PATCH v3 16/25] libs/libs.mk: Remove the need for $(PKG_CONFIG_INST) Anthony PERARD
2022-06-29 10:22   ` Juergen Gross
2022-07-05 13:27   ` Bertrand Marquis
2022-06-24 16:04 ` [XEN PATCH v3 17/25] libs/libs.mk: Rework target headers.chk dependencies Anthony PERARD
2022-06-29 10:23   ` Juergen Gross
2022-07-05 13:29   ` Bertrand Marquis
2022-06-24 16:04 ` [XEN PATCH v3 18/25] tools: Introduce $(xenlibs-rpath,..) to replace $(SHDEPS_lib*) Anthony PERARD
2022-06-29 10:26   ` Juergen Gross
2022-06-24 16:04 ` [XEN PATCH v3 19/25] tools: Introduce $(xenlibs-ldlibs, ) macro Anthony PERARD
2022-06-29 10:29   ` Juergen Gross
2022-06-24 16:04 ` [XEN PATCH v3 20/25] tools: Introduce $(xenlibs-ldflags, " Anthony PERARD
2022-07-12  1:40   ` Henry Wang
2022-06-24 16:04 ` [XEN PATCH v3 21/25] tools/helper: Cleanup Makefile Anthony PERARD
2022-07-22 14:06   ` Luca Fancellu
2022-06-24 16:04 ` [XEN PATCH v3 22/25] tools/console: Use $(xenlibs-ldlibs,) Anthony PERARD
2022-07-22 14:15   ` Luca Fancellu
2022-06-24 16:04 ` [XEN PATCH v3 23/25] tools/helpers: Fix build of xen-init-dom0 with -Werror Anthony PERARD
2022-07-12  1:31   ` Henry Wang
2022-06-24 16:04 ` [XEN PATCH v3 24/25] tools: Add -Werror by default to all tools/ Anthony PERARD
2022-07-22 14:31   ` Luca Fancellu
2022-06-24 16:04 ` [XEN PATCH v3 25/25] tools: Remove -Werror everywhere else Anthony PERARD
2022-06-29  8:59   ` Luca Fancellu
2022-06-29 17:22     ` Stefano Stabellini
2022-06-30  7:33       ` Bertrand Marquis
2022-06-30 21:03         ` Stefano Stabellini
2022-07-01 13:26           ` Bertrand Marquis
2022-07-01 17:47             ` Stefano Stabellini
2022-06-29 10:31   ` Juergen Gross
2022-06-27  7:25 ` [XEN PATCH v3 00/25] Toolstack build system improvement, toward non-recursive makefiles Christian Lindig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220624160422.53457-9-anthony.perard@citrix.com \
    --to=anthony.perard@citrix.com \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.