Use -MMD -MF in tools/* rather than -Wp,-M...
PATCH 1/1 Use -MMD -MF in tools/* rather than -Wp,-M...
If you use -MMD -MF then the correct .o filename is written to the .*.d file as the compiler driver arranges everything. This was done in 19010:275abe1c5d24 for the hypervisor.
In this patch we do the same elsewhere in the xen-unstable tree, particularly tools/. Specifically:
* Change tools/Rules.mk to add -MMD -MF ... to CFLAGS and set DEPS.
* Remove -Wp,-MD... from every other Makefile
* Remove setting of DEPS from every other Makefile
* Ensure that every Makefile says -include $(DEPS)
* Ensure that every Makefile's clean target removes $(DEPS)
Some Makefiles were already halfway there, but often for a different variable name eg PROG_DEP. The variable name is now standardised in Rules.mk as DEPS.
I have done a test build with this change, on Debian etch.
tools/Rules.mk +4 -1
@@ -29,6 +29,10 @@ X11_LDPATH = -L/usr/X11R6/$(LIBLEAFDIR) CFLAGS += -D__XEN_TOOLS__ +# Get gcc to generate the dependencies for us. +CFLAGS += -MMD -MF .$(@F).d +DEPS = .*.d + # Enable implicit LFS support *and* explicit LFS names. CFLAGS += $(shell getconf LFS_CFLAGS) CFLAGS += -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
@@ -59,4 +63,3 @@ subdirs-all subdirs-clean subdirs-instal subdir-all-% subdir-clean-% subdir-install-%: .phony $(MAKE) -C $* $(patsubst subdir-%-$*,%,$@) -
tools/blktap/drivers/Makefile +0 -4
@@ -12,10 +12,6 @@ CFLAGS += $(CFLAGS_libxenstore) CFLAGS += $(CFLAGS_libxenstore) CFLAGS += -I $(LIBAIO_DIR) CFLAGS += -D_GNU_SOURCE - -# Get gcc to generate the dependencies for us. -CFLAGS += -Wp,-MD,.$(@F).d -DEPS = .*.d ifeq ($(shell . ./check_gcrypt),"yes") CFLAGS += -DUSE_GCRYPT
tools/console/Makefile +3 -1
@@ -16,7 +16,7 @@ all: $(BIN) .PHONY: clean clean: - $(RM) *.a *.so *.o *.rpm $(BIN) + $(RM) *.a *.so *.o *.rpm $(BIN) $(DEPS) $(RM) client/*.o daemon/*.o xenconsoled: $(patsubst %.c,%.o,$(wildcard daemon/*.c))
@@ -33,3 +33,5 @@ install: $(BIN) $(INSTALL_PROG) xenconsoled $(DESTDIR)/$(SBINDIR) $(INSTALL_DIR) $(DESTDIR)$(PRIVATE_BINDIR) $(INSTALL_PROG) xenconsole $(DESTDIR)$(PRIVATE_BINDIR) + +-include $(DEPS)
tools/firmware/hvmloader/Makefile +3 -1
@@ -58,4 +58,6 @@ roms.h: ../rombios/BIOS-bochs-latest ../ .PHONY: clean clean: subdirs-clean rm -f roms.h acpi.h - rm -f hvmloader hvmloader.tmp *.o + rm -f hvmloader hvmloader.tmp *.o $(DEPS) + +-include $(DEPS)
tools/firmware/hvmloader/acpi/Makefile +3 -1
@@ -63,6 +63,8 @@ acpi.a: $(OBJS) $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $< clean: - rm -rf *.a *.o $(IASL_VER) $(IASL_VER).tar.gz + rm -rf *.a *.o $(IASL_VER) $(IASL_VER).tar.gz $(DEPS) install: all + +-include $(DEPS)
tools/firmware/rombios/32bit/Makefile +3 -1
@@ -16,7 +16,7 @@ all: subdirs-all .PHONY: clean clean: subdirs-clean - rm -rf *.o $(TARGET) + rm -rf *.o $(TARGET) $(DEPS) $(TARGET): 32bitbios.o $(MODULES) util.o $(LD) $(LDFLAGS_DIRECT) -s -r $^ -o 32bitbios_all.o
@@ -27,3 +27,5 @@ clean: subdirs-clean exit 11; \ } || : sh mkhex highbios_array 32bitbios_all.o > $@ + +-include $(DEPS)
tools/firmware/rombios/32bit/tcgbios/Makefile +4 -1
@@ -12,7 +12,10 @@ all: $(TARGET) all: $(TARGET) clean: - rm -rf *.o $(TARGET) + rm -rf *.o $(TARGET) $(DEPS) $(TARGET): $(OBJECTS) $(LD) $(LDFLAGS_DIRECT) -r $^ -o $@ + +-include $(DEPS) +
tools/firmware/rombios/Makefile +2 -0
@@ -13,6 +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) BIOS-bochs-latest: rombios.c biossums 32bitgateway.c tcgbios.c gcc -DBX_SMP_PROCESSORS=1 -E -P $< > _rombios_.c
@@ -27,3 +28,4 @@ biossums: biossums.c biossums: biossums.c gcc -o biossums biossums.c +-include $(DEPS)
tools/flask/libflask/Makefile +0 -1
@@ -16,7 +16,6 @@ CFLAGS += $(INCLUDES) -I./include -I$( # Get gcc to generate the dependencies for us. CFLAGS += -Wp,-MD,.$(@F).d LDFLAGS += -L. -DEPS = .*.d LIB_OBJS := $(patsubst %.c,%.o,$(SRCS)) PIC_OBJS := $(patsubst %.c,%.opic,$(SRCS))
tools/flask/loadpolicy/Makefile +2 -5
@@ -7,9 +7,6 @@ LIBFLASK_ROOT = $(XEN_ROOT)/tools/flask/ PROFILE=#-pg BASECFLAGS=-Wall -g -Werror -# Make gcc generate dependencies. -BASECFLAGS += -Wp,-MD,.$(@F).d -PROG_DEP = .*.d BASECFLAGS+= $(PROFILE) #BASECFLAGS+= -I$(XEN_ROOT)/tools BASECFLAGS+= $(CFLAGS_libxenctrl)
@@ -39,7 +36,7 @@ clean: clean: rm -f *.o *.opic *.so rm -f $(CLIENTS) - $(RM) $(PROG_DEP) + $(RM) $(DEPS) .PHONY: print-dir print-dir:
@@ -54,7 +51,7 @@ install: all $(INSTALL_DIR) $(DESTDIR)$(SBINDIR) $(INSTALL_PROG) $(CLIENTS) $(DESTDIR)$(SBINDIR) --include $(PROG_DEP) +-include $(DEPS) # never delete any intermediate files. .SECONDARY:
tools/fs-back/Makefile +0 -4
@@ -12,10 +12,6 @@ CFLAGS += $(CFLAGS_libxenstore) CFLAGS += $(CFLAGS_libxenstore) CFLAGS += $(INCLUDES) -I. CFLAGS += -D_GNU_SOURCE - -# Get gcc to generate the dependencies for us. -CFLAGS += -Wp,-MD,.$(@F).d -DEPS = .*.d LIBS := -L. -L.. -L../lib LIBS += $(LDFLAGS_libxenctrl)
tools/libfsimage/Rules.mk +1 -3
@@ -1,8 +1,6 @@ include $(XEN_ROOT)/tools/Rules.mk include $(XEN_ROOT)/tools/Rules.mk -DEPS = .*.d - -CFLAGS += -I$(XEN_ROOT)/tools/libfsimage/common/ -Werror -Wp,-MD,.$(@F).d +CFLAGS += -I$(XEN_ROOT)/tools/libfsimage/common/ -Werror LDFLAGS += -L../common/ PIC_OBJS := $(patsubst %.c,%.opic,$(LIB_SRCS-y))
tools/libfsimage/common/Makefile +0 -3
@@ -3,9 +3,6 @@ include $(XEN_ROOT)/tools/Rules.mk MAJOR = 1.0 MINOR = 0 - -CFLAGS += -Werror -Wp,-MD,.$(@F).d -DEPS = .*.d LDFLAGS-$(CONFIG_SunOS) = -Wl,-M -Wl,mapfile-SunOS LDFLAGS-$(CONFIG_Linux) = -Wl,mapfile-GNU
tools/libxc/Makefile +0 -3
@@ -62,10 +62,7 @@ CFLAGS-$(CONFIG_Linux) += -D_GNU_SOURCE # libraries. #CFLAGS += -DVALGRIND -O0 -ggdb3 -# Get gcc to generate the dependencies for us. -CFLAGS += -Wp,-MD,.$(@F).d LDFLAGS += -L. -DEPS = .*.d CTRL_LIB_OBJS := $(patsubst %.c,%.o,$(CTRL_SRCS-y)) CTRL_PIC_OBJS := $(patsubst %.c,%.opic,$(CTRL_SRCS-y))
tools/misc/Makefile +3 -1
@@ -47,7 +47,7 @@ install: build .PHONY: clean clean: - $(RM) *.o $(TARGETS) *~ + $(RM) *.o $(TARGETS) *~ $(DEPS) set -e; for d in $(SUBDIRS); do $(MAKE) -C $$d clean; done %.o: %.c $(HDRS) Makefile
@@ -55,3 +55,5 @@ clean: xenperf xenpm: %: %.o Makefile $(CC) $(CFLAGS) -o $@ $< $(LDFLAGS) $(LDFLAGS_libxenctrl) + +-include $(DEPS)
tools/pygrub/Makefile +3 -1
@@ -22,4 +22,6 @@ endif .PHONY: clean clean: - rm -rf build tmp *.pyc *.pyo *.o *.a *~ a.out + rm -rf build tmp *.pyc *.pyo *.o *.a *~ a.out $(DEPS) + +-include $(DEPS)
tools/python/Makefile +3 -0
@@ -85,3 +85,6 @@ test: .PHONY: clean clean: rm -rf build *.pyc *.pyo *.o *.a *~ $(CATALOGS) xen/util/auxbin.pyc + rm -f $(DEPS) + +-include $(DEPS)
tools/vnet/libxutil/Makefile +0 -4
@@ -27,10 +27,6 @@ CFLAGS += -Werror -fno-strict-aliasing CFLAGS += -Werror -fno-strict-aliasing $(call cc-option,$(CC),-fgnu89-inline,) CFLAGS += -O3 #CFLAGS += -g - -# Get gcc to generate the dependencies for us. -CFLAGS += -Wp,-MD,.$(@F).d -DEPS = .*.d MAJOR := 3.0 MINOR := 0
tools/vtpm/Rules.mk +1 -6
@@ -11,11 +11,6 @@ TOOLS_INSTALL_DIR = $(DESTDIR)/usr/bin # General compiler flags CFLAGS = -Werror -g3 -I. -# For generating dependencies -CFLAGS += -Wp,-MD,.$(@F).d - -DEP_FILES = .*.d - # Generic project files HDRS = $(wildcard *.h) SRCS = $(wildcard *.c)
@@ -26,7 +21,7 @@ OBJS = $(patsubst %.c,%.o,$(SRCS)) $(OBJS): $(SRCS) --include $(DEP_FILES) +-include $(DEPS) BUILD_EMULATOR = y
tools/vtpm_manager/Rules.mk +1 -6
@@ -11,11 +11,6 @@ TOOLS_INSTALL_DIR = $(DESTDIR)/usr/bin # General compiler flags CFLAGS = -Werror -g3 -I. -# For generating dependencies -CFLAGS += -Wp,-MD,.$(@F).d - -DEP_FILES = .*.d - # Generic project files HDRS = $(wildcard *.h) SRCS = $(wildcard *.c)
@@ -26,7 +21,7 @@ OBJS = $(patsubst %.c,%.o,$(SRCS)) $(OBJS): $(SRCS) --include $(DEP_FILES) +-include $(FILES) # Make sure these are just rules .PHONY : all build install clean
tools/xcutils/Makefile +2 -6
@@ -13,10 +13,6 @@ include $(XEN_ROOT)/tools/Rules.mk CFLAGS += -Werror CFLAGS += $(CFLAGS_libxenctrl) $(CFLAGS_libxenguest) $(CFLAGS_libxenstore) - -# Make gcc generate dependencies. -CFLAGS += -Wp,-MD,.$(@F).d -PROG_DEP = .*.d PROGRAMS = xc_restore xc_save readnotes lsevtchn
@@ -40,6 +36,6 @@ install: build .PHONY: clean clean: $(RM) *.o $(PROGRAMS) - $(RM) $(PROG_DEP) + $(RM) $(DEPS) --include $(PROG_DEP) +-include $(DEPS)
tools/xenmon/Makefile +3 -1
@@ -38,10 +38,12 @@ install: build .PHONY: clean clean: - rm -f $(BIN) + rm -f $(BIN) $(DEPS) %: %.c Makefile $(CC) $(CFLAGS) $< $(LDFLAGS) -o $@ xentrace_%: %.c Makefile $(CC) $(CFLAGS) $< $(LDFLAGS) -o $@ + +-include $(DEPS)
tools/xenpmd/Makefile +3 -1
@@ -17,4 +17,6 @@ install: all .PHONY: clean clean: - $(RM) -f $(BIN) + $(RM) -f $(BIN) $(DEPS) + +-include $(DEPS)
tools/xenstat/libxenstat/Makefile +3 -1
@@ -155,4 +155,6 @@ endif .PHONY: clean clean: rm -f $(LIB) $(SHLIB) $(SHLIB_LINKS) $(OBJECTS-y) \ - $(BINDINGS) $(BINDINGSRC) + $(BINDINGS) $(BINDINGSRC) $(DEPS) + +-include $(DEPS)
tools/xenstat/xentop/Makefile +3 -1
@@ -37,4 +37,6 @@ endif .PHONY: clean clean: - rm -f xentop xentop.o + rm -f xentop xentop.o $(DEPS) + +-include $(DEPS)
tools/xenstore/Makefile +2 -6
@@ -7,10 +7,6 @@ CFLAGS += -Werror CFLAGS += -Werror CFLAGS += -I. CFLAGS += $(CFLAGS_libxenctrl) - -# Make gcc generate dependencies. -CFLAGS += -Wp,-MD,.$(@F).d -DEP = .*.d CLIENTS := xenstore-exists xenstore-list xenstore-read xenstore-rm xenstore-chmod CLIENTS += xenstore-write xenstore-ls
@@ -82,7 +78,7 @@ clean: rm -f xenstored xs_random xs_stress xs_crashme rm -f xs_tdb_dump xenstore-control rm -f xenstore $(CLIENTS) - $(RM) $(DEP) + $(RM) $(DEPS) .PHONY: TAGS TAGS:
@@ -113,7 +109,7 @@ install: all $(INSTALL_DATA) xs.h $(DESTDIR)$(INCLUDEDIR) $(INSTALL_DATA) xs_lib.h $(DESTDIR)$(INCLUDEDIR) --include $(DEP) +-include $(DEPS) # never delete any intermediate files. .SECONDARY:
tools/xentrace/Makefile +4 -1
@@ -46,9 +46,12 @@ install: build .PHONY: clean clean: - $(RM) *.a *.so *.o *.rpm $(BIN) $(LIBBIN) + $(RM) *.a *.so *.o *.rpm $(BIN) $(LIBBIN) $(DEPS) %: %.c $(HDRS) Makefile $(CC) $(CFLAGS) -o $@ $< $(LDFLAGS) xentrace_%: %.c $(HDRS) Makefile $(CC) $(CFLAGS) -o $@ $< $(LDFLAGS) + +-include $(DEPS) +
xen/arch/ia64/tools/p2m_foreign/Makefile +0 -4
@@ -24,10 +24,6 @@ CFLAGS += -Werror -ggdb3 CFLAGS += -Werror -ggdb3 CFLAGS += -I$(XEN_LIBXC) -I$(XEN_XENSTORE) -# Make gcc generate dependencies. -CFLAGS += -Wp,-MD,.$(@F).d -DEPS = .*.d - PROGRAMS = p2m_foreign LDLIBS = -L$(XEN_LIBXC) -L$(XEN_XENSTORE) -lxenguest -lxenctrl
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel