Commit 807544e27d868c5b9ac7f4a0f0a325bc8ceb77f3
1 parent
c7328801
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
Showing
2 changed files
with
13 additions
and
22 deletions
Makefile
| @@ -158,22 +158,18 @@ endif | @@ -158,22 +158,18 @@ endif | ||
| 158 | LIBS+=$(VDE_LIBS) | 158 | LIBS+=$(VDE_LIBS) |
| 159 | 159 | ||
| 160 | cocoa.o: cocoa.m | 160 | cocoa.o: cocoa.m |
| 161 | - $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $< | ||
| 162 | 161 | ||
| 163 | sdl.o: sdl.c keymaps.c sdl_keysym.h | 162 | sdl.o: sdl.c keymaps.c sdl_keysym.h |
| 164 | - $(CC) $(CFLAGS) $(CPPFLAGS) $(SDL_CFLAGS) -c -o $@ $< | 163 | + |
| 164 | +sdl.o audio/sdlaudio.o: CFLAGS += $(SDL_CFLAGS) | ||
| 165 | 165 | ||
| 166 | vnc.o: vnc.c keymaps.c sdl_keysym.h vnchextile.h d3des.c d3des.h | 166 | vnc.o: vnc.c keymaps.c sdl_keysym.h vnchextile.h d3des.c d3des.h |
| 167 | - $(CC) $(CFLAGS) $(CPPFLAGS) $(CONFIG_VNC_TLS_CFLAGS) -c -o $@ $< | ||
| 168 | 167 | ||
| 169 | -curses.o: curses.c keymaps.c curses_keys.h | ||
| 170 | - $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $< | 168 | +vnc.o: CFLAGS += $(CONFIG_VNC_TLS_CFLAGS) |
| 171 | 169 | ||
| 172 | -bt-host.o: bt-host.c | ||
| 173 | - $(CC) $(CFLAGS) $(CPPFLAGS) $(CONFIG_BLUEZ_CFLAGS) -c -o $@ $< | 170 | +curses.o: curses.c keymaps.c curses_keys.h |
| 174 | 171 | ||
| 175 | -audio/sdlaudio.o: audio/sdlaudio.c | ||
| 176 | - $(CC) $(CFLAGS) $(CPPFLAGS) $(SDL_CFLAGS) -c -o $@ $< | 172 | +bt-host.o: CFLAGS += $(CONFIG_BLUEZ_CFLAGS) |
| 177 | 173 | ||
| 178 | libqemu_common.a: $(OBJS) | 174 | libqemu_common.a: $(OBJS) |
| 179 | rm -f $@ | 175 | rm -f $@ |
| @@ -195,6 +191,9 @@ qemu-img$(EXESUF): qemu-img.o qemu-tool.o osdep.o $(BLOCK_OBJS) | @@ -195,6 +191,9 @@ qemu-img$(EXESUF): qemu-img.o qemu-tool.o osdep.o $(BLOCK_OBJS) | ||
| 195 | %.o: %.c | 191 | %.o: %.c |
| 196 | $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $< | 192 | $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $< |
| 197 | 193 | ||
| 194 | +%.o: %.m | ||
| 195 | + $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $< | ||
| 196 | + | ||
| 198 | qemu-nbd$(EXESUF): qemu-nbd.o qemu-tool.o osdep.o $(BLOCK_OBJS) | 197 | qemu-nbd$(EXESUF): qemu-nbd.o qemu-tool.o osdep.o $(BLOCK_OBJS) |
| 199 | $(CC) $(LDFLAGS) -o $@ $^ -lz $(LIBS) | 198 | $(CC) $(LDFLAGS) -o $@ $^ -lz $(LIBS) |
| 200 | 199 |
Makefile.target
| @@ -219,16 +219,11 @@ translate-all.o: translate-all.c cpu.h | @@ -219,16 +219,11 @@ translate-all.o: translate-all.c cpu.h | ||
| 219 | 219 | ||
| 220 | tcg/tcg.o: cpu.h | 220 | tcg/tcg.o: cpu.h |
| 221 | 221 | ||
| 222 | -machine.o: machine.c | ||
| 223 | - $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $< | ||
| 224 | - | ||
| 225 | # HELPER_CFLAGS is used for all the code compiled with static register | 222 | # HELPER_CFLAGS is used for all the code compiled with static register |
| 226 | # variables | 223 | # variables |
| 227 | -op_helper.o: op_helper.c | ||
| 228 | - $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(CFLAGS) $(I386_CFLAGS) -c -o $@ $< | 224 | +op_helper.o: CFLAGS += $(HELPER_CFLAGS) $(I386_CFLAGS) |
| 229 | 225 | ||
| 230 | -cpu-exec.o: cpu-exec.c | ||
| 231 | - $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(CFLAGS) -c -o $@ $< | 226 | +cpu-exec.o: CFLAGS += $(HELPER_CFLAGS) |
| 232 | 227 | ||
| 233 | ######################################################### | 228 | ######################################################### |
| 234 | # Linux user emulator target | 229 | # Linux user emulator target |
| @@ -356,8 +351,7 @@ OBJS+= libqemu.a | @@ -356,8 +351,7 @@ OBJS+= libqemu.a | ||
| 356 | 351 | ||
| 357 | # Note: this is a workaround. The real fix is to avoid compiling | 352 | # Note: this is a workaround. The real fix is to avoid compiling |
| 358 | # cpu_signal_handler() in cpu-exec.c. | 353 | # cpu_signal_handler() in cpu-exec.c. |
| 359 | -signal.o: signal.c | ||
| 360 | - $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(CFLAGS) -c -o $@ $< | 354 | +signal.o: CFLAGS += $(HELPER_CFLAGS) |
| 361 | 355 | ||
| 362 | $(QEMU_PROG): $(OBJS) ../libqemu_user.a | 356 | $(QEMU_PROG): $(OBJS) ../libqemu_user.a |
| 363 | $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) | 357 | $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) |
| @@ -392,8 +386,7 @@ endif | @@ -392,8 +386,7 @@ endif | ||
| 392 | 386 | ||
| 393 | # Note: this is a workaround. The real fix is to avoid compiling | 387 | # Note: this is a workaround. The real fix is to avoid compiling |
| 394 | # cpu_signal_handler() in cpu-exec.c. | 388 | # cpu_signal_handler() in cpu-exec.c. |
| 395 | -signal.o: signal.c | ||
| 396 | - $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(CFLAGS) -c -o $@ $< | 389 | +signal.o: CFLAGS += $(HELPER_CFLAGS) |
| 397 | 390 | ||
| 398 | $(QEMU_PROG): $(OBJS) | 391 | $(QEMU_PROG): $(OBJS) |
| 399 | $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) | 392 | $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) |
| @@ -497,8 +490,7 @@ endif | @@ -497,8 +490,7 @@ endif | ||
| 497 | 490 | ||
| 498 | # Note: this is a workaround. The real fix is to avoid compiling | 491 | # Note: this is a workaround. The real fix is to avoid compiling |
| 499 | # cpu_signal_handler() in cpu-exec.c. | 492 | # cpu_signal_handler() in cpu-exec.c. |
| 500 | -signal.o: signal.c | ||
| 501 | - $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(CFLAGS) -c -o $@ $< | 493 | +signal.o: CFLAGS += $(HELPER_CFLAGS) |
| 502 | 494 | ||
| 503 | $(QEMU_PROG): $(OBJS) ../libqemu_user.a | 495 | $(QEMU_PROG): $(OBJS) ../libqemu_user.a |
| 504 | $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) | 496 | $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) |