aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authoraliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162>2008-09-15 15:51:35 +0000
committeraliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162>2008-09-15 15:51:35 +0000
commit03ff3ca30f29f422ebfd10d2bee1393efb4d4f7a (patch)
treea910207407d9f3b1de0c0cd95299c7fe72065675 /Makefile
parentd9cf15784f68935a25c5ece051ba595fccbc8f6c (diff)
downloadqemu-03ff3ca30f29f422ebfd10d2bee1393efb4d4f7a.zip
qemu-03ff3ca30f29f422ebfd10d2bee1393efb4d4f7a.tar.gz
qemu-03ff3ca30f29f422ebfd10d2bee1393efb4d4f7a.tar.bz2
Use common objects for qemu-img and qemu-nbd
Right now, we sprinkle #if defined(QEMU_IMG) && defined(QEMU_NBD) all over the code. It's ugly and causes us to have to build multiple object files for linking against qemu and the tools. This patch introduces a new file, qemu-tool.c which contains enough for qemu-img, qemu-nbd, and QEMU to all share the same objects. This also required getting qemu-nbd to be a bit more Windows friendly. I also changed the Windows block-raw to use normal IO instead of overlapping IO since we don't actually do AIO yet on Windows. I changed the various #if 0's to #if WIN32_AIO to make it easier for someone to eventually fix AIO on Windows. After this patch, there are no longer any #ifdef's related to qemu-img and qemu-nbd. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5226 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile45
1 files changed, 17 insertions, 28 deletions
diff --git a/Makefile b/Makefile
index 708941c..7bb2bf2 100644
--- a/Makefile
+++ b/Makefile
@@ -28,6 +28,10 @@ ifdef CONFIG_SOLARIS
LIBS+=-lsocket -lnsl -lresolv
endif
+ifdef CONFIG_WIN32
+LIBS+=-lwinmm -lws2_32 -liphlpapi
+endif
+
all: $(TOOLS) $(DOCS) recurse-all
SUBDIR_RULES=$(patsubst %,subdir-%, $(TARGET_DIRS))
@@ -46,9 +50,17 @@ recurse-all: $(SUBDIR_RULES)
BLOCK_OBJS=cutils.o qemu-malloc.o
BLOCK_OBJS+=block-cow.o block-qcow.o aes.o block-vmdk.o block-cloop.o
BLOCK_OBJS+=block-dmg.o block-bochs.o block-vpc.o block-vvfat.o
-BLOCK_OBJS+=block-qcow2.o block-parallels.o
-ifndef CONFIG_WIN32
-BLOCK_OBJS+=block-nbd.o
+BLOCK_OBJS+=block-qcow2.o block-parallels.o block-nbd.o
+BLOCK_OBJS+=nbd.o block.o
+
+ifdef CONFIG_WIN32
+BLOCK_OBJS += block-raw-win32.o
+else
+BLOCK_OBJS += block-raw-posix.o
+endif
+
+ifdef CONFIG_AIO
+BLOCK_OBJS += compatfd.o
endif
######################################################################
@@ -59,11 +71,6 @@ endif
OBJS=$(BLOCK_OBJS)
OBJS+=readline.o console.o
-OBJS+=block.o
-
-ifndef CONFIG_WIN32
-OBJS+=nbd.o
-endif
OBJS+=irq.o
OBJS+=i2c.o smbus.o smbus_eeprom.o max7310.o max111x.o wm8750.o
@@ -173,33 +180,15 @@ libqemu_user.a: $(USER_OBJS)
rm -f $@
$(AR) rcs $@ $(USER_OBJS)
-QEMU_IMG_BLOCK_OBJS = $(BLOCK_OBJS)
-ifdef CONFIG_WIN32
-QEMU_IMG_BLOCK_OBJS += qemu-img-block-raw-win32.o
-else
-QEMU_IMG_BLOCK_OBJS += nbd.o qemu-img-block-raw-posix.o
-endif
-
-ifdef CONFIG_AIO
-QEMU_IMG_BLOCK_OBJS += compatfd.o
-endif
-
######################################################################
-qemu-img$(EXESUF): qemu-img.o qemu-img-block.o $(QEMU_IMG_BLOCK_OBJS)
+qemu-img$(EXESUF): qemu-img.o qemu-tool.o osdep.o $(BLOCK_OBJS)
$(CC) $(LDFLAGS) -o $@ $^ -lz $(LIBS)
-qemu-img-%.o: %.c
- $(CC) $(CFLAGS) $(CPPFLAGS) -DQEMU_IMG -c -o $@ $<
-
%.o: %.c
$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
-qemu-nbd-%.o: %.c
- $(CC) $(CFLAGS) $(CPPFLAGS) -DQEMU_NBD -c -o $@ $<
-
-qemu-nbd$(EXESUF): qemu-nbd.o qemu-nbd-nbd.o qemu-img-block.o \
- osdep.o qemu-nbd-block-raw-posix.o compatfd.o $(BLOCK_OBJS)
+qemu-nbd$(EXESUF): qemu-nbd.o qemu-tool.o osdep.o $(BLOCK_OBJS)
$(CC) $(LDFLAGS) -o $@ $^ -lz $(LIBS)
# dyngen host tool