mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 02:30:03 +01:00
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>
65 lines
1.4 KiB
Makefile
65 lines
1.4 KiB
Makefile
MAJOR = 1.0
|
|
MINOR = 0
|
|
|
|
XEN_ROOT = ../../..
|
|
include $(XEN_ROOT)/tools/Rules.mk
|
|
|
|
XEN_LIBXC = $(XEN_ROOT)/tools/libxc
|
|
|
|
SRCS :=
|
|
SRCS += flask_op.c
|
|
|
|
CFLAGS += -Werror
|
|
CFLAGS += -fno-strict-aliasing
|
|
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.
|
|
|
|
LIB_OBJS := $(patsubst %.c,%.o,$(SRCS))
|
|
PIC_OBJS := $(patsubst %.c,%.opic,$(SRCS))
|
|
|
|
LIB := libflask.a
|
|
LIB += libflask.so libflask.so.$(MAJOR) libflask.so.$(MAJOR).$(MINOR)
|
|
|
|
.PHONY: all
|
|
all: build
|
|
|
|
.PHONY: build
|
|
build:
|
|
$(MAKE) $(LIB)
|
|
|
|
.PHONY: install
|
|
install: build
|
|
$(INSTALL_DIR) $(DESTDIR)$(LIBDIR)
|
|
$(INSTALL_DIR) $(DESTDIR)$(INCLUDEDIR)
|
|
$(INSTALL_PROG) libflask.so.$(MAJOR).$(MINOR) $(DESTDIR)$(LIBDIR)
|
|
$(INSTALL_DATA) libflask.a $(DESTDIR)$(LIBDIR)
|
|
ln -sf libflask.so.$(MAJOR).$(MINOR) $(DESTDIR)$(LIBDIR)/libflask.so.$(MAJOR)
|
|
ln -sf libflask.so.$(MAJOR) $(DESTDIR)$(LIBDIR)/libflask.so
|
|
$(INSTALL_DATA) include/flask.h $(DESTDIR)$(INCLUDEDIR)
|
|
|
|
.PHONY: TAGS
|
|
TAGS:
|
|
etags -t *.c *.h
|
|
|
|
.PHONY: clean
|
|
clean:
|
|
rm -rf *.a *.so* *.o *.opic *.rpm $(LIB) *~ $(DEPS) xen
|
|
|
|
# libflask
|
|
|
|
libflask.a: $(LIB_OBJS)
|
|
$(AR) rc $@ $^
|
|
|
|
libflask.so: libflask.so.$(MAJOR)
|
|
ln -sf $< $@
|
|
libflask.so.$(MAJOR): libflask.so.$(MAJOR).$(MINOR)
|
|
ln -sf $< $@
|
|
|
|
libflask.so.$(MAJOR).$(MINOR): $(PIC_OBJS)
|
|
$(CC) $(CFLAGS) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libflask.so.$(MAJOR) $(SHLIB_CFLAGS) -o $@ $^
|
|
|
|
-include $(DEPS)
|