From: Anthony PERARD <anthony.perard@citrix.com>
To: <xen-devel@lists.xenproject.org>
Cc: Anthony PERARD <anthony.perard@citrix.com>,
Luca Fancellu <luca.fancellu@arm.com>,
Elena Ufimtseva <elena.ufimtseva@oracle.com>,
"Wei Liu" <wl@xen.org>
Subject: [XEN PATCH for-4.17 v5 01/17] tools/debugger/gdbsx: Fix and cleanup makefiles
Date: Thu, 13 Oct 2022 14:04:57 +0100 [thread overview]
Message-ID: <20221013130513.52440-2-anthony.perard@citrix.com> (raw)
In-Reply-To: <20221013130513.52440-1-anthony.perard@citrix.com>
gdbsx/:
- Make use of subdir facility for the "clean" target.
- No need to remove the *.a, they aren't in this dir.
- Avoid calling "distclean" in subdirs as "distclean" targets do only
call "clean", and the "clean" also runs "clean" in subdirs.
- Avoid the need to make "gx_all.a" and "xg_all.a" in the "all"
recipe by forcing make to check for update of "xg/xg_all.a" and
"gx/gx_all.a" by having "FORCE" as prerequisite. Now, when making
"gdbsx", make will recurse even when both *.a already exist.
- List target in $(TARGETS).
gdbsx/*/:
- Fix dependency on *.h.
- Remove some dead code.
- List targets in $(TARGETS).
- Remove "build" target.
- Cleanup "clean" targets.
- remove comments about the choice of "ar" instead of "ld"
- Use "$(AR)" instead of plain "ar".
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
---
Notes:
missing-ack: GDBSX DEBUGGER
v2:
- also replace plain "ar" by "$(AR)"
tools/debugger/gdbsx/Makefile | 20 ++++++++++----------
tools/debugger/gdbsx/gx/Makefile | 15 +++++++--------
tools/debugger/gdbsx/xg/Makefile | 25 +++++++------------------
3 files changed, 24 insertions(+), 36 deletions(-)
diff --git a/tools/debugger/gdbsx/Makefile b/tools/debugger/gdbsx/Makefile
index 5571450a89..4aaf427c45 100644
--- a/tools/debugger/gdbsx/Makefile
+++ b/tools/debugger/gdbsx/Makefile
@@ -1,20 +1,20 @@
XEN_ROOT = $(CURDIR)/../../..
include ./Rules.mk
+SUBDIRS-y += gx
+SUBDIRS-y += xg
+
+TARGETS := gdbsx
+
.PHONY: all
-all:
- $(MAKE) -C gx
- $(MAKE) -C xg
- $(MAKE) gdbsx
+all: $(TARGETS)
.PHONY: clean
-clean:
- rm -f xg_all.a gx_all.a gdbsx
- set -e; for d in xg gx; do $(MAKE) -C $$d clean; done
+clean: subdirs-clean
+ rm -f $(TARGETS)
.PHONY: distclean
distclean: clean
- set -e; for d in xg gx; do $(MAKE) -C $$d distclean; done
.PHONY: install
install: all
@@ -28,7 +28,7 @@ uninstall:
gdbsx: gx/gx_all.a xg/xg_all.a
$(CC) $(LDFLAGS) -o $@ $^
-xg/xg_all.a:
+xg/xg_all.a: FORCE
$(MAKE) -C xg
-gx/gx_all.a:
+gx/gx_all.a: FORCE
$(MAKE) -C gx
diff --git a/tools/debugger/gdbsx/gx/Makefile b/tools/debugger/gdbsx/gx/Makefile
index 3b8467f799..e9859aea9c 100644
--- a/tools/debugger/gdbsx/gx/Makefile
+++ b/tools/debugger/gdbsx/gx/Makefile
@@ -2,21 +2,20 @@ XEN_ROOT = $(CURDIR)/../../../..
include ../Rules.mk
GX_OBJS := gx_comm.o gx_main.o gx_utils.o gx_local.o
-GX_HDRS := $(wildcard *.h)
+
+TARGETS := gx_all.a
.PHONY: all
-all: gx_all.a
+all: $(TARGETS)
.PHONY: clean
clean:
- rm -rf gx_all.a *.o .*.d
+ rm -f *.o $(TARGETS) $(DEPS_RM)
.PHONY: distclean
distclean: clean
-#%.o: %.c $(GX_HDRS) Makefile
-# $(CC) -c $(CFLAGS) -o $@ $<
-
-gx_all.a: $(GX_OBJS) Makefile $(GX_HDRS)
- ar cr $@ $(GX_OBJS) # problem with ld using -m32
+gx_all.a: $(GX_OBJS) Makefile
+ $(AR) cr $@ $(GX_OBJS)
+-include $(DEPS_INCLUDE)
diff --git a/tools/debugger/gdbsx/xg/Makefile b/tools/debugger/gdbsx/xg/Makefile
index acdcddf0d5..05325d6d81 100644
--- a/tools/debugger/gdbsx/xg/Makefile
+++ b/tools/debugger/gdbsx/xg/Makefile
@@ -1,35 +1,24 @@
XEN_ROOT = $(CURDIR)/../../../..
include ../Rules.mk
-XG_HDRS := xg_public.h
XG_OBJS := xg_main.o
CFLAGS += -D__XEN_TOOLS__
CFLAGS += $(CFLAGS_xeninclude)
+TARGETS := xg_all.a
.PHONY: all
-all: build
+all: $(TARGETS)
-.PHONY: build
-build: xg_all.a $(XG_HDRS) $(XG_OBJS) Makefile
-# build: mk-symlinks xg_all.a $(XG_HDRS) $(XG_OBJS) Makefile
-# build: mk-symlinks xg_all.a
-
-xg_all.a: $(XG_OBJS) Makefile $(XG_HDRS)
- ar cr $@ $(XG_OBJS) # problems using -m32 in ld
-# $(LD) -b elf32-i386 $(LDFLAGS) -r -o $@ $^
-# $(CC) -m32 -c -o $@ $^
-
-# xg_main.o: xg_main.c Makefile $(XG_HDRS)
-#$(CC) -c $(CFLAGS) -o $@ $<
-
-# %.o: %.c $(XG_HDRS) Makefile -- doesn't work as it won't overwrite Rules.mk
-#%.o: %.c -- doesn't recompile when .c changed
+xg_all.a: $(XG_OBJS) Makefile
+ $(AR) cr $@ $(XG_OBJS)
.PHONY: clean
clean:
- rm -rf xen xg_all.a $(XG_OBJS) .*.d
+ rm -f $(TARGETS) $(XG_OBJS) $(DEPS_RM)
.PHONY: distclean
distclean: clean
+
+-include $(DEPS_INCLUDE)
--
Anthony PERARD
next prev parent reply other threads:[~2022-10-13 13:05 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-13 13:04 [XEN PATCH for-4.17 v5 00/17] Toolstack build system improvement, toward non-recursive makefiles Anthony PERARD
2022-10-13 13:04 ` Anthony PERARD [this message]
2022-10-13 13:04 ` [XEN PATCH for-4.17 v5 02/17] tools/xentrace: rework Makefile Anthony PERARD
2022-10-13 13:04 ` [XEN PATCH for-4.17 v5 03/17] tools: Introduce $(xenlibs-ldflags, ) macro Anthony PERARD
2022-10-13 13:05 ` [XEN PATCH for-4.17 v5 04/17] tools: Add -Werror by default to all tools/ Anthony PERARD
2022-10-13 13:05 ` [XEN PATCH for-4.17 v5 05/17] tools: Remove -Werror everywhere else Anthony PERARD
2022-10-13 15:13 ` Andrew Cooper
2022-10-14 10:16 ` Anthony PERARD
2022-10-14 15:06 ` Anthony PERARD
2022-10-13 13:05 ` [XEN PATCH for-4.17 v5 06/17] tools/hotplug: Generate "hotplugpath.sh" with configure Anthony PERARD
2022-10-14 18:03 ` Andrew Cooper
2022-10-13 13:05 ` [XEN PATCH for-4.17 v5 07/17] libs/light/gentypes.py: allow to generate headers in subdirectory Anthony PERARD
2022-10-13 13:05 ` [XEN PATCH for-4.17 v5 08/17] git-checkout.sh: handle running git-checkout from a different directory Anthony PERARD
2022-10-13 13:05 ` [XEN PATCH for-4.17 v5 09/17] libs: Avoid exposing -Wl,--version-script to other built library Anthony PERARD
2022-10-13 13:05 ` [XEN PATCH for-4.17 v5 10/17] libs: Fix auto-generation of version-script for unstable libs Anthony PERARD
2022-10-14 18:16 ` Andrew Cooper
2022-10-17 14:19 ` Anthony PERARD
2022-10-13 13:05 ` [XEN PATCH for-4.17 v5 11/17] tools/include: Rework Makefile Anthony PERARD
2022-10-13 13:05 ` [XEN PATCH for-4.17 v5 12/17] libs/light: Rework acpi table build targets Anthony PERARD
2022-10-13 13:05 ` [XEN PATCH for-4.17 v5 13/17] libs/light: Rework generation of include/_libxl_*.h Anthony PERARD
2022-10-13 13:05 ` [XEN PATCH for-4.17 v5 14/17] libs/light: Rework targets prerequisites Anthony PERARD
2022-10-14 19:35 ` Andrew Cooper
2022-10-17 14:39 ` Anthony PERARD
2022-10-13 13:05 ` [XEN PATCH for-4.17 v5 15/17] libs/light: Makefile cleanup Anthony PERARD
2022-10-13 13:05 ` [XEN PATCH for-4.17 v5 16/17] tools/golang/xenlight: Rework gengotypes.py and generation of *.gen.go Anthony PERARD
2022-10-13 15:00 ` Andrew Cooper
2022-10-14 11:24 ` George Dunlap
2022-10-14 11:37 ` Andrew Cooper
2022-10-14 11:42 ` George Dunlap
2022-10-14 11:51 ` Andrew Cooper
2022-10-14 11:25 ` George Dunlap
2022-10-13 13:05 ` [XEN PATCH for-4.17 v5 17/17] tools: Rework linking options for ocaml binding libraries Anthony PERARD
2022-10-13 18:02 ` [XEN PATCH for-4.17 v5 00/17] Toolstack build system improvement, toward non-recursive makefiles Andrew Cooper
2022-10-14 6:26 ` Henry Wang
2022-10-14 10:14 ` Anthony PERARD
2022-10-14 10:28 ` Henry Wang
2022-10-14 10:31 ` Andrew Cooper
2022-10-14 10:39 ` Henry Wang
2022-10-14 12:55 ` 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=20221013130513.52440-2-anthony.perard@citrix.com \
--to=anthony.perard@citrix.com \
--cc=elena.ufimtseva@oracle.com \
--cc=luca.fancellu@arm.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.