diff mbox

[v2] Makefile: poison TARGET_xxx for compile once.

Message ID 20100625030240.GJ4498@valinux.co.jp
State New
Headers show

Commit Message

Isaku Yamahata June 25, 2010, 3:02 a.m. UTC
poison TARGET_xxx for compile once object
to prevent those ifdef from creeping in again.

didn't poison env which is used as function argument as void *env.
Although it would be possible to sort it out, for now just not poison it.

qemu-malloc.c didn't compile, so I make it non compile-once for now.
It is linked via block-obj-y in Makefile.obj and common-obj-y in
Makefile.objs through block-obj-y. So qemu-malloc.o is explicitly
added to rules.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
---
Changes v1 -> v2:
- tried to poison not only TARGET_<ARCH> but also TARGET_xxx.
- fix link breakage.
---
 Makefile        |   10 +++++-----
 Makefile.objs   |   11 ++++++++++-
 Makefile.target |    2 +-
 poison.h        |    2 ++
 4 files changed, 18 insertions(+), 7 deletions(-)
diff mbox

Patch

diff --git a/Makefile b/Makefile
index 221fbd8..233b2b1 100644
--- a/Makefile
+++ b/Makefile
@@ -79,8 +79,8 @@  ifneq ($(wildcard config-host.mak),)
 include $(SRC_PATH)/Makefile.objs
 endif
 
-$(common-obj-y): $(GENERATED_HEADERS)
-$(filter %-softmmu,$(SUBDIR_RULES)): $(common-obj-y) subdir-libdis
+$(common-obj-y) qemu-malloc.o: $(GENERATED_HEADERS)
+$(filter %-softmmu,$(SUBDIR_RULES)): $(common-obj-y) qemu-malloc.o subdir-libdis
 
 $(filter %-user,$(SUBDIR_RULES)): $(GENERATED_HEADERS) subdir-libdis-user subdir-libuser
 
@@ -137,11 +137,11 @@  iov.o: iov.c iov.h
 qemu-img.o: qemu-img-cmds.h
 qemu-img.o qemu-tool.o qemu-nbd.o qemu-io.o: $(GENERATED_HEADERS)
 
-qemu-img$(EXESUF): qemu-img.o qemu-tool.o qemu-error.o $(block-obj-y) $(qobject-obj-y)
+qemu-img$(EXESUF): qemu-img.o qemu-tool.o qemu-error.o qemu-malloc.o $(block-obj-y) $(qobject-obj-y)
 
-qemu-nbd$(EXESUF): qemu-nbd.o qemu-tool.o qemu-error.o $(block-obj-y) $(qobject-obj-y)
+qemu-nbd$(EXESUF): qemu-nbd.o qemu-tool.o qemu-error.o qemu-malloc.o $(block-obj-y) $(qobject-obj-y)
 
-qemu-io$(EXESUF): qemu-io.o cmd.o qemu-tool.o qemu-error.o $(block-obj-y) $(qobject-obj-y)
+qemu-io$(EXESUF): qemu-io.o cmd.o qemu-tool.o qemu-error.o qemu-malloc.o $(block-obj-y) $(qobject-obj-y)
 
 qemu-img-cmds.h: $(SRC_PATH)/qemu-img-cmds.hx
 	$(call quiet-command,sh $(SRC_PATH)/hxtool -h < $< > $@,"  GEN   $@")
diff --git a/Makefile.objs b/Makefile.objs
index 53fb68e..15764c4 100644
--- a/Makefile.objs
+++ b/Makefile.objs
@@ -7,7 +7,7 @@  qobject-obj-y += qerror.o
 #######################################################################
 # block-obj-y is code used by both qemu system emulation and qemu-img
 
-block-obj-y = cutils.o cache-utils.o qemu-malloc.o qemu-option.o module.o
+block-obj-y = cutils.o cache-utils.o qemu-option.o module.o
 block-obj-y += nbd.o block.o aio.o aes.o osdep.o qemu-config.o
 block-obj-$(CONFIG_POSIX) += posix-aio-compat.o
 block-obj-$(CONFIG_LINUX_AIO) += linux-aio.o
@@ -265,3 +265,12 @@  os-win32.o: qemu-options.def
 qemu-options.def: $(SRC_PATH)/qemu-options.hx
 	$(call quiet-command,sh $(SRC_PATH)/hxtool -h < $< > $@,"  GEN   $(TARGET_DIR)$@")
 
+
+######################################################################
+# poison TARGET_arch to prevent from creeping those defines again.
+
+POISON_CFLAGS = -include poison.h -DDONT_POISON_ENV
+$(qobject-obj-y) $(block-obj-y) $(block-nested-y) $(block-obj-y) \
+$(net-obj-y) $(net-nested-y) $(fsdev-nested-y) $(fsdev-obj-y) \
+$(common-obj-y) $(audio-obj-y) $(slirp-obj-y) $(user-obj-y) \
+$(hw-obj-y) $(sound-obj-y) $(libdis-y) vl.o: QEMU_CFLAGS += $(POISON_CFLAGS)
diff --git a/Makefile.target b/Makefile.target
index f64702b..91160b6 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -295,7 +295,7 @@  monitor.o: qemu-monitor.h
 
 $(obj-y) $(obj-$(TARGET_BASE_ARCH)-y): $(GENERATED_HEADERS)
 
-obj-y += $(addprefix ../, $(common-obj-y))
+obj-y += $(addprefix ../, $(common-obj-y) qemu-malloc.o)
 obj-y += $(addprefix ../libdis/, $(libdis-y))
 obj-y += $(libobj-y)
 obj-y += $(addprefix $(HWDIR)/, $(hw-obj-y))
diff --git a/poison.h b/poison.h
index d7db7f4..43af79a 100644
--- a/poison.h
+++ b/poison.h
@@ -34,7 +34,9 @@ 
 #pragma GCC poison TARGET_PAGE_ALIGN
 
 #pragma GCC poison CPUState
+#ifndef DONT_POISON_ENV
 #pragma GCC poison env
+#endif
 
 #pragma GCC poison CPU_INTERRUPT_HARD
 #pragma GCC poison CPU_INTERRUPT_EXITTB