Skip to contentSkip to conversation

libxl: fix incremental parallel build

PATCH In review Jan Beulich 3 participants 18 messages Aug 30, 2017 – Sep 5, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libxl: fix incremental parallel build

Short-circuit absolute paths of generated headers to their pathless equivalents, to avoid two racing invocations of the same rule producing them.

---
This wants to be backported to 4.9 and 4.8.

tools/libxl/Makefile +7 -0
@@ -264,6 +264,13 @@ $(LIBXL_OBJS) $(LIBXL_TEST_OBJS) $(LIBXL
 	$(TEST_PROG_OBJS) $(SAVE_HELPER_OBJS): libxl.h
 $(LIBXL_OBJS) $(LIBXL_TEST_OBJS): libxl_internal.h
 
+# libacpi sources (living in another subdirectory) will have their inclusions
+# of headers from this directory recorded as absolute paths in the .*.o.d
+# files.  In order to not invoke the subsequent rule twice (and perhaps in a
+# racing way when doing a parallel build), short-circuit the absolute paths to
+# the local ones first.
+$(CURDIR)/_libxl_type%.h: _libxl_type%.h ;
+
 _libxl_type%.h _libxl_type%_json.h _libxl_type%_private.h _libxl_type%.c: libxl_type%.idl gentypes.py idl.py
 	$(eval stem = $(notdir $*))
 	$(PYTHON) gentypes.py libxl_type$(stem).idl __libxl_type$(stem).h __libxl_type$(stem)_private.h \

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#1 lore raw
Quoted 11 lines · Jan Beulich

Short-circuit absolute paths of generated headers to their pathless equivalents, to avoid two racing invocations of the same rule producing them.

---
This wants to be backported to 4.9 and 4.8.

tools/libxl/Makefile $(LIBXL_OBJS) $(LIBXL_TEST_OBJS) $(LIBXL · line 272

Quoted 9 lines
tools/libxl/Makefile +6 -0
@@ -264,6 +264,13 @@ $(LIBXL_OBJS) $(LIBXL_TEST_OBJS) $(LIBXL
 	$(TEST_PROG_OBJS) $(SAVE_HELPER_OBJS): libxl.h
 $(LIBXL_OBJS) $(LIBXL_TEST_OBJS): libxl_internal.h
 
+# libacpi sources (living in another subdirectory) will have their inclusions
+# of headers from this directory recorded as absolute paths in the .*.o.d
+# files.  In order to not invoke the subsequent rule twice (and perhaps in a
+# racing way when doing a parallel build), short-circuit the absolute paths to
+# the local ones first.
+$(CURDIR)/_libxl_type%.h: _libxl_type%.h ;

I don't quite get this. I normally build with -j8 and never saw a race.

Do you mean parallel build in which two makes enter libxl? Is that possible?

Why does libacpi matter? All dependencies files (*.o.d) should be local to libxl anyway.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#2 lore raw
Quoted 21 lines
Quoted 1 line
Quoted 1 line · On 01.09.17 at 17:28, <[email protected]> wrote:
Quoted 11 lines · Jan Beulich

Short-circuit absolute paths of generated headers to their pathless equivalents, to avoid two racing invocations of the same rule producing them.

---
This wants to be backported to 4.9 and 4.8.

tools/libxl/Makefile $(LIBXL_OBJS) $(LIBXL_TEST_OBJS) $(LIBXL · line 267

Quoted 4 lines
tools/libxl/Makefile +1 -0
@@ -264,6 +264,13 @@ $(LIBXL_OBJS) $(LIBXL_TEST_OBJS) $(LIBXL
 	$(TEST_PROG_OBJS) $(SAVE_HELPER_OBJS): libxl.h
 $(LIBXL_OBJS) $(LIBXL_TEST_OBJS): libxl_internal.h
 
+# libacpi sources (living in another subdirectory) will have their 

inclusions

tools/libxl/Makefile $(LIBXL_OBJS) $(LIBXL_TEST_OBJS) $(LIBXL · line 269

Quoted 2 lines
tools/libxl/Makefile +2 -0
+# of headers from this directory recorded as absolute paths in the .*.o.d
+# files.  In order to not invoke the subsequent rule twice (and perhaps in 

a

Quoted 6 lines

tools/libxl/Makefile $(LIBXL_OBJS) $(LIBXL_TEST_OBJS) $(LIBXL · line 270

Quoted 1 line
tools/libxl/Makefile +1 -0
+# racing way when doing a parallel build), short-circuit the absolute paths 

to

tools/libxl/Makefile $(LIBXL_OBJS) $(LIBXL_TEST_OBJS) $(LIBXL · line 272

Quoted 2 lines
tools/libxl/Makefile +2 -0
+# the local ones first.
+$(CURDIR)/_libxl_type%.h: _libxl_type%.h ;

I don't quite get this. I normally build with -j8 and never saw a race.

I rarely do incremental tools builds, but each time I do them (on 4.8 or later) I run into this issue.

Quoted 2 lines

Do you mean parallel build in which two makes enter libxl? Is that possible?

No, only a single entry into that subtree.

Quoted 2 lines

Why does libacpi matter? All dependencies files (*.o.d) should be local to libxl anyway.

Did you check? My .build.o.d has:

build.o: \
/build/xen/unstable-hg/2017-08-10/tools/libxl/../../tools/libacpi/build.c \
/build/xen/unstable-hg/2017-08-10/tools/libxl/../../tools/config.h \
/build/xen/unstable-hg/2017-08-10/tools/libxl/libxl_x86_acpi.h \
[...]
_libxl_list.h \
/build/xen/unstable-hg/2017-08-10/tools/libxl/_libxl_types.h \
libxl_event.h libxl.h \
[...]

and it is this non-local _libxl_types.h dependency which breaks things. I've noted this with gcc 4.3.x, in case that matters (e.g. if newer compilers are smarter in how they write out deps).

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#3 lore raw

Jan Beulich writes ("Re: [PATCH] libxl: fix incremental parallel build"):

Quoted 5 lines · On 01.09.17 at 17:28, <[email protected]> wrote:
Quoted 2 lines

Do you mean parallel build in which two makes enter libxl? Is that possible?

No, only a single entry into that subtree.

Are you sure ?

Quoted 4 lines
Quoted 2 lines

Why does libacpi matter? All dependencies files (*.o.d) should be local to libxl anyway.

Did you check? My .build.o.d has:

AFAICT you must mean tools/firmware/hvmloader/.build.o.d ?

Quoted 10 lines

build.o: \
/build/xen/unstable-hg/2017-08-10/tools/libxl/../../tools/libacpi/build.c \
/build/xen/unstable-hg/2017-08-10/tools/libxl/../../tools/config.h \
/build/xen/unstable-hg/2017-08-10/tools/libxl/libxl_x86_acpi.h \
[...]
_libxl_list.h \
/build/xen/unstable-hg/2017-08-10/tools/libxl/_libxl_types.h \
libxl_event.h libxl.h \
[...]

Quoted 3 lines

and it is this non-local _libxl_types.h dependency which breaks things. I've noted this with gcc 4.3.x, in case that matters (e.g. if newer compilers are smarter in how they write out deps).

This suggests that perhaps the problem is that something is reentering libxl.

With recursive make, it is necessary for the overall structure of the makefiles to sequence things so that each directory is entered exactly once, before its dependent directories are entered. (It is possible to violate this rule without creating races but it is tricky and inadvisable.)

Can you provide a complete log of a failing build ?

Thanks,
Ian.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#4 lore raw
Quoted 9 lines
Quoted 1 line
Quoted 1 line · On 01.09.17 at 19:04, <[email protected]> wrote:

Jan Beulich writes ("Re: [PATCH] libxl: fix incremental parallel build"):

Quoted 5 lines · On 01.09.17 at 17:28, <[email protected]> wrote:
Quoted 2 lines

Do you mean parallel build in which two makes enter libxl? Is that possible?

No, only a single entry into that subtree.

Are you sure ?

Yes.

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

Why does libacpi matter? All dependencies files (*.o.d) should be local to libxl anyway.

Did you check? My .build.o.d has:

AFAICT you must mean tools/firmware/hvmloader/.build.o.d ?

No, I mean the libxl instance of the file (remember that the same libacpi source file is being compiled twice). The hvmloader instance looks similar, but doesn't cause the same problem (because there are no auto-generated headers).

Quoted 10 lines
Quoted 10 lines

build.o: \
/build/xen/unstable-hg/2017-08-10/tools/libxl/../../tools/libacpi/build.c \
/build/xen/unstable-hg/2017-08-10/tools/libxl/../../tools/config.h \
/build/xen/unstable-hg/2017-08-10/tools/libxl/libxl_x86_acpi.h \
[...]
_libxl_list.h \
/build/xen/unstable-hg/2017-08-10/tools/libxl/_libxl_types.h \
libxl_event.h libxl.h \
[...]

Quoted 6 lines
Quoted 3 lines

and it is this non-local _libxl_types.h dependency which breaks things. I've noted this with gcc 4.3.x, in case that matters (e.g. if newer compilers are smarter in how they write out deps).

This suggests that perhaps the problem is that something is reentering libxl.

Again, I've verified (multiple times) that this is not the case, as I too did initially suspect this to be what is happening.

Quoted 5 lines

With recursive make, it is necessary for the overall structure of the makefiles to sequence things so that each directory is entered exactly once, before its dependent directories are entered. (It is possible to violate this rule without creating races but it is tricky and inadvisable.)

I understand that.

Quoted 1 line

Can you provide a complete log of a failing build ?

With the above, is that really needed? And if so, do you mean just normal make output, or output from additionally passing -p.

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#5 lore raw

Jan Beulich writes ("Re: [PATCH] libxl: fix incremental parallel build"):

Quoted 7 lines · On 01.09.17 at 19:04, <[email protected]> wrote:
Quoted 1 line

AFAICT you must mean tools/firmware/hvmloader/.build.o.d ?

No, I mean the libxl instance of the file (remember that the same libacpi source file is being compiled twice). The hvmloader instance looks similar, but doesn't cause the same problem (because there are no auto-generated headers).

I had an out of date tree somehow, so I didn't find the build.o.

Quoted 4 lines
Quoted 1 line

Can you provide a complete log of a failing build ?

With the above, is that really needed? And if so, do you mean just normal make output, or output from additionally passing -p.

I still think it would be helpful. But in the meantime I'm looking again at this log of a successful build.

Ian.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#6 lore raw
In reply to Jan Beulich

I have investigated this further and have made the following discoveries:

1. make distinguishes targets purely textually. It will canonicalise a target name by removing ./ before comparison (so foo' and ./foo' are considered the same target) but it won't examine the filesystem AFAICT. So foo' and ../../this/subdir/foo' are different targets. (You seem to have already observed or known this.)

2. If you use gcc -MMD to generate a .d file, and say -I. to include things from the cwd, but invoke gcc to compile a file elsewhere, eg gcc -MMD -I -o build.o /other/path/build.c
and build.c #includes foo.h', then the -MMD output mentions /absolute/path/to/this/subdir/foo.h', even though it could refer to foo.h'. (VPATH and vpath are obvious ways for this to happen.) This is presumably because gcc has noticed that .' in this context must mean relative to the invocation cwd, not relative to build.c.

3. If foo.h is autogenerated using some kind of pattern rule, you end up with two `copies' of the rule, which can run simultaneously, once for build.c -> build.o and once for normal files in the same cwd.

I think (2) is a bug in gcc. But we can't sensibly expect to fix that. Sadly I think the right fix is to seddery the pointless paths out of the .d files.

I don't think going round all our Makefiles adding rules of the form
$(ABS_PATH_TO_HERE)/auto-%-generated.: auto-%-generated.h
is sensible. There are too many and this is too ad-hoc.

Do people agree ?

Ian.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#7 lore raw
Quoted 24 lines
Quoted 1 line
Quoted 1 line · On 04.09.17 at 13:33, <[email protected]> wrote:

I have investigated this further and have made the following discoveries:

1. make distinguishes targets purely textually. It will canonicalise a target name by removing ./ before comparison (so foo' and ./foo' are considered the same target) but it won't examine the filesystem AFAICT. So foo' and ../../this/subdir/foo' are different targets. (You seem to have already observed or known this.)

2. If you use gcc -MMD to generate a .d file, and say -I. to include things from the cwd, but invoke gcc to compile a file elsewhere, eg gcc -MMD -I -o build.o /other/path/build.c
and build.c #includes foo.h', then the -MMD output mentions /absolute/path/to/this/subdir/foo.h', even though it could refer to foo.h'. (VPATH and vpath are obvious ways for this to happen.) This is presumably because gcc has noticed that .' in this context must mean relative to the invocation cwd, not relative to build.c.

3. If foo.h is autogenerated using some kind of pattern rule, you end up with two `copies' of the rule, which can run simultaneously, once for build.c -> build.o and once for normal files in the same cwd.

Quoted 7 lines

I think (2) is a bug in gcc. But we can't sensibly expect to fix that. Sadly I think the right fix is to seddery the pointless paths out of the .d files.

I don't think going round all our Makefiles adding rules of the form
$(ABS_PATH_TO_HERE)/auto-%-generated.: auto-%-generated.h
is sensible. There are too many and this is too ad-hoc.

Well, the absolute paths in there are a problem only when compiling files from a different subdirectory. Is that something that happens in many places? I would agree to the sed approach you suggest if this was a widespread problem, but I don't think it is (and hence I went this other route).

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#8 lore raw

Jan Beulich writes ("Re: [PATCH] libxl: fix incremental parallel build"):

Quoted 3 lines

Well, the absolute paths in there are a problem only when compiling files from a different subdirectory. Is that something that happens in many places?

It seems to be not wholly uncommon in xen.git, primarily because of a desire to build the same code for execution in userland and in the hypervisor (or guest firmware images or similar).

So far we have

mariner:xen.git> git-grep '^vpath' | wc -l
8

and that clearly leaves some out because it contains none of the hypervisor instances.

And my key point is that the need for a workaround is not the fault of the autogenerated .h files. Your proposed workaround needs adjusting every time the set of autogenerated .h files (or the set of Makefiles which make .h files) changes.

I would like to make a single change which will always work. After all we have no way to automatically verify that we don't have bugs of this form, and when we do write a bug of this form it's a race bug (and race bugs are horrible to find and debug).

Ian.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#9 lore raw
Quoted 5 lines
Quoted 1 line
Quoted 1 line · On 04.09.17 at 15:33, <[email protected]> wrote:

I would like to make a single change which will always work. After all we have no way to automatically verify that we don't have bugs of this form, and when we do write a bug of this form it's a race bug (and race bugs are horrible to find and debug).

Well, okay - I take that you're intending to put together such a change then in the not too distant future.

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#10 lore raw

Jan Beulich writes ("Re: [PATCH] libxl: fix incremental parallel build"):

Quoted 8 lines · On 04.09.17 at 15:33, <[email protected]> wrote:
Quoted 4 lines

I would like to make a single change which will always work. After all we have no way to automatically verify that we don't have bugs of this form, and when we do write a bug of this form it's a race bug (and race bugs are horrible to find and debug).

Well, okay - I take that you're intending to put together such a change then in the not too distant future.

Sure, I was indeed volunteering :-).

Ian.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#11 lore raw

PATCH 1/4 DEPS handling: Provide DEPS_RM and DEPS_INCLUDE

These are not used anywhere yet, so no functional change.

---
 Config.mk | 2 ++
 1 file changed, 2 insertions(+)
Config.mk +2 -0
index 1bc922e..5aca4bf 100644
@@ -56,6 +56,8 @@ HOSTCC ?= clang
 HOSTCXX ?= clang++
 endif
 
+DEPS_RM = $(DEPS)
+DEPS_INCLUDE = $(DEPS)
 
 include $(XEN_ROOT)/config/$(XEN_OS).mk
 include $(XEN_ROOT)/config/$(XEN_TARGET_ARCH).mk
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#12 lore raw

PATCH 2/4 DEPS handling: Use DEPS_RM everywhere

DEPS_RM is currently the same as DEPS, so no functional change.

This patch is the result of two perl runes:

git-grep -l 'rm.*DEPS' | xargs perl -i~ -pe 'next unless m/^\t+rm\b/; s/\bDEPS\b/DEPS_RM/;'

git-grep -l 'RM.*DEPS' | xargs perl -i~ -pe 'next unless m/^\t+\$\(RM\)/; s/\bDEPS\b/DEPS_RM/;'

And editing tools/xenstat/libxenstat/Makefile by hand.

I verified that I didn't miss anything with this rune:

git-grep '\bDEPS\b' | grep -v include |less

---
 tools/blktap2/Makefile                        | 2 +-
 tools/blktap2/control/Makefile                | 2 +-
 tools/blktap2/lvm/Makefile                    | 2 +-
 tools/blktap2/vhd/Makefile                    | 2 +-
 tools/blktap2/vhd/lib/Makefile                | 2 +-
 tools/console/Makefile                        | 2 +-
 tools/debugger/kdd/Makefile                   | 2 +-
 tools/firmware/hvmloader/Makefile             | 2 +-
 tools/firmware/rombios/32bit/Makefile         | 2 +-
 tools/firmware/rombios/32bit/tcgbios/Makefile | 2 +-
 tools/firmware/rombios/Makefile               | 2 +-
 tools/flask/utils/Makefile                    | 2 +-
 tools/helpers/Makefile                        | 2 +-
 tools/libfsimage/Rules.mk                     | 2 +-
 tools/libs/call/Makefile                      | 2 +-
 tools/libs/devicemodel/Makefile               | 2 +-
 tools/libs/evtchn/Makefile                    | 2 +-
 tools/libs/foreignmemory/Makefile             | 2 +-
 tools/libs/gnttab/Makefile                    | 2 +-
 tools/libs/toollog/Makefile                   | 2 +-
 tools/libvchan/Makefile                       | 2 +-
 tools/libxc/Makefile                          | 2 +-
 tools/libxl/Makefile                          | 2 +-
 tools/memshr/Makefile                         | 2 +-
 tools/misc/Makefile                           | 2 +-
 tools/pygrub/Makefile                         | 2 +-
 tools/python/Makefile                         | 2 +-
 tools/tests/mem-sharing/Makefile              | 2 +-
 tools/tests/xen-access/Makefile               | 2 +-
 tools/tests/xenstore/Makefile                 | 2 +-
 tools/xcutils/Makefile                        | 2 +-
 tools/xenbackendd/Makefile                    | 2 +-
 tools/xenmon/Makefile                         | 2 +-
 tools/xenpaging/Makefile                      | 2 +-
 tools/xenpmd/Makefile                         | 2 +-
 tools/xenstat/libxenstat/Makefile             | 2 +-
 tools/xenstat/xentop/Makefile                 | 2 +-
 tools/xenstore/Makefile                       | 2 +-
 tools/xentrace/Makefile                       | 2 +-
 tools/xl/Makefile                             | 2 +-
 xen/Rules.mk                                  | 2 +-
 xen/xsm/flask/Makefile                        | 2 +-
 42 files changed, 42 insertions(+), 42 deletions(-)
tools/blktap2/Makefile +1 -1
index f4758ef..f4ac1eb 100644
@@ -12,7 +12,7 @@ SUBDIRS-$(CONFIG_Linux) += drivers
 SUBDIRS-$(CONFIG_Linux) += control
 
 clean:
-	rm -rf *.a *.so *.o *.rpm $(LIB) *~ $(DEPS) TAGS
+	rm -rf *.a *.so *.o *.rpm $(LIB) *~ $(DEPS_RM) TAGS
 
 distclean: clean
 
tools/blktap2/control/Makefile +1 -1
index c168283..49ec153 100644
@@ -87,7 +87,7 @@ install: build
 	$(INSTALL_DATA) xenblktapctl.pc $(DESTDIR)$(PKG_INSTALLDIR)
 
 clean:
-	rm -f $(OBJS) $(PICS) $(DEPS) $(IBIN) $(LIB_STATIC) $(LIB_SHARED)
+	rm -f $(OBJS) $(PICS) $(DEPS_RM) $(IBIN) $(LIB_STATIC) $(LIB_SHARED)
 	rm -f $(LIBNAME).so $(LIBSONAME)
 	rm -f *~
 	rm -f xenblktapctl.pc
tools/blktap2/lvm/Makefile +1 -1
index 72fea0a..4a2e2b5 100644
@@ -29,7 +29,7 @@ lvm-util: lvm-util.o
 	$(CC) -DLVM_UTIL $(LDFLAGS) -o lvm-util lvm-util.c
 
 clean:
-	rm -rf *.o *.opic *~ $(DEPS) $(IBIN)
+	rm -rf *.o *.opic *~ $(DEPS_RM) $(IBIN)
 
 distclean: clean
 
tools/blktap2/vhd/Makefile +1 -1
index e60b7af..815d151 100644
@@ -46,7 +46,7 @@ uninstall:
 	rm -f $(addprefix $(DESTDIR)$(INST_DIR)/, $(IBIN))
 
 clean: subdirs-clean
-	rm -rf *.o *~ $(DEPS) $(IBIN)
+	rm -rf *.o *~ $(DEPS_RM) $(IBIN)
 
 distclean: clean
 
tools/blktap2/vhd/lib/Makefile +1 -1
index 3bf603e..cd2744e 100644
@@ -79,7 +79,7 @@ uninstall:
 	rm -f $(DESTDIR)$(INST-DIR)/libvhd.a
 
 clean:
-	rm -rf *.a *.so* *.o *.opic *~ $(DEPS) $(LIBVHD)
+	rm -rf *.a *.so* *.o *.opic *~ $(DEPS_RM) $(LIBVHD)
 
 distclean: clean
 
tools/console/Makefile +1 -1
index abe77b2..d1fedc6 100644
@@ -19,7 +19,7 @@ all: $(BIN)
 
 .PHONY: clean
 clean:
-	$(RM) *.a *.so *.o *.rpm $(BIN) $(DEPS)
+	$(RM) *.a *.so *.o *.rpm $(BIN) $(DEPS_RM)
 	$(RM) client/*.o daemon/*.o
 	$(RM) client/_paths.h
 	$(RM) daemon/_paths.h
tools/debugger/kdd/Makefile +1 -1
index bcec440a..5509eee 100644
@@ -16,7 +16,7 @@ kdd: $(OBJS)
 
 .PHONY: clean
 clean:
-	rm -f $(OBJS) $(DEPS) kdd
+	rm -f $(OBJS) $(DEPS_RM) kdd
 
 .PHONY: distclean
 distclean: clean
tools/firmware/hvmloader/Makefile +1 -1
index 7d52ed8..1043823 100644
@@ -116,7 +116,7 @@ endif
 .PHONY: clean
 clean: subdirs-clean
 	rm -f roms.inc roms.inc.new acpi.h
-	rm -f hvmloader hvmloader.tmp *.o $(DEPS)
+	rm -f hvmloader hvmloader.tmp *.o $(DEPS_RM)
 	$(MAKE) -C $(ACPI_PATH)  ACPI_BUILD_DIR=$(CURDIR) clean
 
 .PHONY: distclean
tools/firmware/rombios/32bit/Makefile +1 -1
index 28c1544..f6e0fd4 100644
@@ -15,7 +15,7 @@ all: subdirs-all
 
 .PHONY: clean
 clean: subdirs-clean
-	rm -rf *.o $(TARGET) $(DEPS)
+	rm -rf *.o $(TARGET) $(DEPS_RM)
 
 .PHONY: distclean
 distclean: subdirs-distclean
tools/firmware/rombios/32bit/tcgbios/Makefile +1 -1
index 5cff4ef..c5f9004 100644
@@ -12,7 +12,7 @@ all: $(TARGET)
 
 .PHONY: clean
 clean:
-	rm -rf *.o $(TARGET) $(DEPS)
+	rm -rf *.o $(TARGET) $(DEPS_RM)
 
 .PHONY: distclean
 distclean: clean
tools/firmware/rombios/Makefile +1 -1
index 94e65db..2ad165b 100644
@@ -13,7 +13,7 @@ clean: subdirs-clean
 	rm -f  as86-sym.txt ld86-sym.txt 
 	rm -f  rombios*.txt rombios*.sym usage biossums
 	rm -f  BIOS-bochs-*
-	rm -f  $(DEPS)
+	rm -f  $(DEPS_RM)
 
 .PHONY: distclean
 distclean: clean
tools/flask/utils/Makefile +1 -1
index fc047e9..4c0e052 100644
@@ -37,7 +37,7 @@ flask-set-bool: set-bool.o
 clean: 
 	rm -f *.o *.opic *.so
 	rm -f $(CLIENTS)
-	$(RM) $(DEPS)
+	$(RM) $(DEPS_RM)
 
 .PHONY: distclean
 distclean: clean
tools/helpers/Makefile +1 -1
index fcfca46..4f3bbe6 100644
@@ -50,7 +50,7 @@ endif
 
 .PHONY: clean
 clean:
-	$(RM) -f *.o $(PROGS) $(DEPS) _paths.h
+	$(RM) -f *.o $(PROGS) $(DEPS_RM) _paths.h
 
 distclean: clean
 
tools/libfsimage/Rules.mk +1 -1
index ee7de44..4d01098 100644
@@ -29,6 +29,6 @@ $(FSLIB): $(PIC_OBJS)
 	$(CC) $(LDFLAGS) $(SHLIB_LDFLAGS) -o $@ $^ -lfsimage $(FS_LIBDEPS) $(APPEND_LDFLAGS)
 
 clean distclean::
-	rm -f $(PIC_OBJS) $(FSLIB) $(DEPS)
+	rm -f $(PIC_OBJS) $(FSLIB) $(DEPS_RM)
 
 -include $(DEPS)
tools/libs/call/Makefile +1 -1
index bd3d1f0..1ccd5fd 100644
@@ -90,7 +90,7 @@ TAGS:
 
 .PHONY: clean
 clean:
-	rm -rf *.rpm $(LIB) *~ $(DEPS) $(LIB_OBJS) $(PIC_OBJS)
+	rm -rf *.rpm $(LIB) *~ $(DEPS_RM) $(LIB_OBJS) $(PIC_OBJS)
 	rm -f libxencall.so.$(MAJOR).$(MINOR) libxencall.so.$(MAJOR)
 	rm -f headers.chk
 	rm -f xencall.pc
tools/libs/devicemodel/Makefile +1 -1
index e41fd20..f0e1e6c 100644
@@ -91,7 +91,7 @@ TAGS:
 
 .PHONY: clean
 clean:
-	rm -rf *.rpm $(LIB) *~ $(DEPS) $(LIB_OBJS) $(PIC_OBJS)
+	rm -rf *.rpm $(LIB) *~ $(DEPS_RM) $(LIB_OBJS) $(PIC_OBJS)
 	rm -f libxendevicemodel.so.$(MAJOR).$(MINOR) libxendevicemodel.so.$(MAJOR)
 	rm -f headers.chk
 	rm -f xendevicemodel.pc
tools/libs/evtchn/Makefile +1 -1
index c9537ff..5444ec7 100644
@@ -89,7 +89,7 @@ TAGS:
 
 .PHONY: clean
 clean:
-	rm -rf *.rpm $(LIB) *~ $(DEPS) $(LIB_OBJS) $(PIC_OBJS)
+	rm -rf *.rpm $(LIB) *~ $(DEPS_RM) $(LIB_OBJS) $(PIC_OBJS)
 	rm -f libxenevtchn.so.$(MAJOR).$(MINOR) libxenevtchn.so.$(MAJOR)
 	rm -f headers.chk
 	rm -f xenevtchn.pc
tools/libs/foreignmemory/Makefile +1 -1
index b110076..ab7f873 100644
@@ -90,7 +90,7 @@ TAGS:
 
 .PHONY: clean
 clean:
-	rm -rf *.rpm $(LIB) *~ $(DEPS) $(LIB_OBJS) $(PIC_OBJS)
+	rm -rf *.rpm $(LIB) *~ $(DEPS_RM) $(LIB_OBJS) $(PIC_OBJS)
 	rm -f libxenforeignmemory.so.$(MAJOR).$(MINOR) libxenforeignmemory.so.$(MAJOR)
 	rm -f headers.chk
 	rm -f xenforeignmemory.pc
tools/libs/gnttab/Makefile +1 -1
index 3363bd5..afb924f 100644
@@ -92,7 +92,7 @@ TAGS:
 
 .PHONY: clean
 clean:
-	rm -rf *.rpm $(LIB) *~ $(DEPS) $(LIB_OBJS) $(PIC_OBJS)
+	rm -rf *.rpm $(LIB) *~ $(DEPS_RM) $(LIB_OBJS) $(PIC_OBJS)
 	rm -f libxengnttab.so.$(MAJOR).$(MINOR) libxengnttab.so.$(MAJOR)
 	rm -f headers.chk
 	rm -f xengnttab.pc
tools/libs/toollog/Makefile +1 -1
index 01619ec..8aae2c8 100644
@@ -84,7 +84,7 @@ TAGS:
 
 .PHONY: clean
 clean:
-	rm -rf *.rpm $(LIB) *~ $(DEPS) $(LIB_OBJS) $(PIC_OBJS)
+	rm -rf *.rpm $(LIB) *~ $(DEPS_RM) $(LIB_OBJS) $(PIC_OBJS)
 	rm -f libxentoollog.so.$(MAJOR).$(MINOR) libxentoollog.so.$(MAJOR)
 	rm -f headers.chk
 	rm -f xentoollog.pc
tools/libvchan/Makefile +1 -1
index 277c1c0..4a7e018 100644
@@ -81,7 +81,7 @@ uninstall:
 
 .PHONY: clean
 clean:
-	$(RM) -f *.o *.opic *.so* *.a vchan-node1 vchan-node2 $(DEPS)
+	$(RM) -f *.o *.opic *.so* *.a vchan-node1 vchan-node2 $(DEPS_RM)
 	$(RM) -f xenvchan.pc
 
 distclean: clean
tools/libxc/Makefile +1 -1
index 83e3416..9ae80a7 100644
@@ -225,7 +225,7 @@ TAGS:
 
 .PHONY: clean
 clean:
-	rm -rf *.rpm $(LIB) *~ $(DEPS) \
+	rm -rf *.rpm $(LIB) *~ $(DEPS_RM) \
             _paths.h \
 	    xencontrol.pc xenguest.pc \
             $(CTRL_LIB_OBJS) $(CTRL_PIC_OBJS) \
tools/libxl/Makefile +1 -1
index 082af8f..bf48897 100644
@@ -343,7 +343,7 @@ uninstall:
 
 .PHONY: clean
 clean:
-	$(RM) -f _*.h *.o *.so* *.a $(CLIENTS) $(DEPS)
+	$(RM) -f _*.h *.o *.so* *.a $(CLIENTS) $(DEPS_RM)
 	$(RM) -f _*.c *.pyc _paths.*.tmp _*.api-for-check
 	$(RM) -f testidl.c.new testidl.c *.api-ok
 	$(RM) -f xenlight.pc
tools/memshr/Makefile +1 -1
index cb5ea61..6321bdd 100644
@@ -39,7 +39,7 @@ install: all
 uninstall:
 
 clean:
-	rm -rf *.a *.o *~ $(DEPS)
+	rm -rf *.a *.o *~ $(DEPS_RM)
 
 .PHONY: distclean
 distclean: clean
tools/misc/Makefile +1 -1
index 54f6e2e..af579a7 100644
@@ -70,7 +70,7 @@ uninstall:
 
 .PHONY: clean
 clean:
-	$(RM) *.o $(TARGETS_BUILD) *~ $(DEPS)
+	$(RM) *.o $(TARGETS_BUILD) *~ $(DEPS_RM)
 
 .PHONY: distclean
 distclean: clean
tools/pygrub/Makefile +1 -1
index 3a6074b..acdab8a 100644
@@ -33,7 +33,7 @@ uninstall:
 
 .PHONY: clean
 clean:
-	rm -rf build tmp *.pyc *.pyo *.o *.a *~ a.out $(INSTALL_LOG) $(DEPS)
+	rm -rf build tmp *.pyc *.pyo *.o *.a *~ a.out $(INSTALL_LOG) $(DEPS_RM)
 
 .PHONY: distclean
 distclean: clean
tools/python/Makefile +1 -1
index e7a3c51..012358b 100644
@@ -39,7 +39,7 @@ test:
 clean:
 	find . \( -name "*.py[ocd]" -o -name "*~" -o -name "_*.[hc]" \) -delete
 	rm -rf build/
-	rm -f $(DEPS)
+	rm -f $(DEPS_RM)
 
 .PHONY: distclean
 distclean: clean
tools/tests/mem-sharing/Makefile +1 -1
index d89e283..5d46a3b 100644
@@ -18,7 +18,7 @@ build: $(TARGETS)
 
 .PHONY: clean
 clean:
-	$(RM) *.o $(TARGETS) *~ $(DEPS)
+	$(RM) *.o $(TARGETS) *~ $(DEPS_RM)
 
 .PHONY: distclean
 distclean: clean
tools/tests/xen-access/Makefile +1 -1
index e11f639..fc6555c 100644
@@ -20,7 +20,7 @@ build: $(TARGETS)
 
 .PHONY: clean
 clean:
-	$(RM) *.o $(TARGETS) *~ $(DEPS)
+	$(RM) *.o $(TARGETS) *~ $(DEPS_RM)
 
 .PHONY: distclean
 distclean: clean
tools/tests/xenstore/Makefile +1 -1
index 6c85f98..dc53519 100644
@@ -16,7 +16,7 @@ build: $(TARGETS)
 
 .PHONY: clean
 clean:
-	$(RM) *.o $(TARGETS) *~ $(DEPS)
+	$(RM) *.o $(TARGETS) *~ $(DEPS_RM)
 
 .PHONY: distclean
 distclean: clean
tools/xcutils/Makefile +1 -1
index 6bc9062..173182f 100644
@@ -43,7 +43,7 @@ uninstall:
 .PHONY: clean
 clean:
 	$(RM) *.o $(PROGRAMS)
-	$(RM) $(DEPS)
+	$(RM) $(DEPS_RM)
 
 .PHONY: distclean
 distclean: clean
tools/xenbackendd/Makefile +1 -1
index 80ac7f4..36c6c6c 100644
@@ -30,7 +30,7 @@ install: build
 
 .PHONY: clean
 clean:
-	$(RM) *.a *.so *.o $(DEPS) xenbackendd _paths.h
+	$(RM) *.a *.so *.o $(DEPS_RM) xenbackendd _paths.h
 
 .PHONY: distclean
 distclean: clean
tools/xenmon/Makefile +1 -1
index 537c176..b547621 100644
@@ -42,7 +42,7 @@ uninstall:
 
 .PHONY: clean
 clean:
-	$(RM) -f $(DEPS)
+	$(RM) -f $(DEPS_RM)
 	$(RM) -f xenbaked xenbaked.o
 	$(RM) -f xentrace_setmask setmask.o
 
tools/xenpaging/Makefile +1 -1
index ba083ca..7b84c85 100644
@@ -32,7 +32,7 @@ uninstall:
 	rm -f $(addprefix $(DESTDIR)$(LIBEXEC_BIN)/, $(IBINS))
 
 clean:
-	rm -f *.o *~ $(DEPS) xen TAGS $(IBINS) $(LIB)
+	rm -f *.o *~ $(DEPS_RM) xen TAGS $(IBINS) $(LIB)
 
 distclean: clean
 
tools/xenpmd/Makefile +1 -1
index e0d0697..9d677b8 100644
@@ -16,7 +16,7 @@ install: all
 
 .PHONY: clean
 clean:
-	$(RM) -f xenpmd xenpmd.o $(DEPS)
+	$(RM) -f xenpmd xenpmd.o $(DEPS_RM)
 
 .PHONY: distclean
 distclean: clean
tools/xenstat/libxenstat/Makefile +1 -1
index 4b94d81..d6a4268 100644
@@ -178,7 +178,7 @@ endif
 .PHONY: clean
 clean:
 	rm -f $(LIB) $(SHLIB) $(SHLIB_LINKS) $(OBJECTS-y) \
-	      $(BINDINGS) $(BINDINGSRC) $(DEPS) src/_paths.h
+	      $(BINDINGS) $(BINDINGSRC) $(DEPS_RM) src/_paths.h
 	rm -f xenstat.pc
 
 .PHONY: distclean
tools/xenstat/xentop/Makefile +1 -1
index 2e156f1..ca34135 100644
@@ -42,7 +42,7 @@ endif
 
 .PHONY: clean
 clean:
-	rm -f xentop xentop.o $(DEPS)
+	rm -f xentop xentop.o $(DEPS_RM)
 
 .PHONY: distclean
 distclean: clean
tools/xenstore/Makefile +1 -1
index 108c942..a6c8ed1 100644
@@ -132,7 +132,7 @@ clean:
 	rm -f xs_tdb_dump xenstore-control init-xenstore-domain
 	rm -f xenstore $(CLIENTS)
 	rm -f xenstore.pc
-	$(RM) $(DEPS)
+	$(RM) $(DEPS_RM)
 
 .PHONY: distclean
 distclean: clean
tools/xentrace/Makefile +1 -1
index bcd8f5b..67ed076 100644
@@ -44,7 +44,7 @@ endif
 
 .PHONY: clean
 clean:
-	$(RM) *.a *.so *.o *.rpm $(BIN) $(SBIN) $(LIBBIN) $(DEPS)
+	$(RM) *.a *.so *.o *.rpm $(BIN) $(SBIN) $(LIBBIN) $(DEPS_RM)
 
 .PHONY: distclean
 distclean: clean
tools/xl/Makefile +1 -1
index c868899..8aa8e72 100644
@@ -51,7 +51,7 @@ uninstall:
 
 .PHONY: clean
 clean:
-	$(RM) -f *.o xl _paths.h $(DEPS)
+	$(RM) -f *.o xl _paths.h $(DEPS_RM)
 
 distclean: clean
 
xen/Rules.mk +1 -1
index 77bcd44..01aabfe 100644
@@ -166,7 +166,7 @@ FORCE:
 
 .PHONY: clean
 clean:: $(addprefix _clean_, $(subdir-all))
-	rm -f *.o *~ core $(DEPS)
+	rm -f *.o *~ core $(DEPS_RM)
 _clean_%/: FORCE
 	$(MAKE) -f $(BASEDIR)/Rules.mk -C $* clean
 
xen/xsm/flask/Makefile +1 -1
index 898cc20..e22ed7c 100644
@@ -41,4 +41,4 @@ policy.c: policy.bin gen-policy.py
 
 .PHONY: clean
 clean::
-	rm -f $(ALL_H_FILES) *.o $(DEPS) policy.* $(POLICY_SRC)
+	rm -f $(ALL_H_FILES) *.o $(DEPS_RM) policy.* $(POLICY_SRC)
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#13 lore raw

PATCH 3/4 DEPS handling: Use DEPS_INCLUDE everywhere

In reply to Ian Jackson

DEPS_INCLUDE is currently the same as DEPS, so no functional change.

This patch is the result of this perl rune:

git-grep -l 'include.*DEPS' | xargs perl -i -pe 'next unless m/^-?include/; s/\bDEPS\b/DEPS_INCLUDE/'

I have verified that I haven't missed anything, with this rune:

git-grep '\bDEPS\b'

---
 tools/blktap2/control/Makefile                | 2 +-
 tools/blktap2/lvm/Makefile                    | 2 +-
 tools/blktap2/vhd/Makefile                    | 2 +-
 tools/blktap2/vhd/lib/Makefile                | 2 +-
 tools/console/Makefile                        | 2 +-
 tools/firmware/hvmloader/Makefile             | 2 +-
 tools/firmware/rombios/32bit/Makefile         | 2 +-
 tools/firmware/rombios/32bit/tcgbios/Makefile | 2 +-
 tools/firmware/rombios/Makefile               | 2 +-
 tools/flask/utils/Makefile                    | 2 +-
 tools/golang/xenlight/Makefile                | 2 +-
 tools/libacpi/Makefile                        | 2 +-
 tools/libfsimage/Rules.mk                     | 2 +-
 tools/libfsimage/common/Makefile              | 2 +-
 tools/libvchan/Makefile                       | 2 +-
 tools/libxc/Makefile                          | 2 +-
 tools/libxl/Makefile                          | 2 +-
 tools/memshr/Makefile                         | 2 +-
 tools/misc/Makefile                           | 2 +-
 tools/pygrub/Makefile                         | 2 +-
 tools/python/Makefile                         | 2 +-
 tools/tests/mem-sharing/Makefile              | 2 +-
 tools/tests/xen-access/Makefile               | 2 +-
 tools/tests/xenstore/Makefile                 | 2 +-
 tools/xcutils/Makefile                        | 2 +-
 tools/xenbackendd/Makefile                    | 2 +-
 tools/xenmon/Makefile                         | 2 +-
 tools/xenpaging/Makefile                      | 2 +-
 tools/xenpmd/Makefile                         | 2 +-
 tools/xenstat/libxenstat/Makefile             | 2 +-
 tools/xenstat/xentop/Makefile                 | 2 +-
 tools/xenstore/Makefile                       | 2 +-
 tools/xentrace/Makefile                       | 2 +-
 tools/xl/Makefile                             | 2 +-
 xen/Rules.mk                                  | 2 +-
 35 files changed, 35 insertions(+), 35 deletions(-)
tools/blktap2/control/Makefile +1 -1
index 49ec153..1ea5df8 100644
@@ -104,4 +104,4 @@ distclean: clean
 
 .PHONY: all build clean distclean install uninstall
 
--include $(DEPS)
+-include $(DEPS_INCLUDE)
tools/blktap2/lvm/Makefile +1 -1
index 4a2e2b5..9ea6969 100644
@@ -35,4 +35,4 @@ distclean: clean
 
 .PHONY: all build clean distclean install lvm-util uninstall
 
--include $(DEPS)
+-include $(DEPS_INCLUDE)
tools/blktap2/vhd/Makefile +1 -1
index 815d151..9c4ee83 100644
@@ -52,4 +52,4 @@ distclean: clean
 
 .PHONY: all build clean distclean install uninstall vhd-util vhd-update
 
--include $(DEPS)
+-include $(DEPS_INCLUDE)
tools/blktap2/vhd/lib/Makefile +1 -1
index cd2744e..c4e9ec5 100644
@@ -85,4 +85,4 @@ distclean: clean
 
 .PHONY: all build clean distclean install libvhd uninstall
 
--include $(DEPS)
+-include $(DEPS_INCLUDE)
tools/console/Makefile +1 -1
index d1fedc6..c5f3f5c 100644
@@ -54,4 +54,4 @@ uninstall:
 	rm -f $(DESTDIR)$(LIBEXEC_BIN)/xenconsole
 	rm -f $(DESTDIR)$(sbindir)/xenconsoled
 
--include $(DEPS)
+-include $(DEPS_INCLUDE)
tools/firmware/hvmloader/Makefile +1 -1
index 1043823..7c4c0ce 100644
@@ -122,4 +122,4 @@ clean: subdirs-clean
 .PHONY: distclean
 distclean: clean
 
--include $(DEPS)
+-include $(DEPS_INCLUDE)
tools/firmware/rombios/32bit/Makefile +1 -1
index f6e0fd4..c058c71 100644
@@ -32,4 +32,4 @@ $(TARGET): 32bitbios_all.o
 	    exit 11;                                         \
 	  } || :
 
--include $(DEPS)
+-include $(DEPS_INCLUDE)
tools/firmware/rombios/32bit/tcgbios/Makefile +1 -1
index c5f9004..4dbc713 100644
@@ -20,4 +20,4 @@ distclean: clean
 $(TARGET): tcgbios.o tpm_drivers.o
 	$(LD) $(LDFLAGS_DIRECT) -r $^ -o $@
 
--include $(DEPS)
+-include $(DEPS_INCLUDE)
tools/firmware/rombios/Makefile +1 -1
index 2ad165b..78237fd 100644
@@ -31,4 +31,4 @@ BIOS-bochs-latest: rombios.c biossums 32bitgateway.c tcgbios.c
 biossums: biossums.c
 	gcc -o biossums biossums.c
 
--include $(DEPS)
+-include $(DEPS_INCLUDE)
tools/flask/utils/Makefile +1 -1
index 4c0e052..ae87102 100644
@@ -59,4 +59,4 @@ install: all
 uninstall:
 	rm -f $(addprefix $(DESTDIR)$(sbindir)/, $(CLIENTS))
 
--include $(DEPS)
+-include $(DEPS_INCLUDE)
tools/golang/xenlight/Makefile +1 -1
index 88202a6..0987305 100644
@@ -49,4 +49,4 @@ clean:
 .PHONY: distclean
 distclean: clean
 
--include $(DEPS)
+-include $(DEPS_INCLUDE)
tools/libacpi/Makefile +1 -1
index fd7af1b..a47a658 100644
@@ -102,4 +102,4 @@ distclean: clean
 
 install: all
 
--include $(DEPS)
+-include $(DEPS_INCLUDE)
tools/libfsimage/Rules.mk +1 -1
index 4d01098..eab4ecb 100644
@@ -31,4 +31,4 @@ $(FSLIB): $(PIC_OBJS)
 clean distclean::
 	rm -f $(PIC_OBJS) $(FSLIB) $(DEPS_RM)
 
--include $(DEPS)
+-include $(DEPS_INCLUDE)
tools/libfsimage/common/Makefile +1 -1
index af6f67e..0791fc9 100644
@@ -51,5 +51,5 @@ libfsimage.so.$(MAJOR): libfsimage.so.$(MAJOR).$(MINOR)
 libfsimage.so.$(MAJOR).$(MINOR): $(PIC_OBJS)
 	$(CC) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libfsimage.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $^ $(PTHREAD_LIBS) $(APPEND_LDFLAGS)
 
--include $(DEPS)
+-include $(DEPS_INCLUDE)
 
tools/libvchan/Makefile +1 -1
index 4a7e018..ca9fc63 100644
@@ -86,4 +86,4 @@ clean:
 
 distclean: clean
 
--include $(DEPS)
+-include $(DEPS_INCLUDE)
tools/libxc/Makefile +1 -1
index 9ae80a7..9a019e8 100644
@@ -280,5 +280,5 @@ libxenguest.so.$(MAJOR).$(MINOR): COMPRESSION_LIBS = $(filter -l%,$(zlib-options
 libxenguest.so.$(MAJOR).$(MINOR): $(GUEST_PIC_OBJS) libxenctrl.so
 	$(CC) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenguest.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $(GUEST_PIC_OBJS) $(COMPRESSION_LIBS) -lz $(LDLIBS_libxenevtchn) $(LDLIBS_libxenctrl) $(PTHREAD_LIBS) $(APPEND_LDFLAGS)
 
--include $(DEPS)
+-include $(DEPS_INCLUDE)
 
tools/libxl/Makefile +1 -1
index bf48897..74c70ab 100644
@@ -355,4 +355,4 @@ distclean: clean
 realclean: distclean
 	$(RM) -f $(AUTOSRCS) $(AUTOINCS)
 
--include $(DEPS)
+-include $(DEPS_INCLUDE)
tools/memshr/Makefile +1 -1
index 6321bdd..31d2dd7 100644
@@ -46,4 +46,4 @@ distclean: clean
 
 .PHONY: all build clean install distclean uninstall
 
--include $(DEPS)
+-include $(DEPS_INCLUDE)
tools/misc/Makefile +1 -1
index af579a7..eaa2879 100644
@@ -118,4 +118,4 @@ xen-lowmemd: xen-lowmemd.o
 xencov: xencov.o
 	$(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl) $(APPEND_LDFLAGS)
 
--include $(DEPS)
+-include $(DEPS_INCLUDE)
tools/pygrub/Makefile +1 -1
index acdab8a..536af07 100644
@@ -38,4 +38,4 @@ clean:
 .PHONY: distclean
 distclean: clean
 
--include $(DEPS)
+-include $(DEPS_INCLUDE)
tools/python/Makefile +1 -1
index 012358b..541858e 100644
@@ -44,4 +44,4 @@ clean:
 .PHONY: distclean
 distclean: clean
 
--include $(DEPS)
+-include $(DEPS_INCLUDE)
tools/tests/mem-sharing/Makefile +1 -1
index 5d46a3b..497696f 100644
@@ -26,4 +26,4 @@ distclean: clean
 memshrtool: memshrtool.o
 	$(CC) -o $@ $< $(LDFLAGS) $(LDLIBS_libxenctrl)
 
--include $(DEPS)
+-include $(DEPS_INCLUDE)
tools/tests/xen-access/Makefile +1 -1
index fc6555c..0ca3f6f 100644
@@ -28,4 +28,4 @@ distclean: clean
 xen-access: xen-access.o Makefile
 	$(CC) -o $@ $< $(LDFLAGS) $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest) $(LDLIBS_libxenevtchn)
 
--include $(DEPS)
+-include $(DEPS_INCLUDE)
tools/tests/xenstore/Makefile +1 -1
index dc53519..b37b90d 100644
@@ -24,4 +24,4 @@ distclean: clean
 xs-test: xs-test.o Makefile
 	$(CC) -o $@ $< $(LDFLAGS) $(LDLIBS_libxenstore)
 
--include $(DEPS)
+-include $(DEPS_INCLUDE)
tools/xcutils/Makefile +1 -1
index 173182f..2811893 100644
@@ -48,4 +48,4 @@ clean:
 .PHONY: distclean
 distclean: clean
 
--include $(DEPS)
+-include $(DEPS_INCLUDE)
tools/xenbackendd/Makefile +1 -1
index 36c6c6c..ba53bbf 100644
@@ -42,4 +42,4 @@ xenbackendd: xenbackendd.o
 genpath-target = $(call buildmakevars2header,_paths.h)
 $(eval $(genpath-target))
 
--include $(DEPS)
+-include $(DEPS_INCLUDE)
tools/xenmon/Makefile +1 -1
index b547621..e45c5b8 100644
@@ -55,4 +55,4 @@ xenbaked: xenbaked.o Makefile
 xentrace_setmask: setmask.o Makefile
 	$(CC) $(LDFLAGS) $< -o $@ $(LDLIBS) $(APPEND_LDFLAGS)
 
--include $(DEPS)
+-include $(DEPS_INCLUDE)
tools/xenpaging/Makefile +1 -1
index 7b84c85..968678c 100644
@@ -42,4 +42,4 @@ distclean: clean
 TAGS:
 	etags -t $(SRCS) *.h
 
--include $(DEPS)
+-include $(DEPS_INCLUDE)
tools/xenpmd/Makefile +1 -1
index 9d677b8..e0d3f06 100644
@@ -28,4 +28,4 @@ uninstall:
 xenpmd: xenpmd.o Makefile
 	$(CC) $(LDFLAGS) $< -o $@ $(LDLIBS) $(APPEND_LDFLAGS)
 
--include $(DEPS)
+-include $(DEPS_INCLUDE)
tools/xenstat/libxenstat/Makefile +1 -1
index d6a4268..8979fa1 100644
@@ -184,7 +184,7 @@ clean:
 .PHONY: distclean
 distclean: clean
 
--include $(DEPS)
+-include $(DEPS_INCLUDE)
 
 genpath-target = $(call buildmakevars2header,src/_paths.h)
 $(eval $(genpath-target))
tools/xenstat/xentop/Makefile +1 -1
index ca34135..ec612db 100644
@@ -47,4 +47,4 @@ clean:
 .PHONY: distclean
 distclean: clean
 
--include $(DEPS)
+-include $(DEPS_INCLUDE)
tools/xenstore/Makefile +1 -1
index a6c8ed1..ff428e2 100644
@@ -211,7 +211,7 @@ clients-install: clients
 		ln -f $(DESTDIR)$(bindir)/xenstore $(DESTDIR)$(bindir)/$${c} ; \
 	done
 
--include $(DEPS)
+-include $(DEPS_INCLUDE)
 
 # never delete any intermediate files.
 .SECONDARY:
tools/xentrace/Makefile +1 -1
index 67ed076..0bad942 100644
@@ -61,5 +61,5 @@ xentrace_setsize: setsize.o
 xenalyze: xenalyze.o mread.o
 	$(CC) $(LDFLAGS) -o $@ $^ $(ARGP_LDFLAGS) $(APPEND_LDFLAGS)
 
--include $(DEPS)
+-include $(DEPS_INCLUDE)
 
tools/xl/Makefile +1 -1
index 8aa8e72..bafd5a8 100644
@@ -56,4 +56,4 @@ clean:
 distclean: clean
 
 
--include $(DEPS)
+-include $(DEPS_INCLUDE)
xen/Rules.mk +1 -1
index 01aabfe..cafc67b 100644
@@ -204,4 +204,4 @@ $(filter %.init.o,$(obj-y) $(obj-bin-y) $(extra-y)): %.init.o: %.o Makefile
 %.s: %.S Makefile
 	$(CPP) $(AFLAGS) $< -o $@
 
--include $(DEPS)
+-include $(DEPS_INCLUDE)
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#14 lore raw

PATCH 4/4 DEPS handling: Remove absolute paths from references to cwd

In reply to Ian Jackson

In some directories we use gcc on source files elsewhere, to generate a .o here in the current directory. Eg in tools/libxl/,
gcc -I -o build.o /path/to/libacpi/build.c
We pass -MMD and -MF options to generate a .d file right here.

In the general case this .c file might need to include things from the directory here, eg libacpi/build.c eventually #includes various *libxl*.h. We pass gcc -I. for this, which means things from the cwd where we invoked gcc, not the directory of the #including file.

When we do this, gcc's -MMD output mentions /path/to/libxl/*libxl*.h, even though it could refer to simply *libxl*.h. This is presumably because gcc has noticed that `.' in this context must mean relative to the invocation cwd, not relative to build.c, and gcc doesn't realise that references in the .d file are also wrt the invocation cwd.

make distinguishes targets purely textually. It will canonicalise a target name by removing ./ before comparison (so _libxl_types.h and ./_libxl_types.h are considered the same target) but it won't examine the filesystem. So _libxl_types.h and /path/to/tools/libxl/_libxl_types.h are different targets.

And, _libxl_types.h is generated from a pattern rule. This pattern rule is therefore instatiated twice, and the two instances may be run concurrently - but use the same tempfiles and can therefore fail.

The thing that is wrong here is gcc's choice to output an absolute path.

We could work around it by adding a rule to teach make about a relationship between these `two different files'. But this has to be done for every autogenerated file and is therefore fragile (leaving a race bug when we get it wrong).

Ideally we would fix the problem by fixing the .d file as it is generated. But the .d files are generated by many many rules mentioning $(CC) and $(CFLAGS). (We might in theory pass a bash process substitution to -MF, but 1. that's not portable to people who don't have bash and 2. it hangs, anyway.)

So instead we do this conversion at include time. That is, we tell make to include not the raw .d files, but the sedded ones.

The sedding removes occurrences of ` $PWD/'. We use the shell variable PWD because the make variable sometimes refers to the xen toplevel. If gcc's output format should change, then this sed rune may not work any more, but that doesn't seem very likely.

The rune is only effective for dependencies on files which are exactly in the current directory, or a subdirectory of it named simply by its subdirectory name. If there are autogenerated include files which exist in a sibling (or worse, somewhere completely else), this approach will not work, because we'd have to figure out what name this Makefile usually uses to refer to them. Hopefully such things don't exist.

The indirect variables DEPS_RM and DEPS_INCLUDE are necessary to preserve the assumptions made in the various Makefiles. Specifically, xen/ Makefiles assume that it is ok to say DEPS+=something (where something is in a subdirectory); tools/ Makefiles all used to include DEPS themselves (but now they include DEPS_INCLUDE); and many Makefiles tended to explictly rm DEPS (but now rm DEPS_RM).

In the new scheme of things: DEPS is the files that come out of gcc (or perhaps an assembler or something) and may be assigned to by Makefiles. DEPS_INCLUDE is the processed form. And DEPS_RM is both combined, so that they both get cleaned.

We need to explicitly use $(wildcard ) to do the wildcard expansion on DEPS a bit earlier. If we didn't, then DEPS_INCLUDE would contain `.*.d2' which would not exist.

Evaluation order: DEPS_RM and DEPS_INCLUDE are recursively expanded variables, so that although they are defined early (in Config.mk), their actual values are computed at the time of use, using the value of DEPS that is prevailing at that time.

---
 .gitignore | 2 ++
 Config.mk  | 7 +++++--
 2 files changed, 7 insertions(+), 2 deletions(-)
.gitignore +2 -0
index 594ffd9..ecb198f 100644
@@ -1,9 +1,11 @@
 .hg
+.*.tmp
 *.orig
 *~
 *.swp
 *.o
 *.d
+*.d2
 *.opic
 *.a
 *.so
Config.mk +5 -2
index 5aca4bf..bba81be 100644
@@ -56,8 +56,11 @@ HOSTCC ?= clang
 HOSTCXX ?= clang++
 endif
 
-DEPS_RM = $(DEPS)
-DEPS_INCLUDE = $(DEPS)
+DEPS_INCLUDE = $(addsuffix .d2, $(basename $(wildcard $(DEPS))))
+DEPS_RM = $(DEPS) $(DEPS_INCLUDE)
+
+%.d2: %.d
+	sed "s! $$PWD/! !" $^ >[email protected] && mv -f [email protected] $@
 
 include $(XEN_ROOT)/config/$(XEN_OS).mk
 include $(XEN_ROOT)/config/$(XEN_TARGET_ARCH).mk
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
author Acked-by on v1 4/4
#15 lore raw

Re: [PATCH 4/4] DEPS handling: Remove absolute paths from references to cwd

Quoted 73 lines
Quoted 1 line
Quoted 1 line · On 04.09.17 at 18:46, <[email protected]> wrote:

In some directories we use gcc on source files elsewhere, to generate a .o here in the current directory. Eg in tools/libxl/,
gcc -I -o build.o /path/to/libacpi/build.c
We pass -MMD and -MF options to generate a .d file right here.

In the general case this .c file might need to include things from the directory here, eg libacpi/build.c eventually #includes various *libxl*.h. We pass gcc -I. for this, which means things from the cwd where we invoked gcc, not the directory of the #including file.

When we do this, gcc's -MMD output mentions /path/to/libxl/*libxl*.h, even though it could refer to simply *libxl*.h. This is presumably because gcc has noticed that `.' in this context must mean relative to the invocation cwd, not relative to build.c, and gcc doesn't realise that references in the .d file are also wrt the invocation cwd.

make distinguishes targets purely textually. It will canonicalise a target name by removing ./ before comparison (so _libxl_types.h and ./_libxl_types.h are considered the same target) but it won't examine the filesystem. So _libxl_types.h and /path/to/tools/libxl/_libxl_types.h are different targets.

And, _libxl_types.h is generated from a pattern rule. This pattern rule is therefore instatiated twice, and the two instances may be run concurrently - but use the same tempfiles and can therefore fail.

The thing that is wrong here is gcc's choice to output an absolute path.

We could work around it by adding a rule to teach make about a relationship between these `two different files'. But this has to be done for every autogenerated file and is therefore fragile (leaving a race bug when we get it wrong).

Ideally we would fix the problem by fixing the .d file as it is generated. But the .d files are generated by many many rules mentioning $(CC) and $(CFLAGS). (We might in theory pass a bash process substitution to -MF, but 1. that's not portable to people who don't have bash and 2. it hangs, anyway.)

So instead we do this conversion at include time. That is, we tell make to include not the raw .d files, but the sedded ones.

The sedding removes occurrences of ` $PWD/'. We use the shell variable PWD because the make variable sometimes refers to the xen toplevel. If gcc's output format should change, then this sed rune may not work any more, but that doesn't seem very likely.

The rune is only effective for dependencies on files which are exactly in the current directory, or a subdirectory of it named simply by its subdirectory name. If there are autogenerated include files which exist in a sibling (or worse, somewhere completely else), this approach will not work, because we'd have to figure out what name this Makefile usually uses to refer to them. Hopefully such things don't exist.

The indirect variables DEPS_RM and DEPS_INCLUDE are necessary to preserve the assumptions made in the various Makefiles. Specifically, xen/ Makefiles assume that it is ok to say DEPS+=something (where something is in a subdirectory); tools/ Makefiles all used to include DEPS themselves (but now they include DEPS_INCLUDE); and many Makefiles tended to explictly rm DEPS (but now rm DEPS_RM).

In the new scheme of things: DEPS is the files that come out of gcc (or perhaps an assembler or something) and may be assigned to by Makefiles. DEPS_INCLUDE is the processed form. And DEPS_RM is both combined, so that they both get cleaned.

We need to explicitly use $(wildcard ) to do the wildcard expansion on DEPS a bit earlier. If we didn't, then DEPS_INCLUDE would contain `.*.d2' which would not exist.

Quoted 8 lines

Evaluation order: DEPS_RM and DEPS_INCLUDE are recursively expanded variables, so that although they are defined early (in Config.mk), their actual values are computed at the time of use, using the value of DEPS that is prevailing at that time.

(also extending to the non-tools parts of patches 1-3) with one question:

Config.mk HOSTCC ?= clang · line 62

Quoted 12 lines
Config.mk +4 -2
@@ -56,8 +56,11 @@ HOSTCC ?= clang
 HOSTCXX ?= clang++
 endif
 
-DEPS_RM = $(DEPS)
-DEPS_INCLUDE = $(DEPS)
+DEPS_INCLUDE = $(addsuffix .d2, $(basename $(wildcard $(DEPS))))
+DEPS_RM = $(DEPS) $(DEPS_INCLUDE)
+
+%.d2: %.d

Wouldn't it be better to use .%.d2 and .%.d here?

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#16 lore raw

Re: [PATCH 4/4] DEPS handling: Remove absolute paths from references to cwd

Jan Beulich writes ("Re: [PATCH 4/4] DEPS handling: Remove absolute paths from references to cwd"):

Quoted 4 lines · On 04.09.17 at 18:46, <[email protected]> wrote:
Quoted 1 line

+%.d2: %.d

Wouldn't it be better to use .%.d2 and .%.d here?

Perhaps. That makes the assumption that nothing anywhere adds anything to DEPS which does not match `.*.d'

My formulation makes a smaller assumption about DEPS (nothing adds anything not ending with .d) but a larger assumption about .d (there are no Makefile pattern targets which use .d for other purposes).

I think the 2nd assumption is reasonable and the expanded 1st assumption is questionable.

Ian.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#17 lore raw

Re: [PATCH 4/4] DEPS handling: Remove absolute paths from references to cwd

Quoted 11 lines
Quoted 1 line
Quoted 1 line · On 05.09.17 at 17:32, <[email protected]> wrote:

Jan Beulich writes ("Re: [PATCH 4/4] DEPS handling: Remove absolute paths from references to cwd"):

Quoted 4 lines · On 04.09.17 at 18:46, <[email protected]> wrote:
Quoted 1 line

+%.d2: %.d

Wouldn't it be better to use .%.d2 and .%.d here?

Perhaps. That makes the assumption that nothing anywhere adds anything to DEPS which does not match `.*.d'

Quoted 6 lines

My formulation makes a smaller assumption about DEPS (nothing adds anything not ending with .d) but a larger assumption about .d (there are no Makefile pattern targets which use .d for other purposes).

I think the 2nd assumption is reasonable and the expanded 1st assumption is questionable.

Well, these dependency files start with a dot for a reason. Plus my consideration on *.d (without leading dot) was that this may have a conventional use for D language source files (but that's a guess, nothing I know). Anyway, as expressed I'm not meaning to insist on the change, just put it out for consideration.

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel