From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LOsbP-0000pS-NT for qemu-devel@nongnu.org; Mon, 19 Jan 2009 06:47:35 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LOsbM-0000il-KH for qemu-devel@nongnu.org; Mon, 19 Jan 2009 06:47:33 -0500 Received: from [199.232.76.173] (port=47869 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LOsbL-0000hA-Bc for qemu-devel@nongnu.org; Mon, 19 Jan 2009 06:47:31 -0500 Received: from mx2.redhat.com ([66.187.237.31]:37778) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LOsbK-0007cR-Kq for qemu-devel@nongnu.org; Mon, 19 Jan 2009 06:47:30 -0500 From: Avi Kivity Date: Mon, 19 Jan 2009 13:47:20 +0200 Message-Id: <1232365643-6417-3-git-send-email-avi@redhat.com> In-Reply-To: <1232365643-6417-1-git-send-email-avi@redhat.com> References: <1232365643-6417-1-git-send-email-avi@redhat.com> Subject: [Qemu-devel] [PATCH 2/5] Consolidate compiler invocations Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori , qemu-devel@nongnu.org Instead of specifying the compilation command over and over, use a single rule and adjust it as necessary using target specific target overrides. Signed-off-by: Avi Kivity --- Makefile | 17 ++++++++--------- Makefile.target | 18 +++++------------- 2 files changed, 13 insertions(+), 22 deletions(-) diff --git a/Makefile b/Makefile index 8cbdcda..92a77ba 100644 --- a/Makefile +++ b/Makefile @@ -158,22 +158,18 @@ endif LIBS+=$(VDE_LIBS) cocoa.o: cocoa.m - $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $< sdl.o: sdl.c keymaps.c sdl_keysym.h - $(CC) $(CFLAGS) $(CPPFLAGS) $(SDL_CFLAGS) -c -o $@ $< + +sdl.o audio/sdlaudio.o: CFLAGS += $(SDL_CFLAGS) vnc.o: vnc.c keymaps.c sdl_keysym.h vnchextile.h d3des.c d3des.h - $(CC) $(CFLAGS) $(CPPFLAGS) $(CONFIG_VNC_TLS_CFLAGS) -c -o $@ $< -curses.o: curses.c keymaps.c curses_keys.h - $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $< +vnc.o: CFLAGS += $(CONFIG_VNC_TLS_CFLAGS) -bt-host.o: bt-host.c - $(CC) $(CFLAGS) $(CPPFLAGS) $(CONFIG_BLUEZ_CFLAGS) -c -o $@ $< +curses.o: curses.c keymaps.c curses_keys.h -audio/sdlaudio.o: audio/sdlaudio.c - $(CC) $(CFLAGS) $(CPPFLAGS) $(SDL_CFLAGS) -c -o $@ $< +bt-host.o: CFLAGS += $(CONFIG_BLUEZ_CFLAGS) libqemu_common.a: $(OBJS) rm -f $@ @@ -195,6 +191,9 @@ qemu-img$(EXESUF): qemu-img.o qemu-tool.o osdep.o $(BLOCK_OBJS) %.o: %.c $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $< +%.o: %.m + $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $< + qemu-nbd$(EXESUF): qemu-nbd.o qemu-tool.o osdep.o $(BLOCK_OBJS) $(CC) $(LDFLAGS) -o $@ $^ -lz $(LIBS) diff --git a/Makefile.target b/Makefile.target index 7d9fe7b..5f41a3d 100644 --- a/Makefile.target +++ b/Makefile.target @@ -219,16 +219,11 @@ translate-all.o: translate-all.c cpu.h tcg/tcg.o: cpu.h -machine.o: machine.c - $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $< - # HELPER_CFLAGS is used for all the code compiled with static register # variables -op_helper.o: op_helper.c - $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(CFLAGS) $(I386_CFLAGS) -c -o $@ $< +op_helper.o: CFLAGS += $(HELPER_CFLAGS) $(I386_CFLAGS) -cpu-exec.o: cpu-exec.c - $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(CFLAGS) -c -o $@ $< +cpu-exec.o: CFLAGS += $(HELPER_CFLAGS) ######################################################### # Linux user emulator target @@ -356,8 +351,7 @@ OBJS+= libqemu.a # Note: this is a workaround. The real fix is to avoid compiling # cpu_signal_handler() in cpu-exec.c. -signal.o: signal.c - $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(CFLAGS) -c -o $@ $< +signal.o: CFLAGS += $(HELPER_CFLAGS) $(QEMU_PROG): $(OBJS) ../libqemu_user.a $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) @@ -392,8 +386,7 @@ endif # Note: this is a workaround. The real fix is to avoid compiling # cpu_signal_handler() in cpu-exec.c. -signal.o: signal.c - $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(CFLAGS) -c -o $@ $< +signal.o: CFLAGS += $(HELPER_CFLAGS) $(QEMU_PROG): $(OBJS) $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) @@ -497,8 +490,7 @@ endif # Note: this is a workaround. The real fix is to avoid compiling # cpu_signal_handler() in cpu-exec.c. -signal.o: signal.c - $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(CFLAGS) -c -o $@ $< +signal.o: CFLAGS += $(HELPER_CFLAGS) $(QEMU_PROG): $(OBJS) ../libqemu_user.a $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) -- 1.6.0.6