Bastian Blank
2008-Mar-07 10:57 UTC
[Xen-devel] [PATCH 1/3] tools/blktap - Cleanup makefiles
# HG changeset patch # User Bastian Blank <waldi@debian.org> # Date 1204886808 -3600 # Node ID 34d86b8cde0dadfab00b66a0616baede3e6597c9 # Parent 59b8768d0d0d3bf2125c33adafbd1256e75e2755 Cleanup blktap Makefiles Signed-off-by: Bastian Blank <waldi@debian.org> diff -r 59b8768d0d0d -r 34d86b8cde0d tools/blktap/drivers/Makefile --- a/tools/blktap/drivers/Makefile Wed Mar 05 11:18:25 2008 +0000 +++ b/tools/blktap/drivers/Makefile Fri Mar 07 11:46:48 2008 +0100 @@ -1,7 +1,5 @@ XEN_ROOT = ../../.. XEN_ROOT = ../../.. include $(XEN_ROOT)/tools/Rules.mk - -INCLUDES += -I.. -I../lib -I$(XEN_INCLUDE) IBIN = blktapctrl tapdisk QCOW_UTIL = img2qcow qcow2raw qcow-create @@ -9,18 +7,18 @@ LIBAIO_DIR = ../../libaio/src CFLAGS += -Werror CFLAGS += -Wno-unused -CFLAGS += $(CFLAGS_libxenctrl) -I $(LIBAIO_DIR) -CFLAGS += $(INCLUDES) -I. -I../../xenstore +CFLAGS += -I../lib +CFLAGS += $(CFLAGS_libxenctrl) +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 -LIBS := -L. -L.. -L../lib -LIBS += -Wl,-rpath-link,$(XEN_XENSTORE) - -LIBS_IMG := $(LIBAIO_DIR)/libaio.a -lcrypto -lpthread -lz +LDFLAGS_blktapctrl := $(LDFLAGS_libxenctrl) $(LDFLAGS_libxenstore) -L../lib -lblktap +LDFLAGS_img := $(LIBAIO_DIR)/libaio.a -lcrypto -lpthread -lz BLK-OBJS-y := block-aio.o BLK-OBJS-y += block-sync.o @@ -34,17 +32,17 @@ BLK-OBJS-$(CONFIG_Linux) += blk_linux.c all: $(IBIN) qcow-util -blktapctrl: blktapctrl.c - $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(LIBS) -lblktap $(LDFLAGS_libxenctrl) +blktapctrl: blktapctrl.o + $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(LDFLAGS_blktapctrl) -tapdisk: tapdisk.c $(BLK-OBJS-y) tapdisk.c - $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(LIBS) $(LIBS_IMG) +tapdisk: tapdisk.o $(BLK-OBJS-y) + $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(LDFLAGS_img) .PHONY: qcow-util qcow-util: img2qcow qcow2raw qcow-create -img2qcow qcow2raw qcow-create: %: $(BLK-OBJS-y) - $(CC) $(CFLAGS) -o $* $(BLK-OBJS-y) $*.c $(LDFLAGS) $(LIBS_IMG) +img2qcow qcow2raw qcow-create: %: %.o $(BLK-OBJS-y) + $(CC) $(CFLAGS) -o $* $^ $(LDFLAGS) $(LDFLAGS_img) install: all $(INSTALL_PROG) $(IBIN) $(QCOW_UTIL) $(VHD_UTIL) $(DESTDIR)$(SBINDIR) diff -r 59b8768d0d0d -r 34d86b8cde0d tools/blktap/lib/Makefile --- a/tools/blktap/lib/Makefile Wed Mar 05 11:18:25 2008 +0000 +++ b/tools/blktap/lib/Makefile Fri Mar 07 11:46:48 2008 +0100 @@ -5,8 +5,9 @@ MINOR = 0 MINOR = 0 SONAME = libblktap.so.$(MAJOR) -INCLUDES += -I. -I.. -I $(XEN_LIBXC) -I$(XEN_INCLUDE) $(CFLAGS_libxenstore) - +CFLAGS += -I. +CFLAGS += $(CFLAGS_libxenctrl) +CFLAGS += $(CFLAGS_libxenstore) LDFLAGS += $(LDFLAGS_libxenstore) SRCS :@@ -20,23 +21,18 @@ CFLAGS += -D _GNU_SOURCE # Get gcc to generate the dependencies for us. CFLAGS += -Wp,-MD,.$(@F).d -CFLAGS += $(INCLUDES) DEPS = .*.d -OBJS = $(patsubst %.c,%.o,$(SRCS)) +OBJS = $(SRCS:.c=.o) +OBJS_PIC = $(SRCS:.c=.opic) IBINS : LIB = libblktap.a libblktap.so.$(MAJOR).$(MINOR) .PHONY: all -all: build +all: $(LIB) -.PHONY: build -build: libblktap.a - -.PHONY: libblktap -libblktap: libblktap.a - +.PHONY: install install: all $(INSTALL_DIR) $(DESTDIR)$(LIBDIR) $(INSTALL_DIR) $(DESTDIR)$(INCLUDEDIR) @@ -45,19 +41,20 @@ install: all ln -sf libblktap.so.$(MAJOR) $(DESTDIR)$(LIBDIR)/libblktap.so $(INSTALL_DATA) blktaplib.h $(DESTDIR)$(INCLUDEDIR) +.PHONY: clean clean: rm -rf *.a *.so* *.o *.rpm $(LIB) *~ $(DEPS) xen TAGS -libblktap.a: $(OBJS) +libblktap.so.$(MAJOR).$(MINOR): $(OBJS_PIC) $(CC) $(CFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,$(SONAME) $(SHLIB_CFLAGS) \ - -L$(XEN_XENSTORE) $(LDFLAGS) \ - -o libblktap.so.$(MAJOR).$(MINOR) $^ $(LIBS) + $(LDFLAGS) -o $@ $^ ln -sf libblktap.so.$(MAJOR).$(MINOR) libblktap.so.$(MAJOR) ln -sf libblktap.so.$(MAJOR) libblktap.so - $(AR) rc $@ libblktap.so -.PHONY: TAGS all build clean install libblktap +libblktap.a: $(OBJS) + $(AR) rc $@ $^ +.PHONY: TAGS TAGS: etags -t $(SRCS) *.h -- ... bacteriological warfare ... hard to believe we were once foolish enough to play around with that. -- McCoy, "The Omega Glory", stardate unknown _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel