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.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
This commit is contained in:
Keir Fraser committed 2009-01-12 10:16:05 +00:00
1 parent ceff4bb8a3
commit 9f8501582f
28 files changed
+56 -68

No files matched your search

+4 -1
View File
@@ -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-install: .phony
subdir-all-% subdir-clean-% subdir-install-%: .phony
$(MAKE) -C $* $(patsubst subdir-%-$*,%,$@)
-4
View File
@@ -13,10 +13,6 @@ 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
CRYPT_LIB := -lgcrypt
+3 -1
View File
@@ -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)
+3 -1
View File
@@ -58,4 +58,6 @@ roms.h: ../rombios/BIOS-bochs-latest ../vgabios/VGABIOS-lgpl-latest.bin \
.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)
+3 -1
View File
@@ -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)
+3 -1
View File
@@ -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 @@ $(TARGET): 32bitbios.o $(MODULES) util.o
exit 11; \
} || :
sh mkhex highbios_array 32bitbios_all.o > $@
-include $(DEPS)
@@ -12,7 +12,10 @@ CFLAGS += $(CFLAGS_include) -I.. -I../.. -DGCC_PROTOS
all: $(TARGET)
clean:
rm -rf *.o $(TARGET)
rm -rf *.o $(TARGET) $(DEPS)
$(TARGET): $(OBJECTS)
$(LD) $(LDFLAGS_DIRECT) -r $^ -o $@
-include $(DEPS)
+2
View File
@@ -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 @@ BIOS-bochs-latest: rombios.c biossums 32bitgateway.c tcgbios.c
biossums: biossums.c
gcc -o biossums biossums.c
-include $(DEPS)
-1
View File
@@ -16,7 +16,6 @@ CFLAGS += $(INCLUDES) -I./include -I$(XEN_LIBXC) -I$(XEN_INCLUDE)
# 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))
+2 -5
View File
@@ -7,9 +7,6 @@ LIBFLASK_ROOT = $(XEN_ROOT)/tools/flask/libflask
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 @@ $(CLIENTS_OBJS): $(CLIENTS_SRCS)
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:
-4
View File
@@ -13,10 +13,6 @@ 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)
LIBS += $(LDFLAGS_libxenstore)
+1 -3
View File
@@ -1,8 +1,6 @@
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))
-3
View File
@@ -4,9 +4,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
LDFLAGS = $(LDFLAGS-y)
-3
View File
@@ -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))
+3 -1
View File
@@ -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)
+3 -1
View File
@@ -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)
+3
View File
@@ -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)
-4
View File
@@ -28,10 +28,6 @@ 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
LIB := libxutil.so
+1 -6
View File
@@ -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 @@ $(SRCS): Makefile $(XEN_ROOT)/tools/Rules.mk $(XEN_ROOT)/tools/vtpm/Rules.mk
$(OBJS): $(SRCS)
-include $(DEP_FILES)
-include $(DEPS)
BUILD_EMULATOR = y
+1 -6
View File
@@ -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 @@ $(SRCS): Makefile $(XEN_ROOT)/tools/Rules.mk $(XEN_ROOT)/tools/vtpm_manager/Rule
$(OBJS): $(SRCS)
-include $(DEP_FILES)
-include $(FILES)
# Make sure these are just rules
.PHONY : all build install clean
+2 -6
View File
@@ -14,10 +14,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
LDLIBS = $(LDFLAGS_libxenctrl) $(LDFLAGS_libxenguest) $(LDFLAGS_libxenstore)
@@ -40,6 +36,6 @@ install: build
.PHONY: clean
clean:
$(RM) *.o $(PROGRAMS)
$(RM) $(PROG_DEP)
$(RM) $(DEPS)
-include $(PROG_DEP)
-include $(DEPS)
+3 -1
View File
@@ -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)
+3 -1
View File
@@ -17,4 +17,6 @@ install: all
.PHONY: clean
clean:
$(RM) -f $(BIN)
$(RM) -f $(BIN) $(DEPS)
-include $(DEPS)
+3 -1
View File
@@ -155,4 +155,6 @@ endif
.PHONY: clean
clean:
rm -f $(LIB) $(SHLIB) $(SHLIB_LINKS) $(OBJECTS-y) \
$(BINDINGS) $(BINDINGSRC)
$(BINDINGS) $(BINDINGSRC) $(DEPS)
-include $(DEPS)
+3 -1
View File
@@ -37,4 +37,6 @@ endif
.PHONY: clean
clean:
rm -f xentop xentop.o
rm -f xentop xentop.o $(DEPS)
-include $(DEPS)
+2 -6
View File
@@ -8,10 +8,6 @@ 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:
+4 -1
View File
@@ -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)
-4
View File
@@ -24,10 +24,6 @@ include $(XEN_ROOT)/tools/Rules.mk
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
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.