Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Consolidate compiler invocations (Avi Kivity)
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>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6377 c046a42c-6fe2-441c-8c8c-71466251a162
  • Loading branch information
aliguori committed Jan 21, 2009
1 parent c732880 commit 807544e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 22 deletions.
17 changes: 8 additions & 9 deletions Makefile
Expand Up @@ -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 $@
Expand All @@ -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)

Expand Down
18 changes: 5 additions & 13 deletions Makefile.target
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 807544e

Please sign in to comment.