aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile22
1 files changed, 16 insertions, 6 deletions
diff --git a/Makefile b/Makefile
index d0ec057204..73f9e3db18 100644
--- a/Makefile
+++ b/Makefile
@@ -13,7 +13,6 @@ BASE_LDFLAGS += $(OS_LDFLAGS) $(ARCH_LDFLAGS)
CPPFLAGS += -I. -I$(SRC_PATH) -MMD -MP
CPPFLAGS += -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
-CPPFLAGS += -DQEMU_TOOL
LIBS=
ifdef CONFIG_STATIC
BASE_LDFLAGS += -static
@@ -33,15 +32,23 @@ subdir-%: dyngen$(EXESUF) libqemu_common.a
recurse-all: $(patsubst %,subdir-%, $(TARGET_DIRS))
+#######################################################################
+# BLOCK_OBJS is code used by both qemu system emulation and qemu-img
+
+BLOCK_OBJS=cutils.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
+
######################################################################
-# libqemu_common.a: target indepedent part of system emulation. The
+# libqemu_common.a: Target indepedent part of system emulation. The
# long term path is to suppress *all* target specific code in case of
# system emulation, i.e. a single QEMU executable should support all
# CPUs and machines.
-OBJS+=cutils.o readline.o console.o
-#OBJS+=block.o block-raw.o
-OBJS+=block-cow.o block-qcow.o aes.o block-vmdk.o block-cloop.o block-dmg.o block-bochs.o block-vpc.o block-vvfat.o block-qcow2.o block-parallels.o
+OBJS=$(BLOCK_OBJS)
+OBJS+=readline.o console.o
+OBJS+=block.o
ifdef CONFIG_WIN32
OBJS+=tap-win32.o
@@ -105,9 +112,12 @@ libqemu_common.a: $(OBJS)
######################################################################
-qemu-img$(EXESUF): qemu-img.o block.o block-raw.o libqemu_common.a
+qemu-img$(EXESUF): qemu-img.o qemu-img-block.o qemu-img-block-raw.o $(BLOCK_OBJS)
$(CC) $(LDFLAGS) $(BASE_LDFLAGS) -o $@ $^ -lz $(LIBS)
+qemu-img-%.o: %.c
+ $(CC) $(CFLAGS) $(CPPFLAGS) -DQEMU_IMG $(BASE_CFLAGS) -c -o $@ $<
+
%.o: %.c
$(CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<