qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 0/6] Makefile enhancements (v2)
@ 2009-01-21 17:10 Avi Kivity
  2009-01-21 17:10 ` [Qemu-devel] [PATCH 1/6] Drop OP_CFLAGS Avi Kivity
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Avi Kivity @ 2009-01-21 17:10 UTC (permalink / raw)
  To: Anthony Liguori, qemu-devel

Minor makefile cleanups; the most significant is the last patch which
updates the makefile to generate Linux-style simpified output by default.

Changes from v1:
 - fix build from outside source directory
 - handle 'ar' utility

Avi Kivity (6):
  Drop OP_CFLAGS
  Consolidate compiler invocations
  Introduce rules.mak
  Consolidate linker rules
  Make make output quieter
  Consolidate library creation

 Makefile        |   29 ++++++------------
 Makefile.target |   87 ++++++++++--------------------------------------------
 rules.mak       |   19 ++++++++++++
 3 files changed, 45 insertions(+), 90 deletions(-)
 create mode 100644 rules.mak

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Qemu-devel] [PATCH 1/6] Drop OP_CFLAGS
  2009-01-21 17:10 [Qemu-devel] [PATCH 0/6] Makefile enhancements (v2) Avi Kivity
@ 2009-01-21 17:10 ` Avi Kivity
  2009-01-21 17:10 ` [Qemu-devel] [PATCH 2/6] Consolidate compiler invocations Avi Kivity
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Avi Kivity @ 2009-01-21 17:10 UTC (permalink / raw)
  To: Anthony Liguori, qemu-devel

OP_CFLAGS is no longer used, except for machine.c, where it is not needed.

Signed-off-by: Avi Kivity <avi@redhat.com>
---
 Makefile.target |   52 +++++-----------------------------------------------
 1 files changed, 5 insertions(+), 47 deletions(-)

diff --git a/Makefile.target b/Makefile.target
index a97edd7..7d9fe7b 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -71,90 +71,49 @@ endif
 
 PROGS=$(QEMU_PROG)
 
-# We require -O2 to avoid the stack setup prologue in EXIT_TB
-OP_CFLAGS := -O2 -g -fno-strict-aliasing
-OP_CFLAGS += -Wall -Wundef -Wendif-labels -Wwrite-strings -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls
-
 # cc-option
-# Usage: OP_CFLAGS+=$(call cc-option, -falign-functions=0, -malign-functions=0)
-
-cc-option = $(shell if $(CC) $(OP_CFLAGS) $(1) -S -o /dev/null -xc /dev/null \
-              > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi ;)
+# Usage: CFLAGS+=$(call cc-option, $(CFLAGS), -falign-functions=0, -malign-functions=0)
 
-OP_CFLAGS+=$(call cc-option, -fno-reorder-blocks, "")
-OP_CFLAGS+=$(call cc-option, -fno-gcse, "")
-OP_CFLAGS+=$(call cc-option, -fno-tree-ch, "")
-OP_CFLAGS+=$(call cc-option, -fno-optimize-sibling-calls, "")
-OP_CFLAGS+=$(call cc-option, -fno-crossjumping, "")
-OP_CFLAGS+=$(call cc-option, -fno-align-labels, "")
-OP_CFLAGS+=$(call cc-option, -fno-align-jumps, "")
-OP_CFLAGS+=$(call cc-option, -fno-align-functions, $(call cc-option, -malign-functions=0, ""))
-OP_CFLAGS+=$(call cc-option, -fno-section-anchors, "")
+cc-option = $(shell if $(CC) $(1) $(2) -S -o /dev/null -xc /dev/null \
+              > /dev/null 2>&1; then echo "$(2)"; else echo "$(3)"; fi ;)
 
 HELPER_CFLAGS=
 
 ifeq ($(ARCH),i386)
 HELPER_CFLAGS+=-fomit-frame-pointer
-OP_CFLAGS+=-mpreferred-stack-boundary=2 -fomit-frame-pointer
 endif
 
 ifeq ($(ARCH),sparc)
   CFLAGS+=-ffixed-g2 -ffixed-g3
-  OP_CFLAGS+=-fno-delayed-branch -ffixed-i0
-  ifeq ($(CONFIG_SOLARIS),yes)
-    OP_CFLAGS+=-fno-omit-frame-pointer
-  else
+  ifneq ($(CONFIG_SOLARIS),yes)
     CFLAGS+=-ffixed-g1 -ffixed-g6
     HELPER_CFLAGS+=-ffixed-i0
   endif
 endif
 
 ifeq ($(ARCH),sparc64)
-  OP_CFLAGS+=-mcpu=ultrasparc -m64 -fno-delayed-branch -ffixed-i0
   ifneq ($(CONFIG_SOLARIS),yes)
     CFLAGS+=-ffixed-g5 -ffixed-g6 -ffixed-g7
-    OP_CFLAGS+=-ffixed-g5 -ffixed-g6 -ffixed-g7
   else
     CFLAGS+=-ffixed-g1 -ffixed-g4 -ffixed-g5 -ffixed-g7
   endif
 endif
 
 ifeq ($(ARCH),alpha)
-# -msmall-data is not used for OP_CFLAGS because we want two-instruction
-# relocations for the constant constructions
 # Ensure there's only a single GP
 CFLAGS+=-msmall-data
 endif
 
 ifeq ($(ARCH),hppa)
-OP_CFLAGS=-O1 -fno-delayed-branch
 BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
 endif
 
 ifeq ($(ARCH),ia64)
 CFLAGS+=-mno-sdata
-OP_CFLAGS+=-mno-sdata
-endif
-
-ifeq ($(ARCH),arm)
-OP_CFLAGS+=-mno-sched-prolog -fno-omit-frame-pointer
-endif
-
-ifeq ($(ARCH),m68k)
-OP_CFLAGS+=-fomit-frame-pointer
-endif
-
-ifeq ($(ARCH),mips)
-OP_CFLAGS+=-mabi=32 -G0 -fno-PIC -mno-abicalls -fomit-frame-pointer -fno-delayed-branch -Wa,-O0
-endif
-
-ifeq ($(ARCH),mips64)
-OP_CFLAGS+=-mabi=n32 -G0 -fno-PIC -mno-abicalls -fomit-frame-pointer -fno-delayed-branch -Wa,-O0
 endif
 
 CFLAGS+=$(OS_CFLAGS) $(ARCH_CFLAGS)
 LDFLAGS+=$(OS_LDFLAGS) $(ARCH_LDFLAGS)
-OP_CFLAGS+=$(OS_CFLAGS) $(ARCH_CFLAGS)
 
 CPPFLAGS+=-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
 LIBS+=-lm
@@ -166,7 +125,6 @@ LIBS+=-lsocket -lnsl -lresolv
 ifdef NEEDS_LIBSUNMATH
 LIBS+=-lsunmath
 LDFLAGS+=-L/opt/SUNWspro/prod/lib -R/opt/SUNWspro/prod/lib
-OP_CFLAGS+=-I/opt/SUNWspro/prod/include/cc
 CFLAGS+=-I/opt/SUNWspro/prod/include/cc
 endif
 endif
@@ -262,7 +220,7 @@ translate-all.o: translate-all.c cpu.h
 tcg/tcg.o: cpu.h
 
 machine.o: machine.c
-	$(CC) $(OP_CFLAGS) $(CPPFLAGS) -c -o $@ $<
+	$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
 
 # HELPER_CFLAGS is used for all the code compiled with static register
 # variables
-- 
1.6.0.6

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [Qemu-devel] [PATCH 2/6] Consolidate compiler invocations
  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
  2009-01-21 17:10 ` [Qemu-devel] [PATCH 3/6] Introduce rules.mak Avi Kivity
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Avi Kivity @ 2009-01-21 17:10 UTC (permalink / raw)
  To: Anthony Liguori, qemu-devel

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

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [Qemu-devel] [PATCH 3/6] Introduce rules.mak
  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 ` [Qemu-devel] [PATCH 2/6] Consolidate compiler invocations Avi Kivity
@ 2009-01-21 17:10 ` Avi Kivity
  2009-01-21 17:10 ` [Qemu-devel] [PATCH 4/6] Consolidate linker rules Avi Kivity
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Avi Kivity @ 2009-01-21 17:10 UTC (permalink / raw)
  To: Anthony Liguori, qemu-devel

Add a file for common makefile rules.

Signed-off-by: Avi Kivity <avi@redhat.com>

(Don't forget to 'svn add')
---
 Makefile        |    8 ++------
 Makefile.target |    7 +------
 rules.mak       |   10 ++++++++++
 3 files changed, 13 insertions(+), 12 deletions(-)
 create mode 100644 rules.mak

diff --git a/Makefile b/Makefile
index 92a77ba..ea76b69 100644
--- a/Makefile
+++ b/Makefile
@@ -1,12 +1,14 @@
 # Makefile for QEMU.
 
 include config-host.mak
+include $(SRC_PATH)/rules.mak
 
 .PHONY: all clean cscope distclean dvi html info install install-doc \
 	recurse-all speed tar tarbin test
 
 VPATH=$(SRC_PATH):$(SRC_PATH)/hw
 
+
 CFLAGS += $(OS_CFLAGS) $(ARCH_CFLAGS)
 LDFLAGS += $(OS_LDFLAGS) $(ARCH_LDFLAGS)
 
@@ -188,12 +190,6 @@ libqemu_user.a: $(USER_OBJS)
 qemu-img$(EXESUF): qemu-img.o qemu-tool.o osdep.o $(BLOCK_OBJS)
 	$(CC) $(LDFLAGS) -o $@ $^ -lz $(LIBS)
 
-%.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 5f41a3d..b6d5590 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -1,4 +1,5 @@
 include config.mak
+include $(SRC_PATH)/rules.mak
 
 TARGET_BASE_ARCH:=$(TARGET_ARCH)
 ifeq ($(TARGET_ARCH), x86_64)
@@ -731,12 +732,6 @@ else
 	$(SHELL) $(SRC_PATH)/feature_to_c.sh $@ $(TARGET_XML_FILES)
 endif
 
-%.o: %.c
-	$(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
-
-%.o: %.S
-	$(CC) $(CPPFLAGS) -c -o $@ $<
-
 clean:
 	rm -f *.o *.a *~ $(PROGS) nwfpe/*.o fpu/*.o
 	rm -f *.d */*.d tcg/*.o
diff --git a/rules.mak b/rules.mak
new file mode 100644
index 0000000..fe06978
--- /dev/null
+++ b/rules.mak
@@ -0,0 +1,10 @@
+
+%.o: %.c
+	$(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
+
+%.o: %.S
+	$(CC) $(CPPFLAGS) -c -o $@ $<
+
+%.o: %.m
+	$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
+
-- 
1.6.0.6

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [Qemu-devel] [PATCH 4/6] Consolidate linker rules
  2009-01-21 17:10 [Qemu-devel] [PATCH 0/6] Makefile enhancements (v2) Avi Kivity
                   ` (2 preceding siblings ...)
  2009-01-21 17:10 ` [Qemu-devel] [PATCH 3/6] Introduce rules.mak Avi Kivity
@ 2009-01-21 17:10 ` Avi Kivity
  2009-01-21 17:10 ` [Qemu-devel] [PATCH 5/6] Make make output quieter Avi Kivity
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Avi Kivity @ 2009-01-21 17:10 UTC (permalink / raw)
  To: Anthony Liguori, qemu-devel

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 ea76b69..9068181 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

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [Qemu-devel] [PATCH 5/6] Make make output quieter
  2009-01-21 17:10 [Qemu-devel] [PATCH 0/6] Makefile enhancements (v2) Avi Kivity
                   ` (3 preceding siblings ...)
  2009-01-21 17:10 ` [Qemu-devel] [PATCH 4/6] Consolidate linker rules Avi Kivity
@ 2009-01-21 17:10 ` 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
  6 siblings, 0 replies; 8+ messages in thread
From: Avi Kivity @ 2009-01-21 17:10 UTC (permalink / raw)
  To: Anthony Liguori, qemu-devel

Spew out less noise when compiling.  This helps review make output for
information such as compilation warnings, rather than extra long compiler
invocations.

The full output can be generated by supplying a 'V=1' parameter to make.

Signed-off-by: Avi Kivity <avi@redhat.com>
---
 Makefile  |    2 +-
 rules.mak |   10 ++++++----
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/Makefile b/Makefile
index 9068181..ac15ca5 100644
--- a/Makefile
+++ b/Makefile
@@ -39,7 +39,7 @@ all: $(TOOLS) $(DOCS) recurse-all
 SUBDIR_RULES=$(patsubst %,subdir-%, $(TARGET_DIRS))
 
 subdir-%:
-	$(MAKE) -C $(subst subdir-,,$@) all
+	$(MAKE) -C $(subst subdir-,,$@) V="$(V)" all
 
 $(filter %-softmmu,$(SUBDIR_RULES)): libqemu_common.a
 $(filter %-user,$(SUBDIR_RULES)): libqemu_user.a
diff --git a/rules.mak b/rules.mak
index dd56780..818c5ef 100644
--- a/rules.mak
+++ b/rules.mak
@@ -1,14 +1,16 @@
 
 %.o: %.c
-	$(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
+	$(call quiet-command,$(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<,CC $@)
 
 %.o: %.S
-	$(CC) $(CPPFLAGS) -c -o $@ $<
+	$(call quiet-command,$(CC) $(CPPFLAGS) -c -o $@ $<,AS $@)
 
 %.o: %.m
-	$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
+	$(call quiet-command,$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<,OBJC $@)
 
-LINK = $(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
+LINK = $(call quiet-command,$(CC) $(LDFLAGS) -o $@ $^ $(LIBS),LINK $@)
 
 %$(EXESUF): %.o
 	$(LINK)
+
+quiet-command = $(if $(V),$1,@echo $2 && $1)
-- 
1.6.0.6

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [Qemu-devel] [PATCH 6/6] Consolidate library creation
  2009-01-21 17:10 [Qemu-devel] [PATCH 0/6] Makefile enhancements (v2) Avi Kivity
                   ` (4 preceding siblings ...)
  2009-01-21 17:10 ` [Qemu-devel] [PATCH 5/6] Make make output quieter Avi Kivity
@ 2009-01-21 17:10 ` Avi Kivity
  2009-01-21 18:13 ` [Qemu-devel] Re: [PATCH 0/6] Makefile enhancements (v2) Anthony Liguori
  6 siblings, 0 replies; 8+ messages in thread
From: Avi Kivity @ 2009-01-21 17:10 UTC (permalink / raw)
  To: Anthony Liguori, qemu-devel

Put archive utility (ar) invocations into a rule, and have it generate
quiet output by default.

Signed-off-by: Avi Kivity <avi@redhat.com>
---
 Makefile        |    4 ----
 Makefile.target |    2 --
 rules.mak       |    3 +++
 3 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/Makefile b/Makefile
index ac15ca5..ff6a009 100644
--- a/Makefile
+++ b/Makefile
@@ -174,16 +174,12 @@ curses.o: curses.c keymaps.c curses_keys.h
 bt-host.o: CFLAGS += $(CONFIG_BLUEZ_CFLAGS)
 
 libqemu_common.a: $(OBJS)
-	rm -f $@ 
-	$(AR) rcs $@ $(OBJS)
 
 #######################################################################
 # USER_OBJS is code used by qemu userspace emulation
 USER_OBJS=cutils.o  cache-utils.o
 
 libqemu_user.a: $(USER_OBJS)
-	rm -f $@ 
-	$(AR) rcs $@ $(USER_OBJS)
 
 ######################################################################
 
diff --git a/Makefile.target b/Makefile.target
index 1a02451..a091ce9 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -211,8 +211,6 @@ endif
 # libqemu
 
 libqemu.a: $(LIBOBJS)
-	rm -f $@
-	$(AR) rcs $@ $(LIBOBJS)
 
 translate.o: translate.c cpu.h
 
diff --git a/rules.mak b/rules.mak
index 818c5ef..a4955da 100644
--- a/rules.mak
+++ b/rules.mak
@@ -13,4 +13,7 @@ LINK = $(call quiet-command,$(CC) $(LDFLAGS) -o $@ $^ $(LIBS),LINK $@)
 %$(EXESUF): %.o
 	$(LINK)
 
+%.a:
+	$(call quiet-command,rm -f $@ && $(AR) rcs $@ $^,AR $@)
+
 quiet-command = $(if $(V),$1,@echo $2 && $1)
-- 
1.6.0.6

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [Qemu-devel] Re: [PATCH 0/6] Makefile enhancements (v2)
  2009-01-21 17:10 [Qemu-devel] [PATCH 0/6] Makefile enhancements (v2) Avi Kivity
                   ` (5 preceding siblings ...)
  2009-01-21 17:10 ` [Qemu-devel] [PATCH 6/6] Consolidate library creation Avi Kivity
@ 2009-01-21 18:13 ` Anthony Liguori
  6 siblings, 0 replies; 8+ messages in thread
From: Anthony Liguori @ 2009-01-21 18:13 UTC (permalink / raw)
  To: Avi Kivity; +Cc: qemu-devel

Avi Kivity wrote:
> Minor makefile cleanups; the most significant is the last patch which
> updates the makefile to generate Linux-style simpified output by default.
>   

Applied all.  Thanks.

Regards,

Anthony Liguori

> Changes from v1:
>  - fix build from outside source directory
>  - handle 'ar' utility
>
> Avi Kivity (6):
>   Drop OP_CFLAGS
>   Consolidate compiler invocations
>   Introduce rules.mak
>   Consolidate linker rules
>   Make make output quieter
>   Consolidate library creation
>
>  Makefile        |   29 ++++++------------
>  Makefile.target |   87 ++++++++++--------------------------------------------
>  rules.mak       |   19 ++++++++++++
>  3 files changed, 45 insertions(+), 90 deletions(-)
>  create mode 100644 rules.mak
>
>
>   

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2009-01-21 18:13 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [Qemu-devel] [PATCH 2/6] Consolidate compiler invocations Avi Kivity
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

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).