From: Avi Kivity <avi@redhat.com>
To: Anthony Liguori <anthony@codemonkey.ws>, qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 4/5] Consolidate linker rules
Date: Mon, 19 Jan 2009 13:47:22 +0200 [thread overview]
Message-ID: <1232365643-6417-5-git-send-email-avi@redhat.com> (raw)
In-Reply-To: <1232365643-6417-1-git-send-email-avi@redhat.com>
Use generic rules where posssible, and a LINK macro where not.
Signed-off-by: Avi Kivity <avi@redhat.com>
---
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
next prev parent reply other threads:[~2009-01-19 11:47 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-19 11:47 [Qemu-devel] [PATCH 0/5] Makefile enhancements Avi Kivity
2009-01-19 11:47 ` [Qemu-devel] [PATCH 1/5] Drop OP_CFLAGS Avi Kivity
2009-01-19 11:47 ` [Qemu-devel] [PATCH 2/5] Consolidate compiler invocations Avi Kivity
2009-01-19 11:47 ` [Qemu-devel] [PATCH 3/5] Introduce rules.mak Avi Kivity
2009-01-21 15:57 ` [Qemu-devel] " Anthony Liguori
2009-01-21 17:08 ` Avi Kivity
2009-01-19 11:47 ` Avi Kivity [this message]
2009-01-19 11:47 ` [Qemu-devel] [PATCH 5/5] Make make output quieter Avi Kivity
2009-01-19 16:03 ` [Qemu-devel] Re: [PATCH 0/5] Makefile enhancements Anthony Liguori
2009-01-19 16:14 ` Paul Brook
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1232365643-6417-5-git-send-email-avi@redhat.com \
--to=avi@redhat.com \
--cc=anthony@codemonkey.ws \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.