From: Avi Kivity <avi@redhat.com>
To: Anthony Liguori <anthony@codemonkey.ws>, qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 2/6] Consolidate compiler invocations
Date: Wed, 21 Jan 2009 19:10:05 +0200 [thread overview]
Message-ID: <1232557809-12860-3-git-send-email-avi@redhat.com> (raw)
In-Reply-To: <1232557809-12860-1-git-send-email-avi@redhat.com>
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 <avi@redhat.com>
---
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
next prev parent reply other threads:[~2009-01-21 17:10 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-21 17:10 [Qemu-devel] [PATCH 0/6] Makefile enhancements (v2) Avi Kivity
2009-01-21 17:10 ` [Qemu-devel] [PATCH 1/6] Drop OP_CFLAGS Avi Kivity
2009-01-21 17:10 ` Avi Kivity [this message]
2009-01-21 17:10 ` [Qemu-devel] [PATCH 3/6] Introduce rules.mak Avi Kivity
2009-01-21 17:10 ` [Qemu-devel] [PATCH 4/6] Consolidate linker rules Avi Kivity
2009-01-21 17:10 ` [Qemu-devel] [PATCH 5/6] Make make output quieter Avi Kivity
2009-01-21 17:10 ` [Qemu-devel] [PATCH 6/6] Consolidate library creation Avi Kivity
2009-01-21 18:13 ` [Qemu-devel] Re: [PATCH 0/6] Makefile enhancements (v2) Anthony Liguori
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=1232557809-12860-3-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).