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-0000pC-PL 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 1LOsbN-0000iX-7A for qemu-devel@nongnu.org; Mon, 19 Jan 2009 06:47:33 -0500 Received: from [199.232.76.173] (port=47868 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LOsbL-0000h4-Af for qemu-devel@nongnu.org; Mon, 19 Jan 2009 06:47:31 -0500 Received: from mx2.redhat.com ([66.187.237.31]:37776) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LOsbK-0007cN-KA for qemu-devel@nongnu.org; Mon, 19 Jan 2009 06:47:30 -0500 From: Avi Kivity Date: Mon, 19 Jan 2009 13:47:22 +0200 Message-Id: <1232365643-6417-5-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 4/5] Consolidate linker rules 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 Use generic rules where posssible, and a LINK macro where not. Signed-off-by: Avi Kivity --- Makefile | 4 ++-- Makefile.target | 10 ++++++---- rules.mak | 4 ++++ 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 66e61fc..428cff1 100644 --- a/Makefile +++ b/Makefile @@ -188,10 +188,10 @@ libqemu_user.a: $(USER_OBJS) ###################################################################### qemu-img$(EXESUF): qemu-img.o qemu-tool.o osdep.o $(BLOCK_OBJS) - $(CC) $(LDFLAGS) -o $@ $^ -lz $(LIBS) qemu-nbd$(EXESUF): qemu-nbd.o qemu-tool.o osdep.o $(BLOCK_OBJS) - $(CC) $(LDFLAGS) -o $@ $^ -lz $(LIBS) + +qemu-img$(EXESUF) qemu-nbd$(EXESUF): LIBS += -lz clean: # avoid old build problems by removing potentially incorrect old files diff --git a/Makefile.target b/Makefile.target index b6d5590..1a02451 100644 --- a/Makefile.target +++ b/Makefile.target @@ -355,7 +355,7 @@ OBJS+= libqemu.a signal.o: CFLAGS += $(HELPER_CFLAGS) $(QEMU_PROG): $(OBJS) ../libqemu_user.a - $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) + $(LINK) ifeq ($(ARCH),alpha) # Mark as 32 bit binary, i. e. it will be mapped into the low 31 bit of # the address space (31 bit so sign extending doesn't matter) @@ -390,7 +390,7 @@ endif signal.o: CFLAGS += $(HELPER_CFLAGS) $(QEMU_PROG): $(OBJS) - $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) + $(LINK) endif #CONFIG_DARWIN_USER @@ -494,7 +494,7 @@ endif signal.o: CFLAGS += $(HELPER_CFLAGS) $(QEMU_PROG): $(OBJS) ../libqemu_user.a - $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) + $(LINK) endif #CONFIG_BSD_USER @@ -719,8 +719,10 @@ LDFLAGS+=-p main.o: CFLAGS+=-p endif +$(QEMU_PROG): LIBS += $(SDL_LIBS) $(COCOA_LIBS) $(CURSES_LIBS) $(BRLAPI_LIBS) $(VDE_LIBS) + $(QEMU_PROG): $(OBJS) ../libqemu_common.a libqemu.a - $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) $(SDL_LIBS) $(COCOA_LIBS) $(CURSES_LIBS) $(BRLAPI_LIBS) $(VDE_LIBS) + $(LINK) endif # !CONFIG_USER_ONLY diff --git a/rules.mak b/rules.mak index fe06978..dd56780 100644 --- a/rules.mak +++ b/rules.mak @@ -8,3 +8,7 @@ %.o: %.m $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $< +LINK = $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) + +%$(EXESUF): %.o + $(LINK) -- 1.6.0.6