qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] qemu Makefile configure
@ 2006-04-23 17:57 Paul Brook
  2006-04-30 15:04 ` Leonardo E. Reiter
  0 siblings, 1 reply; 17+ messages in thread
From: Paul Brook @ 2006-04-23 17:57 UTC (permalink / raw)
  To: qemu-devel

CVSROOT:	/sources/qemu
Module name:	qemu
Branch: 	
Changes by:	Paul Brook <pbrook@savannah.gnu.org>	06/04/23 17:57:59

Modified files:
	.              : Makefile configure 

Log message:
	Autodetect tools neccessary for building documentation.
	Make distclean remove generated documentation files.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/qemu/qemu/Makefile.diff?tr1=1.96&tr2=1.97&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/qemu/qemu/configure.diff?tr1=1.93&tr2=1.94&r1=text&r2=text

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

* Re: [Qemu-devel] qemu Makefile configure
  2006-04-23 17:57 Paul Brook
@ 2006-04-30 15:04 ` Leonardo E. Reiter
  0 siblings, 0 replies; 17+ messages in thread
From: Leonardo E. Reiter @ 2006-04-30 15:04 UTC (permalink / raw)
  To: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 843 bytes --]

Attached is a patch to fix 'make install' when the docs are not built
(it currently fails).

- Leo Reiter


Paul Brook wrote:
> CVSROOT:	/sources/qemu
> Module name:	qemu
> Branch: 	
> Changes by:	Paul Brook <pbrook@savannah.gnu.org>	06/04/23 17:57:59
> 
> Modified files:
> 	.              : Makefile configure 
> 
> Log message:
> 	Autodetect tools neccessary for building documentation.
> 	Make distclean remove generated documentation files.
> 
> CVSWeb URLs:
> http://cvs.savannah.gnu.org/viewcvs/qemu/qemu/Makefile.diff?tr1=1.96&tr2=1.97&r1=text&r2=text
> http://cvs.savannah.gnu.org/viewcvs/qemu/qemu/configure.diff?tr1=1.93&tr2=1.94&r1=text&r2=text

-- 
Leonardo E. Reiter
Vice President of Product Development, CTO

Win4Lin, Inc.
Virtual Computing that means Business
Main: +1 512 339 7979
Fax: +1 512 532 6501
http://www.win4lin.com

[-- Attachment #2: qemu-noinstall-doc.patch --]
[-- Type: text/x-patch, Size: 823 bytes --]

Index: Makefile
===================================================================
RCS file: /cvsroot/qemu/qemu/Makefile,v
retrieving revision 1.97
diff -a -u -r1.97 Makefile
--- Makefile	23 Apr 2006 17:57:59 -0000	1.97
+++ Makefile	30 Apr 2006 15:03:51 -0000
@@ -55,11 +55,15 @@
 			video.x proll.elf linux_boot.bin; do \
 		$(INSTALL) -m 644 $(SRC_PATH)/pc-bios/$$x "$(DESTDIR)$(datadir)"; \
 	done
+ifdef BUILD_DOCS
 	mkdir -p "$(DESTDIR)$(docdir)"
 	$(INSTALL) -m 644 qemu-doc.html  qemu-tech.html "$(DESTDIR)$(docdir)"
+endif
 ifndef CONFIG_WIN32
+ifdef BUILD_DOCS
 	mkdir -p "$(DESTDIR)$(mandir)/man1"
 	$(INSTALL) qemu.1 qemu-img.1 "$(DESTDIR)$(mandir)/man1"
+endif
 	mkdir -p "$(DESTDIR)$(datadir)/keymaps"
 	for x in $(KEYMAPS); do \
 		$(INSTALL) -m 644 $(SRC_PATH)/keymaps/$$x "$(DESTDIR)$(datadir)/keymaps"; \

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

* [Qemu-devel] qemu Makefile configure
@ 2007-01-01 21:31 Thiemo Seufer
  2007-01-03 13:59 ` Thiemo Seufer
  0 siblings, 1 reply; 17+ messages in thread
From: Thiemo Seufer @ 2007-01-01 21:31 UTC (permalink / raw)
  To: qemu-devel

CVSROOT:	/sources/qemu
Module name:	qemu
Changes by:	Thiemo Seufer <ths>	07/01/01 21:31:01

Modified files:
	.              : Makefile configure 

Log message:
	Fix Makefile weirdness.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/qemu/Makefile?cvsroot=qemu&r1=1.106&r2=1.107
http://cvs.savannah.gnu.org/viewcvs/qemu/configure?cvsroot=qemu&r1=1.114&r2=1.115

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

* Re: [Qemu-devel] qemu Makefile configure
  2007-01-01 21:31 Thiemo Seufer
@ 2007-01-03 13:59 ` Thiemo Seufer
  2007-01-03 14:23   ` Bernhard Fischer
                     ` (2 more replies)
  0 siblings, 3 replies; 17+ messages in thread
From: Thiemo Seufer @ 2007-01-03 13:59 UTC (permalink / raw)
  To: qemu-devel

Thiemo Seufer wrote:
> CVSROOT:	/sources/qemu
> Module name:	qemu
> Changes by:	Thiemo Seufer <ths>	07/01/01 21:31:01
> 
> Modified files:
> 	.              : Makefile configure 
> 
> Log message:
> 	Fix Makefile weirdness.
> 
> CVSWeb URLs:
> http://cvs.savannah.gnu.org/viewcvs/qemu/Makefile?cvsroot=qemu&r1=1.106&r2=1.107
> http://cvs.savannah.gnu.org/viewcvs/qemu/configure?cvsroot=qemu&r1=1.114&r2=1.115

As mentioned on IRC, this patch makes configure's --extra-cflags and
--extra-ldflags functional, but at the same time it breaks overriding
CFLAGS/LDFLAGS at make time.

The appended patch is an attempt to allow both, and to untangle the
various flags settings. It collects and records the overridable defaults
at configure time, adds OS_CFLAGS for mandatory OS specific flags,
prefers the more standard CPPFLAGS over other preprocessor flag names,
and OP_CFLAGS a separate set of flags which has also an overridable
portion.

All of this works fine for me, but patches of this sort are likely to
break things, so please test and comment.


Thiemo


Index: Makefile
===================================================================
RCS file: /sources/qemu/qemu/Makefile,v
retrieving revision 1.107
diff -u -p -r1.107 Makefile
--- Makefile	1 Jan 2007 21:31:01 -0000	1.107
+++ Makefile	3 Jan 2007 13:47:50 -0000
@@ -5,19 +5,15 @@ include config-host.mak
 .PHONY: all clean distclean dvi info install install-doc tar tarbin \
 	speed test test2 html dvi info
 
-CFLAGS+=-Wall -O2 -g -fno-strict-aliasing -I.
-ifdef CONFIG_DARWIN
-CFLAGS+= -mdynamic-no-pic
-endif
+CFLAGS += $(OS_CFLAGS)
 ifeq ($(ARCH),sparc)
-CFLAGS+=-mcpu=ultrasparc
+CFLAGS += -mcpu=ultrasparc
 endif
-LDFLAGS+=-g
+CPPFLAGS += -I. -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
 LIBS=
-DEFINES+=-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
 TOOLS=qemu-img$(EXESUF)
 ifdef CONFIG_STATIC
-LDFLAGS+=-static
+LDFLAGS += -static
 endif
 ifdef BUILD_DOCS
 DOCS=qemu-doc.html qemu-tech.html qemu.1 qemu-img.1
@@ -41,10 +37,10 @@ subdir-%: dyngen$(EXESUF)
 recurse-all: $(patsubst %,subdir-%, $(TARGET_DIRS))
 
 qemu-img$(EXESUF): qemu-img.c block.c block-raw.c block-cow.c block-qcow.c aes.c block-vmdk.c block-cloop.c block-dmg.c block-bochs.c block-vpc.c block-vvfat.c block-qcow2.c
-	$(CC) -DQEMU_TOOL $(CFLAGS) $(LDFLAGS) $(DEFINES) -o $@ $^ -lz $(LIBS)
+	$(CC) -DQEMU_TOOL $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o $@ $^ -lz $(LIBS)
 
 dyngen$(EXESUF): dyngen.c
-	$(HOST_CC) $(CFLAGS) $(DEFINES) -o $@ $^
+	$(HOST_CC) $(CFLAGS) $(CPPFLAGS) -o $@ $^
 
 clean:
 # avoid old build problems by removing potentially incorrect old files
Index: Makefile.target
===================================================================
RCS file: /sources/qemu/qemu/Makefile.target,v
retrieving revision 1.134
diff -u -p -r1.134 Makefile.target
--- Makefile.target	7 Dec 2006 18:15:35 -0000	1.134
+++ Makefile.target	3 Jan 2007 13:47:50 -0000
@@ -12,14 +12,12 @@ TARGET_BASE_ARCH:=sparc
 endif
 TARGET_PATH=$(SRC_PATH)/target-$(TARGET_BASE_ARCH)
 VPATH=$(SRC_PATH):$(TARGET_PATH):$(SRC_PATH)/hw:$(SRC_PATH)/audio
-DEFINES=-I. -I.. -I$(TARGET_PATH) -I$(SRC_PATH)
+CPPFLAGS=-I. -I.. -I$(TARGET_PATH) -I$(SRC_PATH)
 ifdef CONFIG_USER_ONLY
 VPATH+=:$(SRC_PATH)/linux-user
-DEFINES+=-I$(SRC_PATH)/linux-user -I$(SRC_PATH)/linux-user/$(TARGET_ARCH)
+CPPFLAGS+=-I$(SRC_PATH)/linux-user -I$(SRC_PATH)/linux-user/$(TARGET_ARCH)
 endif
-CFLAGS=-Wall -O2 -g -fno-strict-aliasing
 #CFLAGS+=-Werror
-LDFLAGS=-g
 LIBS=
 HELPER_CFLAGS=$(CFLAGS)
 DYNGEN=../dyngen$(EXESUF)
@@ -65,15 +63,17 @@ ifdef CONFIG_STATIC
 LDFLAGS+=-static
 endif
 
+# We require -O2 to avoid the stack setup prologue in EXIT_TB
+OP_CFLAGS = -Wall -O2 -g -fno-strict-aliasing
+
 ifeq ($(ARCH),i386)
-HELPER_CFLAGS:=$(CFLAGS) -fomit-frame-pointer
-OP_CFLAGS:=$(CFLAGS) -mpreferred-stack-boundary=2 -fomit-frame-pointer
+HELPER_CFLAGS+=-fomit-frame-pointer
+OP_CFLAGS+=-mpreferred-stack-boundary=2 -fomit-frame-pointer
 ifeq ($(HAVE_GCC3_OPTIONS),yes)
 OP_CFLAGS+= -falign-functions=0 -fno-gcse
 else
 OP_CFLAGS+= -malign-functions=0
 endif
-
 ifdef TARGET_GPROF
 USE_I386_LD=y
 endif
@@ -81,7 +81,7 @@ ifdef CONFIG_STATIC
 USE_I386_LD=y
 endif
 ifdef USE_I386_LD
-LDFLAGS+=-Wl,-T,$(SRC_PATH)/i386.ld
+LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
 else
 # WARNING: this LDFLAGS is _very_ tricky : qemu is an ELF shared object
 # that the kernel ELF loader considers as an executable. I think this
@@ -91,66 +91,66 @@ endif
 endif
 
 ifeq ($(ARCH),x86_64)
-OP_CFLAGS=$(CFLAGS) -falign-functions=0
-LDFLAGS+=-Wl,-T,$(SRC_PATH)/x86_64.ld
+LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
 endif
 
 ifeq ($(ARCH),ppc)
 CFLAGS+= -D__powerpc__
-OP_CFLAGS=$(CFLAGS)
-LDFLAGS+=-Wl,-T,$(SRC_PATH)/ppc.ld
+LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
 endif
 
 ifeq ($(ARCH),s390)
-OP_CFLAGS=$(CFLAGS)
-LDFLAGS+=-Wl,-T,$(SRC_PATH)/s390.ld
+LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
 endif
 
 ifeq ($(ARCH),sparc)
 ifeq ($(CONFIG_SOLARIS),yes)
 CFLAGS+=-mcpu=ultrasparc -m32 -ffixed-g2 -ffixed-g3
 LDFLAGS+=-m32
-OP_CFLAGS=$(CFLAGS) -fno-delayed-branch -fno-omit-frame-pointer -ffixed-i0
+OP_CFLAGS+=-fno-delayed-branch -fno-omit-frame-pointer -ffixed-i0
 else
 CFLAGS+=-mcpu=ultrasparc -m32 -ffixed-g1 -ffixed-g2 -ffixed-g3 -ffixed-g6
 LDFLAGS+=-m32
-OP_CFLAGS=$(CFLAGS) -fno-delayed-branch -ffixed-i0
+OP_CFLAGS+=-fno-delayed-branch -ffixed-i0
 HELPER_CFLAGS=$(CFLAGS) -ffixed-i0 -mflat
 # -static is used to avoid g1/g3 usage by the dynamic linker
-LDFLAGS+=-Wl,-T,$(SRC_PATH)/sparc.ld -static
+LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld -static
 endif
 endif
 
 ifeq ($(ARCH),sparc64)
 CFLAGS+=-mcpu=ultrasparc -m64 -ffixed-g1 -ffixed-g4 -ffixed-g5 -ffixed-g7
 LDFLAGS+=-m64
-LDFLAGS+=-Wl,-T,$(SRC_PATH)/sparc64.ld
-OP_CFLAGS=$(CFLAGS) -fno-delayed-branch -ffixed-i0
+LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
+OP_CFLAGS+=-mcpu=ultrasparc -m64 -ffixed-g1 -ffixed-g4 -ffixed-g5 -ffixed-g7 -fno-delayed-branch -ffixed-i0
 endif
 
 ifeq ($(ARCH),alpha)
-# -msmall-data is not used because we want two-instruction relocations
-# for the constant constructions
-OP_CFLAGS=-Wall -O2 -g
+# -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
-LDFLAGS+=-Wl,-T,$(SRC_PATH)/alpha.ld
+CFLAGS+=-msmall-data
+LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
 endif
 
 ifeq ($(ARCH),ia64)
-CFLAGS += -mno-sdata
-OP_CFLAGS=$(CFLAGS)
-LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/ia64.ld
+CFLAGS+=-mno-sdata
+OP_CFLAGS+=-mno-sdata
+LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/$(ARCH).ld
 endif
 
 ifeq ($(ARCH),arm)
-OP_CFLAGS=$(CFLAGS) -mno-sched-prolog -fno-omit-frame-pointer
-LDFLAGS+=-Wl,-T,$(SRC_PATH)/arm.ld
+OP_CFLAGS+=-mno-sched-prolog -fno-omit-frame-pointer
+LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
 endif
 
 ifeq ($(ARCH),m68k)
-OP_CFLAGS=$(CFLAGS) -fomit-frame-pointer
-LDFLAGS+=-Wl,-T,m68k.ld
+OP_CFLAGS+=-fomit-frame-pointer
+LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
+endif
+
+ifeq ($(ARCH),mips)
+LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
 endif
 
 ifeq ($(HAVE_GCC3_OPTIONS),yes)
@@ -159,13 +159,14 @@ OP_CFLAGS+=-fno-reorder-blocks -fno-opti
 endif
 
 ifeq ($(CONFIG_DARWIN),yes)
-OP_CFLAGS+= -mdynamic-no-pic
 LIBS+=-lmx
 endif
 
+OP_CFLAGS+=$(OS_CFLAGS)
+
 #########################################################
 
-DEFINES+=-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
+CPPFLAGS+=-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
 LIBS+=-lm
 ifndef CONFIG_USER_ONLY
 LIBS+=-lz
@@ -211,7 +212,7 @@ LIBOBJS+=fpu/softfloat.o
 else
 LIBOBJS+=fpu/softfloat-native.o
 endif
-DEFINES+=-I$(SRC_PATH)/fpu
+CPPFLAGS+=-I$(SRC_PATH)/fpu
 
 ifeq ($(TARGET_ARCH), i386)
 LIBOBJS+=helper.o helper2.o
@@ -324,7 +325,7 @@ LIBS += -lole32 -ldxguid
 endif
 ifdef CONFIG_FMOD
 AUDIODRV += fmodaudio.o
-audio.o fmodaudio.o: DEFINES := -I$(CONFIG_FMOD_INC) $(DEFINES)
+audio.o fmodaudio.o: CPPFLAGS := -I$(CONFIG_FMOD_INC) $(CPPFLAGS)
 LIBS += $(CONFIG_FMOD_LIB)
 endif
 ifdef CONFIG_ADLIB
@@ -347,14 +348,14 @@ VL_OBJS+= ide.o pckbd.o ps2.o vga.o $(SO
 VL_OBJS+= fdc.o mc146818rtc.o serial.o i8259.o i8254.o pcspk.o pc.o
 VL_OBJS+= cirrus_vga.o mixeng.o apic.o parallel.o acpi.o piix_pci.o
 VL_OBJS+= usb-uhci.o
-DEFINES += -DHAS_AUDIO
+CPPFLAGS += -DHAS_AUDIO
 endif
 ifeq ($(TARGET_BASE_ARCH), ppc)
 VL_OBJS+= ppc.o ide.o pckbd.o ps2.o vga.o $(SOUND_HW) dma.o $(AUDIODRV)
 VL_OBJS+= mc146818rtc.o serial.o i8259.o i8254.o fdc.o m48t59.o
 VL_OBJS+= ppc_prep.o ppc_chrp.o cuda.o adb.o openpic.o heathrow_pic.o mixeng.o
 VL_OBJS+= grackle_pci.o prep_pci.o unin_pci.o
-DEFINES += -DHAS_AUDIO
+CPPFLAGS += -DHAS_AUDIO
 endif
 ifeq ($(TARGET_ARCH), mips)
 VL_OBJS+= mips_r4k.o mips_timer.o dma.o vga.o serial.o i8254.o i8259.o ide.o
@@ -395,7 +396,7 @@ COCOA_LIBS+=-framework CoreAudio
 endif
 endif
 ifdef CONFIG_SLIRP
-DEFINES+=-I$(SRC_PATH)/slirp
+CPPFLAGS+=-I$(SRC_PATH)/slirp
 SLIRP_OBJS=cksum.o if.o ip_icmp.o ip_input.o ip_output.o \
 slirp.o mbuf.o misc.o sbuf.o socket.o tcp_input.o tcp_output.o \
 tcp_subr.o tcp_timer.o udp.o bootp.o debug.o tftp.o
@@ -439,22 +440,22 @@ $(QEMU_SYSTEM): $(VL_OBJS) libqemu.a
 	$(CC) $(VL_LDFLAGS) -o $@ $^ $(LIBS) $(SDL_LIBS) $(COCOA_LIBS) $(VL_LIBS)
 
 cocoa.o: cocoa.m
-	$(CC) $(CFLAGS) $(DEFINES) -c -o $@ $<
+	$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
 
 sdl.o: sdl.c keymaps.c sdl_keysym.h
-	$(CC) $(CFLAGS) $(DEFINES) $(SDL_CFLAGS) -c -o $@ $<
+	$(CC) $(CFLAGS) $(CPPFLAGS) $(SDL_CFLAGS) -c -o $@ $<
 
 vnc.o: vnc.c keymaps.c sdl_keysym.h vnchextile.h
-	$(CC) $(CFLAGS) $(DEFINES) -c -o $@ $<
+	$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
 
 sdlaudio.o: sdlaudio.c
-	$(CC) $(CFLAGS) $(DEFINES) $(SDL_CFLAGS) -c -o $@ $<
+	$(CC) $(CFLAGS) $(CPPFLAGS) $(SDL_CFLAGS) -c -o $@ $<
 
 depend: $(SRCS)
-	$(CC) -MM $(CFLAGS) $(DEFINES) $^ 1>.depend
+	$(CC) -MM $(CFLAGS) $(CPPFLAGS) $^ 1>.depend
 
 vldepend: $(VL_OBJS:.o=.c)
-	$(CC) -MM $(CFLAGS) $(DEFINES) $^ 1>.depend
+	$(CC) -MM $(CFLAGS) $(CPPFLAGS) $^ 1>.depend
 
 # libqemu 
 
@@ -478,26 +479,26 @@ gen-op.h: op.o $(DYNGEN)
 	$(DYNGEN) -g -o $@ $<
 
 op.o: op.c
-	$(CC) $(OP_CFLAGS) $(DEFINES) -c -o $@ $<
+	$(CC) $(OP_CFLAGS) $(CPPFLAGS) -c -o $@ $<
 
 # HELPER_CFLAGS is used for all the code compiled with static register
 # variables
 ifeq ($(TARGET_BASE_ARCH), i386)
 # XXX: rename helper.c to op_helper.c
 helper.o: helper.c
-	$(CC) $(HELPER_CFLAGS) $(DEFINES) -c -o $@ $<
+	$(CC) $(HELPER_CFLAGS) $(CPPFLAGS) -c -o $@ $<
 else
 op_helper.o: op_helper.c
-	$(CC) $(HELPER_CFLAGS) $(DEFINES) -c -o $@ $<
+	$(CC) $(HELPER_CFLAGS) $(CPPFLAGS) -c -o $@ $<
 endif
 
 cpu-exec.o: cpu-exec.c
-	$(CC) $(HELPER_CFLAGS) $(DEFINES) -c -o $@ $<
+	$(CC) $(HELPER_CFLAGS) $(CPPFLAGS) -c -o $@ $<
 
 # 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) $(DEFINES) -c -o $@ $<
+	$(CC) $(HELPER_CFLAGS) $(CPPFLAGS) -c -o $@ $<
 
 ifeq ($(TARGET_BASE_ARCH), i386)
 op.o: op.c opreg_template.h ops_template.h ops_template_mem.h ops_mem.h ops_sse.h
@@ -539,10 +540,10 @@ endif
 $(OBJS) $(LIBOBJS) $(VL_OBJS): config.h ../config-host.h
 
 %.o: %.c
-	$(CC) $(CFLAGS) $(DEFINES) -c -o $@ $<
+	$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
 
 %.o: %.S
-	$(CC) $(DEFINES) -c -o $@ $<
+	$(CC) $(CPPFLAGS) -c -o $@ $<
 
 clean:
 	rm -f *.o  *.a *~ $(PROGS) gen-op.h opc.h op.h nwfpe/*.o slirp/*.o fpu/*.o
Index: configure
===================================================================
RCS file: /sources/qemu/qemu/configure,v
retrieving revision 1.115
diff -u -p -r1.115 configure
--- configure	1 Jan 2007 21:31:01 -0000	1.115
+++ configure	3 Jan 2007 13:47:50 -0000
@@ -103,7 +103,7 @@ targetos=`uname -s`
 case $targetos in
 CYGWIN*)
 mingw32="yes"
-CFLAGS="-O2 -mno-cygwin"
+OS_CFLAGS="-mno-cygwin"
 ;;
 MINGW32*)
 mingw32="yes"
@@ -126,6 +126,7 @@ oss="yes"
 Darwin)
 bsd="yes"
 darwin="yes"
+OS_CFLAGS="-mdynamic-no-pic"
 ;;
 SunOS)
 solaris="yes"
@@ -243,6 +244,10 @@ for opt do
   esac
 done
 
+# default flags for all hosts
+CFLAGS=$CFLAGS "-Wall -O2 -g -fno-strict-aliasing"
+LDFLAGS=$LDFLAGS "-g"
+
 if test x"$show_help" = x"yes" ; then
 cat << EOF
 
@@ -599,12 +604,10 @@ echo "#define CONFIG_QEMU_SHAREDIR \"$da
 echo "MAKE=$make" >> $config_mak
 echo "INSTALL=$install" >> $config_mak
 echo "CC=$cc" >> $config_mak
-if test "$have_gcc3_options" = "yes" ; then
-  echo "HAVE_GCC3_OPTIONS=yes" >> $config_mak
-fi
 echo "HOST_CC=$host_cc" >> $config_mak
 echo "AR=$ar" >> $config_mak
 echo "STRIP=$strip -s -R .comment -R .note" >> $config_mak
+echo "OS_CFLAGS=$OS_CFLAGS" >> $config_mak
 echo "CFLAGS=$CFLAGS" >> $config_mak
 echo "LDFLAGS=$LDFLAGS" >> $config_mak
 echo "EXESUF=$EXESUF" >> $config_mak

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

* Re: [Qemu-devel] qemu Makefile configure
  2007-01-03 13:59 ` Thiemo Seufer
@ 2007-01-03 14:23   ` Bernhard Fischer
  2007-01-03 15:09     ` Thiemo Seufer
  2007-01-07 21:58     ` Pierre d'Herbemont
  2007-01-03 14:42   ` Thiemo Seufer
  2007-01-03 15:43   ` Fabrice Bellard
  2 siblings, 2 replies; 17+ messages in thread
From: Bernhard Fischer @ 2007-01-03 14:23 UTC (permalink / raw)
  To: qemu-devel

On Wed, Jan 03, 2007 at 01:59:50PM +0000, Thiemo Seufer wrote:

>All of this works fine for me, but patches of this sort are likely to
>break things, so please test and comment.
>
>
>Thiemo
>

>Index: Makefile.target
>===================================================================
>RCS file: /sources/qemu/qemu/Makefile.target,v
>retrieving revision 1.134
>diff -u -p -r1.134 Makefile.target
>--- Makefile.target	7 Dec 2006 18:15:35 -0000	1.134
>+++ Makefile.target	3 Jan 2007 13:47:50 -0000
>@@ -91,66 +91,66 @@ endif
> endif
> 
> ifeq ($(ARCH),x86_64)
>-OP_CFLAGS=$(CFLAGS) -falign-functions=0
>-LDFLAGS+=-Wl,-T,$(SRC_PATH)/x86_64.ld
>+LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
> endif
> 
> ifeq ($(ARCH),ppc)
-> CFLAGS+= -D__powerpc__
+ CPPFLAGS += -D__powerpc__

(doesn't cpp already define that on ppc?)

>Index: configure
>===================================================================
>RCS file: /sources/qemu/qemu/configure,v
>retrieving revision 1.115
>diff -u -p -r1.115 configure
>--- configure	1 Jan 2007 21:31:01 -0000	1.115
>+++ configure	3 Jan 2007 13:47:50 -0000
>@@ -243,6 +244,10 @@ for opt do
>   esac
> done
> 
>+# default flags for all hosts
>+CFLAGS=$CFLAGS "-Wall -O2 -g -fno-strict-aliasing"
>+LDFLAGS=$LDFLAGS "-g"

Does that really work for you?
I'd rather say
LDFLAGS="$LDFLAGS -g"

cheers,

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

* Re: [Qemu-devel] qemu Makefile configure
  2007-01-03 13:59 ` Thiemo Seufer
  2007-01-03 14:23   ` Bernhard Fischer
@ 2007-01-03 14:42   ` Thiemo Seufer
  2007-01-03 14:55     ` Daniel Jacobowitz
  2007-01-03 15:43   ` Fabrice Bellard
  2 siblings, 1 reply; 17+ messages in thread
From: Thiemo Seufer @ 2007-01-03 14:42 UTC (permalink / raw)
  To: qemu-devel

Thiemo Seufer wrote:
> Thiemo Seufer wrote:
> > CVSROOT:	/sources/qemu
> > Module name:	qemu
> > Changes by:	Thiemo Seufer <ths>	07/01/01 21:31:01
> > 
> > Modified files:
> > 	.              : Makefile configure 
> > 
> > Log message:
> > 	Fix Makefile weirdness.
> > 
> > CVSWeb URLs:
> > http://cvs.savannah.gnu.org/viewcvs/qemu/Makefile?cvsroot=qemu&r1=1.106&r2=1.107
> > http://cvs.savannah.gnu.org/viewcvs/qemu/configure?cvsroot=qemu&r1=1.114&r2=1.115
> 
> As mentioned on IRC, this patch makes configure's --extra-cflags and
> --extra-ldflags functional, but at the same time it breaks overriding
> CFLAGS/LDFLAGS at make time.
> 
> The appended patch is an attempt to allow both, and to untangle the
> various flags settings. It collects and records the overridable defaults
> at configure time, adds OS_CFLAGS for mandatory OS specific flags,
> prefers the more standard CPPFLAGS over other preprocessor flag names,
> and OP_CFLAGS a separate set of flags which has also an overridable
> portion.
> 
> All of this works fine for me, but patches of this sort are likely to
> break things, so please test and comment.

With that prelude I just had to introduce an obvious bug. :-) Next try.


Thiemo
Index: Makefile
===================================================================
RCS file: /sources/qemu/qemu/Makefile,v
retrieving revision 1.107
diff -u -p -r1.107 Makefile
--- Makefile	1 Jan 2007 21:31:01 -0000	1.107
+++ Makefile	3 Jan 2007 14:40:11 -0000
@@ -5,19 +5,15 @@ include config-host.mak
 .PHONY: all clean distclean dvi info install install-doc tar tarbin \
 	speed test test2 html dvi info
 
-CFLAGS+=-Wall -O2 -g -fno-strict-aliasing -I.
-ifdef CONFIG_DARWIN
-CFLAGS+= -mdynamic-no-pic
-endif
+CFLAGS += $(OS_CFLAGS)
 ifeq ($(ARCH),sparc)
-CFLAGS+=-mcpu=ultrasparc
+CFLAGS += -mcpu=ultrasparc
 endif
-LDFLAGS+=-g
+CPPFLAGS += -I. -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
 LIBS=
-DEFINES+=-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
 TOOLS=qemu-img$(EXESUF)
 ifdef CONFIG_STATIC
-LDFLAGS+=-static
+LDFLAGS += -static
 endif
 ifdef BUILD_DOCS
 DOCS=qemu-doc.html qemu-tech.html qemu.1 qemu-img.1
@@ -41,10 +37,10 @@ subdir-%: dyngen$(EXESUF)
 recurse-all: $(patsubst %,subdir-%, $(TARGET_DIRS))
 
 qemu-img$(EXESUF): qemu-img.c block.c block-raw.c block-cow.c block-qcow.c aes.c block-vmdk.c block-cloop.c block-dmg.c block-bochs.c block-vpc.c block-vvfat.c block-qcow2.c
-	$(CC) -DQEMU_TOOL $(CFLAGS) $(LDFLAGS) $(DEFINES) -o $@ $^ -lz $(LIBS)
+	$(CC) -DQEMU_TOOL $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o $@ $^ -lz $(LIBS)
 
 dyngen$(EXESUF): dyngen.c
-	$(HOST_CC) $(CFLAGS) $(DEFINES) -o $@ $^
+	$(HOST_CC) $(CFLAGS) $(CPPFLAGS) -o $@ $^
 
 clean:
 # avoid old build problems by removing potentially incorrect old files
Index: Makefile.target
===================================================================
RCS file: /sources/qemu/qemu/Makefile.target,v
retrieving revision 1.134
diff -u -p -r1.134 Makefile.target
--- Makefile.target	7 Dec 2006 18:15:35 -0000	1.134
+++ Makefile.target	3 Jan 2007 14:40:11 -0000
@@ -12,14 +12,12 @@ TARGET_BASE_ARCH:=sparc
 endif
 TARGET_PATH=$(SRC_PATH)/target-$(TARGET_BASE_ARCH)
 VPATH=$(SRC_PATH):$(TARGET_PATH):$(SRC_PATH)/hw:$(SRC_PATH)/audio
-DEFINES=-I. -I.. -I$(TARGET_PATH) -I$(SRC_PATH)
+CPPFLAGS=-I. -I.. -I$(TARGET_PATH) -I$(SRC_PATH)
 ifdef CONFIG_USER_ONLY
 VPATH+=:$(SRC_PATH)/linux-user
-DEFINES+=-I$(SRC_PATH)/linux-user -I$(SRC_PATH)/linux-user/$(TARGET_ARCH)
+CPPFLAGS+=-I$(SRC_PATH)/linux-user -I$(SRC_PATH)/linux-user/$(TARGET_ARCH)
 endif
-CFLAGS=-Wall -O2 -g -fno-strict-aliasing
 #CFLAGS+=-Werror
-LDFLAGS=-g
 LIBS=
 HELPER_CFLAGS=$(CFLAGS)
 DYNGEN=../dyngen$(EXESUF)
@@ -65,15 +63,17 @@ ifdef CONFIG_STATIC
 LDFLAGS+=-static
 endif
 
+# We require -O2 to avoid the stack setup prologue in EXIT_TB
+OP_CFLAGS := -Wall -O2 -g -fno-strict-aliasing
+
 ifeq ($(ARCH),i386)
-HELPER_CFLAGS:=$(CFLAGS) -fomit-frame-pointer
-OP_CFLAGS:=$(CFLAGS) -mpreferred-stack-boundary=2 -fomit-frame-pointer
+HELPER_CFLAGS+=-fomit-frame-pointer
+OP_CFLAGS+=-mpreferred-stack-boundary=2 -fomit-frame-pointer
 ifeq ($(HAVE_GCC3_OPTIONS),yes)
 OP_CFLAGS+= -falign-functions=0 -fno-gcse
 else
 OP_CFLAGS+= -malign-functions=0
 endif
-
 ifdef TARGET_GPROF
 USE_I386_LD=y
 endif
@@ -81,7 +81,7 @@ ifdef CONFIG_STATIC
 USE_I386_LD=y
 endif
 ifdef USE_I386_LD
-LDFLAGS+=-Wl,-T,$(SRC_PATH)/i386.ld
+LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
 else
 # WARNING: this LDFLAGS is _very_ tricky : qemu is an ELF shared object
 # that the kernel ELF loader considers as an executable. I think this
@@ -91,66 +91,66 @@ endif
 endif
 
 ifeq ($(ARCH),x86_64)
-OP_CFLAGS=$(CFLAGS) -falign-functions=0
-LDFLAGS+=-Wl,-T,$(SRC_PATH)/x86_64.ld
+LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
 endif
 
 ifeq ($(ARCH),ppc)
 CFLAGS+= -D__powerpc__
-OP_CFLAGS=$(CFLAGS)
-LDFLAGS+=-Wl,-T,$(SRC_PATH)/ppc.ld
+LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
 endif
 
 ifeq ($(ARCH),s390)
-OP_CFLAGS=$(CFLAGS)
-LDFLAGS+=-Wl,-T,$(SRC_PATH)/s390.ld
+LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
 endif
 
 ifeq ($(ARCH),sparc)
 ifeq ($(CONFIG_SOLARIS),yes)
 CFLAGS+=-mcpu=ultrasparc -m32 -ffixed-g2 -ffixed-g3
 LDFLAGS+=-m32
-OP_CFLAGS=$(CFLAGS) -fno-delayed-branch -fno-omit-frame-pointer -ffixed-i0
+OP_CFLAGS+=-fno-delayed-branch -fno-omit-frame-pointer -ffixed-i0
 else
 CFLAGS+=-mcpu=ultrasparc -m32 -ffixed-g1 -ffixed-g2 -ffixed-g3 -ffixed-g6
 LDFLAGS+=-m32
-OP_CFLAGS=$(CFLAGS) -fno-delayed-branch -ffixed-i0
+OP_CFLAGS+=-fno-delayed-branch -ffixed-i0
 HELPER_CFLAGS=$(CFLAGS) -ffixed-i0 -mflat
 # -static is used to avoid g1/g3 usage by the dynamic linker
-LDFLAGS+=-Wl,-T,$(SRC_PATH)/sparc.ld -static
+LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld -static
 endif
 endif
 
 ifeq ($(ARCH),sparc64)
 CFLAGS+=-mcpu=ultrasparc -m64 -ffixed-g1 -ffixed-g4 -ffixed-g5 -ffixed-g7
 LDFLAGS+=-m64
-LDFLAGS+=-Wl,-T,$(SRC_PATH)/sparc64.ld
-OP_CFLAGS=$(CFLAGS) -fno-delayed-branch -ffixed-i0
+LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
+OP_CFLAGS+=-mcpu=ultrasparc -m64 -ffixed-g1 -ffixed-g4 -ffixed-g5 -ffixed-g7 -fno-delayed-branch -ffixed-i0
 endif
 
 ifeq ($(ARCH),alpha)
-# -msmall-data is not used because we want two-instruction relocations
-# for the constant constructions
-OP_CFLAGS=-Wall -O2 -g
+# -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
-LDFLAGS+=-Wl,-T,$(SRC_PATH)/alpha.ld
+CFLAGS+=-msmall-data
+LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
 endif
 
 ifeq ($(ARCH),ia64)
-CFLAGS += -mno-sdata
-OP_CFLAGS=$(CFLAGS)
-LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/ia64.ld
+CFLAGS+=-mno-sdata
+OP_CFLAGS+=-mno-sdata
+LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/$(ARCH).ld
 endif
 
 ifeq ($(ARCH),arm)
-OP_CFLAGS=$(CFLAGS) -mno-sched-prolog -fno-omit-frame-pointer
-LDFLAGS+=-Wl,-T,$(SRC_PATH)/arm.ld
+OP_CFLAGS+=-mno-sched-prolog -fno-omit-frame-pointer
+LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
 endif
 
 ifeq ($(ARCH),m68k)
-OP_CFLAGS=$(CFLAGS) -fomit-frame-pointer
-LDFLAGS+=-Wl,-T,m68k.ld
+OP_CFLAGS+=-fomit-frame-pointer
+LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
+endif
+
+ifeq ($(ARCH),mips)
+LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
 endif
 
 ifeq ($(HAVE_GCC3_OPTIONS),yes)
@@ -159,13 +159,14 @@ OP_CFLAGS+=-fno-reorder-blocks -fno-opti
 endif
 
 ifeq ($(CONFIG_DARWIN),yes)
-OP_CFLAGS+= -mdynamic-no-pic
 LIBS+=-lmx
 endif
 
+OP_CFLAGS+=$(OS_CFLAGS)
+
 #########################################################
 
-DEFINES+=-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
+CPPFLAGS+=-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
 LIBS+=-lm
 ifndef CONFIG_USER_ONLY
 LIBS+=-lz
@@ -211,7 +212,7 @@ LIBOBJS+=fpu/softfloat.o
 else
 LIBOBJS+=fpu/softfloat-native.o
 endif
-DEFINES+=-I$(SRC_PATH)/fpu
+CPPFLAGS+=-I$(SRC_PATH)/fpu
 
 ifeq ($(TARGET_ARCH), i386)
 LIBOBJS+=helper.o helper2.o
@@ -324,7 +325,7 @@ LIBS += -lole32 -ldxguid
 endif
 ifdef CONFIG_FMOD
 AUDIODRV += fmodaudio.o
-audio.o fmodaudio.o: DEFINES := -I$(CONFIG_FMOD_INC) $(DEFINES)
+audio.o fmodaudio.o: CPPFLAGS := -I$(CONFIG_FMOD_INC) $(CPPFLAGS)
 LIBS += $(CONFIG_FMOD_LIB)
 endif
 ifdef CONFIG_ADLIB
@@ -347,14 +348,14 @@ VL_OBJS+= ide.o pckbd.o ps2.o vga.o $(SO
 VL_OBJS+= fdc.o mc146818rtc.o serial.o i8259.o i8254.o pcspk.o pc.o
 VL_OBJS+= cirrus_vga.o mixeng.o apic.o parallel.o acpi.o piix_pci.o
 VL_OBJS+= usb-uhci.o
-DEFINES += -DHAS_AUDIO
+CPPFLAGS += -DHAS_AUDIO
 endif
 ifeq ($(TARGET_BASE_ARCH), ppc)
 VL_OBJS+= ppc.o ide.o pckbd.o ps2.o vga.o $(SOUND_HW) dma.o $(AUDIODRV)
 VL_OBJS+= mc146818rtc.o serial.o i8259.o i8254.o fdc.o m48t59.o
 VL_OBJS+= ppc_prep.o ppc_chrp.o cuda.o adb.o openpic.o heathrow_pic.o mixeng.o
 VL_OBJS+= grackle_pci.o prep_pci.o unin_pci.o
-DEFINES += -DHAS_AUDIO
+CPPFLAGS += -DHAS_AUDIO
 endif
 ifeq ($(TARGET_ARCH), mips)
 VL_OBJS+= mips_r4k.o mips_timer.o dma.o vga.o serial.o i8254.o i8259.o ide.o
@@ -395,7 +396,7 @@ COCOA_LIBS+=-framework CoreAudio
 endif
 endif
 ifdef CONFIG_SLIRP
-DEFINES+=-I$(SRC_PATH)/slirp
+CPPFLAGS+=-I$(SRC_PATH)/slirp
 SLIRP_OBJS=cksum.o if.o ip_icmp.o ip_input.o ip_output.o \
 slirp.o mbuf.o misc.o sbuf.o socket.o tcp_input.o tcp_output.o \
 tcp_subr.o tcp_timer.o udp.o bootp.o debug.o tftp.o
@@ -439,22 +440,22 @@ $(QEMU_SYSTEM): $(VL_OBJS) libqemu.a
 	$(CC) $(VL_LDFLAGS) -o $@ $^ $(LIBS) $(SDL_LIBS) $(COCOA_LIBS) $(VL_LIBS)
 
 cocoa.o: cocoa.m
-	$(CC) $(CFLAGS) $(DEFINES) -c -o $@ $<
+	$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
 
 sdl.o: sdl.c keymaps.c sdl_keysym.h
-	$(CC) $(CFLAGS) $(DEFINES) $(SDL_CFLAGS) -c -o $@ $<
+	$(CC) $(CFLAGS) $(CPPFLAGS) $(SDL_CFLAGS) -c -o $@ $<
 
 vnc.o: vnc.c keymaps.c sdl_keysym.h vnchextile.h
-	$(CC) $(CFLAGS) $(DEFINES) -c -o $@ $<
+	$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
 
 sdlaudio.o: sdlaudio.c
-	$(CC) $(CFLAGS) $(DEFINES) $(SDL_CFLAGS) -c -o $@ $<
+	$(CC) $(CFLAGS) $(CPPFLAGS) $(SDL_CFLAGS) -c -o $@ $<
 
 depend: $(SRCS)
-	$(CC) -MM $(CFLAGS) $(DEFINES) $^ 1>.depend
+	$(CC) -MM $(CFLAGS) $(CPPFLAGS) $^ 1>.depend
 
 vldepend: $(VL_OBJS:.o=.c)
-	$(CC) -MM $(CFLAGS) $(DEFINES) $^ 1>.depend
+	$(CC) -MM $(CFLAGS) $(CPPFLAGS) $^ 1>.depend
 
 # libqemu 
 
@@ -478,26 +479,26 @@ gen-op.h: op.o $(DYNGEN)
 	$(DYNGEN) -g -o $@ $<
 
 op.o: op.c
-	$(CC) $(OP_CFLAGS) $(DEFINES) -c -o $@ $<
+	$(CC) $(OP_CFLAGS) $(CPPFLAGS) -c -o $@ $<
 
 # HELPER_CFLAGS is used for all the code compiled with static register
 # variables
 ifeq ($(TARGET_BASE_ARCH), i386)
 # XXX: rename helper.c to op_helper.c
 helper.o: helper.c
-	$(CC) $(HELPER_CFLAGS) $(DEFINES) -c -o $@ $<
+	$(CC) $(HELPER_CFLAGS) $(CPPFLAGS) -c -o $@ $<
 else
 op_helper.o: op_helper.c
-	$(CC) $(HELPER_CFLAGS) $(DEFINES) -c -o $@ $<
+	$(CC) $(HELPER_CFLAGS) $(CPPFLAGS) -c -o $@ $<
 endif
 
 cpu-exec.o: cpu-exec.c
-	$(CC) $(HELPER_CFLAGS) $(DEFINES) -c -o $@ $<
+	$(CC) $(HELPER_CFLAGS) $(CPPFLAGS) -c -o $@ $<
 
 # 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) $(DEFINES) -c -o $@ $<
+	$(CC) $(HELPER_CFLAGS) $(CPPFLAGS) -c -o $@ $<
 
 ifeq ($(TARGET_BASE_ARCH), i386)
 op.o: op.c opreg_template.h ops_template.h ops_template_mem.h ops_mem.h ops_sse.h
@@ -539,10 +540,10 @@ endif
 $(OBJS) $(LIBOBJS) $(VL_OBJS): config.h ../config-host.h
 
 %.o: %.c
-	$(CC) $(CFLAGS) $(DEFINES) -c -o $@ $<
+	$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
 
 %.o: %.S
-	$(CC) $(DEFINES) -c -o $@ $<
+	$(CC) $(CPPFLAGS) -c -o $@ $<
 
 clean:
 	rm -f *.o  *.a *~ $(PROGS) gen-op.h opc.h op.h nwfpe/*.o slirp/*.o fpu/*.o
Index: configure
===================================================================
RCS file: /sources/qemu/qemu/configure,v
retrieving revision 1.115
diff -u -p -r1.115 configure
--- configure	1 Jan 2007 21:31:01 -0000	1.115
+++ configure	3 Jan 2007 14:40:12 -0000
@@ -103,7 +103,7 @@ targetos=`uname -s`
 case $targetos in
 CYGWIN*)
 mingw32="yes"
-CFLAGS="-O2 -mno-cygwin"
+OS_CFLAGS="-mno-cygwin"
 ;;
 MINGW32*)
 mingw32="yes"
@@ -126,6 +126,7 @@ oss="yes"
 Darwin)
 bsd="yes"
 darwin="yes"
+OS_CFLAGS="-mdynamic-no-pic"
 ;;
 SunOS)
 solaris="yes"
@@ -243,6 +244,10 @@ for opt do
   esac
 done
 
+# default flags for all hosts
+CFLAGS=$CFLAGS "-Wall -O2 -g -fno-strict-aliasing"
+LDFLAGS=$LDFLAGS "-g"
+
 if test x"$show_help" = x"yes" ; then
 cat << EOF
 
@@ -599,12 +604,10 @@ echo "#define CONFIG_QEMU_SHAREDIR \"$da
 echo "MAKE=$make" >> $config_mak
 echo "INSTALL=$install" >> $config_mak
 echo "CC=$cc" >> $config_mak
-if test "$have_gcc3_options" = "yes" ; then
-  echo "HAVE_GCC3_OPTIONS=yes" >> $config_mak
-fi
 echo "HOST_CC=$host_cc" >> $config_mak
 echo "AR=$ar" >> $config_mak
 echo "STRIP=$strip -s -R .comment -R .note" >> $config_mak
+echo "OS_CFLAGS=$OS_CFLAGS" >> $config_mak
 echo "CFLAGS=$CFLAGS" >> $config_mak
 echo "LDFLAGS=$LDFLAGS" >> $config_mak
 echo "EXESUF=$EXESUF" >> $config_mak

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

* Re: [Qemu-devel] qemu Makefile configure
  2007-01-03 14:42   ` Thiemo Seufer
@ 2007-01-03 14:55     ` Daniel Jacobowitz
  2007-01-03 15:36       ` Thiemo Seufer
  0 siblings, 1 reply; 17+ messages in thread
From: Daniel Jacobowitz @ 2007-01-03 14:55 UTC (permalink / raw)
  To: qemu-devel

On Wed, Jan 03, 2007 at 02:42:20PM +0000, Thiemo Seufer wrote:
> +CFLAGS += $(OS_CFLAGS)

Did you try this on any target that triggers one of the += cases?

It's not the most intuitive thing in the world, but I believe make
ignores Makefile += operators if the variable was overridden on the
command line (i.e. the override effectively happens after the +=).
You'd need to leave CFLAGS for the overrideable bits unless you
wanted to override all the += deliberately.

-- 
Daniel Jacobowitz
CodeSourcery

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

* Re: [Qemu-devel] qemu Makefile configure
  2007-01-03 14:23   ` Bernhard Fischer
@ 2007-01-03 15:09     ` Thiemo Seufer
  2007-01-07 21:58     ` Pierre d'Herbemont
  1 sibling, 0 replies; 17+ messages in thread
From: Thiemo Seufer @ 2007-01-03 15:09 UTC (permalink / raw)
  To: Bernhard Fischer; +Cc: qemu-devel

Bernhard Fischer wrote:
> On Wed, Jan 03, 2007 at 01:59:50PM +0000, Thiemo Seufer wrote:
> 
> >All of this works fine for me, but patches of this sort are likely to
> >break things, so please test and comment.
> >
> >
> >Thiemo
> >
> 
> >Index: Makefile.target
> >===================================================================
> >RCS file: /sources/qemu/qemu/Makefile.target,v
> >retrieving revision 1.134
> >diff -u -p -r1.134 Makefile.target
> >--- Makefile.target	7 Dec 2006 18:15:35 -0000	1.134
> >+++ Makefile.target	3 Jan 2007 13:47:50 -0000
> >@@ -91,66 +91,66 @@ endif
> > endif
> > 
> > ifeq ($(ARCH),x86_64)
> >-OP_CFLAGS=$(CFLAGS) -falign-functions=0
> >-LDFLAGS+=-Wl,-T,$(SRC_PATH)/x86_64.ld
> >+LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
> > endif
> > 
> > ifeq ($(ARCH),ppc)
> -> CFLAGS+= -D__powerpc__
> + CPPFLAGS += -D__powerpc__
> 
> (doesn't cpp already define that on ppc?)

Apparently it's sometimes __ppc__.


Thiemo

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

* Re: [Qemu-devel] qemu Makefile configure
  2007-01-03 14:55     ` Daniel Jacobowitz
@ 2007-01-03 15:36       ` Thiemo Seufer
  0 siblings, 0 replies; 17+ messages in thread
From: Thiemo Seufer @ 2007-01-03 15:36 UTC (permalink / raw)
  To: qemu-devel

Daniel Jacobowitz wrote:
> On Wed, Jan 03, 2007 at 02:42:20PM +0000, Thiemo Seufer wrote:
> > +CFLAGS += $(OS_CFLAGS)
> 
> Did you try this on any target that triggers one of the += cases?
> 
> It's not the most intuitive thing in the world, but I believe make
> ignores Makefile += operators if the variable was overridden on the
> command line (i.e. the override effectively happens after the +=).

You are right.

> You'd need to leave CFLAGS for the overrideable bits unless you
> wanted to override all the += deliberately.

I think I have to use "override CFLAGS += -ffoo".


Thiemo

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

* Re: [Qemu-devel] qemu Makefile configure
  2007-01-03 13:59 ` Thiemo Seufer
  2007-01-03 14:23   ` Bernhard Fischer
  2007-01-03 14:42   ` Thiemo Seufer
@ 2007-01-03 15:43   ` Fabrice Bellard
  2007-01-03 16:16     ` Thiemo Seufer
  2 siblings, 1 reply; 17+ messages in thread
From: Fabrice Bellard @ 2007-01-03 15:43 UTC (permalink / raw)
  To: qemu-devel

IMHO, CFLAGS and LDFLAGS overriding should not be allowed for QEMU as it 
is almost sure to break the dyngen stuff. If ever it is allowed, it 
should be done so that the CFLAGS for the files used by dyngen are not 
modified.

Fabrice.

Thiemo Seufer wrote:
> Thiemo Seufer wrote:
> 
>>CVSROOT:	/sources/qemu
>>Module name:	qemu
>>Changes by:	Thiemo Seufer <ths>	07/01/01 21:31:01
>>
>>Modified files:
>>	.              : Makefile configure 
>>
>>Log message:
>>	Fix Makefile weirdness.
>>
>>CVSWeb URLs:
>>http://cvs.savannah.gnu.org/viewcvs/qemu/Makefile?cvsroot=qemu&r1=1.106&r2=1.107
>>http://cvs.savannah.gnu.org/viewcvs/qemu/configure?cvsroot=qemu&r1=1.114&r2=1.115
> 
> 
> As mentioned on IRC, this patch makes configure's --extra-cflags and
> --extra-ldflags functional, but at the same time it breaks overriding
> CFLAGS/LDFLAGS at make time.
> 
> The appended patch is an attempt to allow both, and to untangle the
> various flags settings. It collects and records the overridable defaults
> at configure time, adds OS_CFLAGS for mandatory OS specific flags,
> prefers the more standard CPPFLAGS over other preprocessor flag names,
> and OP_CFLAGS a separate set of flags which has also an overridable
> portion.
> 
> All of this works fine for me, but patches of this sort are likely to
> break things, so please test and comment.
> 
> 
> Thiemo
> 
> 
> Index: Makefile
> ===================================================================
> RCS file: /sources/qemu/qemu/Makefile,v
> retrieving revision 1.107
> diff -u -p -r1.107 Makefile
> --- Makefile	1 Jan 2007 21:31:01 -0000	1.107
> +++ Makefile	3 Jan 2007 13:47:50 -0000
> @@ -5,19 +5,15 @@ include config-host.mak
>  .PHONY: all clean distclean dvi info install install-doc tar tarbin \
>  	speed test test2 html dvi info
>  
> -CFLAGS+=-Wall -O2 -g -fno-strict-aliasing -I.
> -ifdef CONFIG_DARWIN
> -CFLAGS+= -mdynamic-no-pic
> -endif
> +CFLAGS += $(OS_CFLAGS)
>  ifeq ($(ARCH),sparc)
> -CFLAGS+=-mcpu=ultrasparc
> +CFLAGS += -mcpu=ultrasparc
>  endif
> -LDFLAGS+=-g
> +CPPFLAGS += -I. -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
>  LIBS=
> -DEFINES+=-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
>  TOOLS=qemu-img$(EXESUF)
>  ifdef CONFIG_STATIC
> -LDFLAGS+=-static
> +LDFLAGS += -static
>  endif
>  ifdef BUILD_DOCS
>  DOCS=qemu-doc.html qemu-tech.html qemu.1 qemu-img.1
> @@ -41,10 +37,10 @@ subdir-%: dyngen$(EXESUF)
>  recurse-all: $(patsubst %,subdir-%, $(TARGET_DIRS))
>  
>  qemu-img$(EXESUF): qemu-img.c block.c block-raw.c block-cow.c block-qcow.c aes.c block-vmdk.c block-cloop.c block-dmg.c block-bochs.c block-vpc.c block-vvfat.c block-qcow2.c
> -	$(CC) -DQEMU_TOOL $(CFLAGS) $(LDFLAGS) $(DEFINES) -o $@ $^ -lz $(LIBS)
> +	$(CC) -DQEMU_TOOL $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o $@ $^ -lz $(LIBS)
>  
>  dyngen$(EXESUF): dyngen.c
> -	$(HOST_CC) $(CFLAGS) $(DEFINES) -o $@ $^
> +	$(HOST_CC) $(CFLAGS) $(CPPFLAGS) -o $@ $^
>  
>  clean:
>  # avoid old build problems by removing potentially incorrect old files
> Index: Makefile.target
> ===================================================================
> RCS file: /sources/qemu/qemu/Makefile.target,v
> retrieving revision 1.134
> diff -u -p -r1.134 Makefile.target
> --- Makefile.target	7 Dec 2006 18:15:35 -0000	1.134
> +++ Makefile.target	3 Jan 2007 13:47:50 -0000
> @@ -12,14 +12,12 @@ TARGET_BASE_ARCH:=sparc
>  endif
>  TARGET_PATH=$(SRC_PATH)/target-$(TARGET_BASE_ARCH)
>  VPATH=$(SRC_PATH):$(TARGET_PATH):$(SRC_PATH)/hw:$(SRC_PATH)/audio
> -DEFINES=-I. -I.. -I$(TARGET_PATH) -I$(SRC_PATH)
> +CPPFLAGS=-I. -I.. -I$(TARGET_PATH) -I$(SRC_PATH)
>  ifdef CONFIG_USER_ONLY
>  VPATH+=:$(SRC_PATH)/linux-user
> -DEFINES+=-I$(SRC_PATH)/linux-user -I$(SRC_PATH)/linux-user/$(TARGET_ARCH)
> +CPPFLAGS+=-I$(SRC_PATH)/linux-user -I$(SRC_PATH)/linux-user/$(TARGET_ARCH)
>  endif
> -CFLAGS=-Wall -O2 -g -fno-strict-aliasing
>  #CFLAGS+=-Werror
> -LDFLAGS=-g
>  LIBS=
>  HELPER_CFLAGS=$(CFLAGS)
>  DYNGEN=../dyngen$(EXESUF)
> @@ -65,15 +63,17 @@ ifdef CONFIG_STATIC
>  LDFLAGS+=-static
>  endif
>  
> +# We require -O2 to avoid the stack setup prologue in EXIT_TB
> +OP_CFLAGS = -Wall -O2 -g -fno-strict-aliasing
> +
>  ifeq ($(ARCH),i386)
> -HELPER_CFLAGS:=$(CFLAGS) -fomit-frame-pointer
> -OP_CFLAGS:=$(CFLAGS) -mpreferred-stack-boundary=2 -fomit-frame-pointer
> +HELPER_CFLAGS+=-fomit-frame-pointer
> +OP_CFLAGS+=-mpreferred-stack-boundary=2 -fomit-frame-pointer
>  ifeq ($(HAVE_GCC3_OPTIONS),yes)
>  OP_CFLAGS+= -falign-functions=0 -fno-gcse
>  else
>  OP_CFLAGS+= -malign-functions=0
>  endif
> -
>  ifdef TARGET_GPROF
>  USE_I386_LD=y
>  endif
> @@ -81,7 +81,7 @@ ifdef CONFIG_STATIC
>  USE_I386_LD=y
>  endif
>  ifdef USE_I386_LD
> -LDFLAGS+=-Wl,-T,$(SRC_PATH)/i386.ld
> +LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
>  else
>  # WARNING: this LDFLAGS is _very_ tricky : qemu is an ELF shared object
>  # that the kernel ELF loader considers as an executable. I think this
> @@ -91,66 +91,66 @@ endif
>  endif
>  
>  ifeq ($(ARCH),x86_64)
> -OP_CFLAGS=$(CFLAGS) -falign-functions=0
> -LDFLAGS+=-Wl,-T,$(SRC_PATH)/x86_64.ld
> +LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
>  endif
>  
>  ifeq ($(ARCH),ppc)
>  CFLAGS+= -D__powerpc__
> -OP_CFLAGS=$(CFLAGS)
> -LDFLAGS+=-Wl,-T,$(SRC_PATH)/ppc.ld
> +LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
>  endif
>  
>  ifeq ($(ARCH),s390)
> -OP_CFLAGS=$(CFLAGS)
> -LDFLAGS+=-Wl,-T,$(SRC_PATH)/s390.ld
> +LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
>  endif
>  
>  ifeq ($(ARCH),sparc)
>  ifeq ($(CONFIG_SOLARIS),yes)
>  CFLAGS+=-mcpu=ultrasparc -m32 -ffixed-g2 -ffixed-g3
>  LDFLAGS+=-m32
> -OP_CFLAGS=$(CFLAGS) -fno-delayed-branch -fno-omit-frame-pointer -ffixed-i0
> +OP_CFLAGS+=-fno-delayed-branch -fno-omit-frame-pointer -ffixed-i0
>  else
>  CFLAGS+=-mcpu=ultrasparc -m32 -ffixed-g1 -ffixed-g2 -ffixed-g3 -ffixed-g6
>  LDFLAGS+=-m32
> -OP_CFLAGS=$(CFLAGS) -fno-delayed-branch -ffixed-i0
> +OP_CFLAGS+=-fno-delayed-branch -ffixed-i0
>  HELPER_CFLAGS=$(CFLAGS) -ffixed-i0 -mflat
>  # -static is used to avoid g1/g3 usage by the dynamic linker
> -LDFLAGS+=-Wl,-T,$(SRC_PATH)/sparc.ld -static
> +LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld -static
>  endif
>  endif
>  
>  ifeq ($(ARCH),sparc64)
>  CFLAGS+=-mcpu=ultrasparc -m64 -ffixed-g1 -ffixed-g4 -ffixed-g5 -ffixed-g7
>  LDFLAGS+=-m64
> -LDFLAGS+=-Wl,-T,$(SRC_PATH)/sparc64.ld
> -OP_CFLAGS=$(CFLAGS) -fno-delayed-branch -ffixed-i0
> +LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
> +OP_CFLAGS+=-mcpu=ultrasparc -m64 -ffixed-g1 -ffixed-g4 -ffixed-g5 -ffixed-g7 -fno-delayed-branch -ffixed-i0
>  endif
>  
>  ifeq ($(ARCH),alpha)
> -# -msmall-data is not used because we want two-instruction relocations
> -# for the constant constructions
> -OP_CFLAGS=-Wall -O2 -g
> +# -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
> -LDFLAGS+=-Wl,-T,$(SRC_PATH)/alpha.ld
> +CFLAGS+=-msmall-data
> +LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
>  endif
>  
>  ifeq ($(ARCH),ia64)
> -CFLAGS += -mno-sdata
> -OP_CFLAGS=$(CFLAGS)
> -LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/ia64.ld
> +CFLAGS+=-mno-sdata
> +OP_CFLAGS+=-mno-sdata
> +LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/$(ARCH).ld
>  endif
>  
>  ifeq ($(ARCH),arm)
> -OP_CFLAGS=$(CFLAGS) -mno-sched-prolog -fno-omit-frame-pointer
> -LDFLAGS+=-Wl,-T,$(SRC_PATH)/arm.ld
> +OP_CFLAGS+=-mno-sched-prolog -fno-omit-frame-pointer
> +LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
>  endif
>  
>  ifeq ($(ARCH),m68k)
> -OP_CFLAGS=$(CFLAGS) -fomit-frame-pointer
> -LDFLAGS+=-Wl,-T,m68k.ld
> +OP_CFLAGS+=-fomit-frame-pointer
> +LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
> +endif
> +
> +ifeq ($(ARCH),mips)
> +LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
>  endif
>  
>  ifeq ($(HAVE_GCC3_OPTIONS),yes)
> @@ -159,13 +159,14 @@ OP_CFLAGS+=-fno-reorder-blocks -fno-opti
>  endif
>  
>  ifeq ($(CONFIG_DARWIN),yes)
> -OP_CFLAGS+= -mdynamic-no-pic
>  LIBS+=-lmx
>  endif
>  
> +OP_CFLAGS+=$(OS_CFLAGS)
> +
>  #########################################################
>  
> -DEFINES+=-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
> +CPPFLAGS+=-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
>  LIBS+=-lm
>  ifndef CONFIG_USER_ONLY
>  LIBS+=-lz
> @@ -211,7 +212,7 @@ LIBOBJS+=fpu/softfloat.o
>  else
>  LIBOBJS+=fpu/softfloat-native.o
>  endif
> -DEFINES+=-I$(SRC_PATH)/fpu
> +CPPFLAGS+=-I$(SRC_PATH)/fpu
>  
>  ifeq ($(TARGET_ARCH), i386)
>  LIBOBJS+=helper.o helper2.o
> @@ -324,7 +325,7 @@ LIBS += -lole32 -ldxguid
>  endif
>  ifdef CONFIG_FMOD
>  AUDIODRV += fmodaudio.o
> -audio.o fmodaudio.o: DEFINES := -I$(CONFIG_FMOD_INC) $(DEFINES)
> +audio.o fmodaudio.o: CPPFLAGS := -I$(CONFIG_FMOD_INC) $(CPPFLAGS)
>  LIBS += $(CONFIG_FMOD_LIB)
>  endif
>  ifdef CONFIG_ADLIB
> @@ -347,14 +348,14 @@ VL_OBJS+= ide.o pckbd.o ps2.o vga.o $(SO
>  VL_OBJS+= fdc.o mc146818rtc.o serial.o i8259.o i8254.o pcspk.o pc.o
>  VL_OBJS+= cirrus_vga.o mixeng.o apic.o parallel.o acpi.o piix_pci.o
>  VL_OBJS+= usb-uhci.o
> -DEFINES += -DHAS_AUDIO
> +CPPFLAGS += -DHAS_AUDIO
>  endif
>  ifeq ($(TARGET_BASE_ARCH), ppc)
>  VL_OBJS+= ppc.o ide.o pckbd.o ps2.o vga.o $(SOUND_HW) dma.o $(AUDIODRV)
>  VL_OBJS+= mc146818rtc.o serial.o i8259.o i8254.o fdc.o m48t59.o
>  VL_OBJS+= ppc_prep.o ppc_chrp.o cuda.o adb.o openpic.o heathrow_pic.o mixeng.o
>  VL_OBJS+= grackle_pci.o prep_pci.o unin_pci.o
> -DEFINES += -DHAS_AUDIO
> +CPPFLAGS += -DHAS_AUDIO
>  endif
>  ifeq ($(TARGET_ARCH), mips)
>  VL_OBJS+= mips_r4k.o mips_timer.o dma.o vga.o serial.o i8254.o i8259.o ide.o
> @@ -395,7 +396,7 @@ COCOA_LIBS+=-framework CoreAudio
>  endif
>  endif
>  ifdef CONFIG_SLIRP
> -DEFINES+=-I$(SRC_PATH)/slirp
> +CPPFLAGS+=-I$(SRC_PATH)/slirp
>  SLIRP_OBJS=cksum.o if.o ip_icmp.o ip_input.o ip_output.o \
>  slirp.o mbuf.o misc.o sbuf.o socket.o tcp_input.o tcp_output.o \
>  tcp_subr.o tcp_timer.o udp.o bootp.o debug.o tftp.o
> @@ -439,22 +440,22 @@ $(QEMU_SYSTEM): $(VL_OBJS) libqemu.a
>  	$(CC) $(VL_LDFLAGS) -o $@ $^ $(LIBS) $(SDL_LIBS) $(COCOA_LIBS) $(VL_LIBS)
>  
>  cocoa.o: cocoa.m
> -	$(CC) $(CFLAGS) $(DEFINES) -c -o $@ $<
> +	$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
>  
>  sdl.o: sdl.c keymaps.c sdl_keysym.h
> -	$(CC) $(CFLAGS) $(DEFINES) $(SDL_CFLAGS) -c -o $@ $<
> +	$(CC) $(CFLAGS) $(CPPFLAGS) $(SDL_CFLAGS) -c -o $@ $<
>  
>  vnc.o: vnc.c keymaps.c sdl_keysym.h vnchextile.h
> -	$(CC) $(CFLAGS) $(DEFINES) -c -o $@ $<
> +	$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
>  
>  sdlaudio.o: sdlaudio.c
> -	$(CC) $(CFLAGS) $(DEFINES) $(SDL_CFLAGS) -c -o $@ $<
> +	$(CC) $(CFLAGS) $(CPPFLAGS) $(SDL_CFLAGS) -c -o $@ $<
>  
>  depend: $(SRCS)
> -	$(CC) -MM $(CFLAGS) $(DEFINES) $^ 1>.depend
> +	$(CC) -MM $(CFLAGS) $(CPPFLAGS) $^ 1>.depend
>  
>  vldepend: $(VL_OBJS:.o=.c)
> -	$(CC) -MM $(CFLAGS) $(DEFINES) $^ 1>.depend
> +	$(CC) -MM $(CFLAGS) $(CPPFLAGS) $^ 1>.depend
>  
>  # libqemu 
>  
> @@ -478,26 +479,26 @@ gen-op.h: op.o $(DYNGEN)
>  	$(DYNGEN) -g -o $@ $<
>  
>  op.o: op.c
> -	$(CC) $(OP_CFLAGS) $(DEFINES) -c -o $@ $<
> +	$(CC) $(OP_CFLAGS) $(CPPFLAGS) -c -o $@ $<
>  
>  # HELPER_CFLAGS is used for all the code compiled with static register
>  # variables
>  ifeq ($(TARGET_BASE_ARCH), i386)
>  # XXX: rename helper.c to op_helper.c
>  helper.o: helper.c
> -	$(CC) $(HELPER_CFLAGS) $(DEFINES) -c -o $@ $<
> +	$(CC) $(HELPER_CFLAGS) $(CPPFLAGS) -c -o $@ $<
>  else
>  op_helper.o: op_helper.c
> -	$(CC) $(HELPER_CFLAGS) $(DEFINES) -c -o $@ $<
> +	$(CC) $(HELPER_CFLAGS) $(CPPFLAGS) -c -o $@ $<
>  endif
>  
>  cpu-exec.o: cpu-exec.c
> -	$(CC) $(HELPER_CFLAGS) $(DEFINES) -c -o $@ $<
> +	$(CC) $(HELPER_CFLAGS) $(CPPFLAGS) -c -o $@ $<
>  
>  # 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) $(DEFINES) -c -o $@ $<
> +	$(CC) $(HELPER_CFLAGS) $(CPPFLAGS) -c -o $@ $<
>  
>  ifeq ($(TARGET_BASE_ARCH), i386)
>  op.o: op.c opreg_template.h ops_template.h ops_template_mem.h ops_mem.h ops_sse.h
> @@ -539,10 +540,10 @@ endif
>  $(OBJS) $(LIBOBJS) $(VL_OBJS): config.h ../config-host.h
>  
>  %.o: %.c
> -	$(CC) $(CFLAGS) $(DEFINES) -c -o $@ $<
> +	$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
>  
>  %.o: %.S
> -	$(CC) $(DEFINES) -c -o $@ $<
> +	$(CC) $(CPPFLAGS) -c -o $@ $<
>  
>  clean:
>  	rm -f *.o  *.a *~ $(PROGS) gen-op.h opc.h op.h nwfpe/*.o slirp/*.o fpu/*.o
> Index: configure
> ===================================================================
> RCS file: /sources/qemu/qemu/configure,v
> retrieving revision 1.115
> diff -u -p -r1.115 configure
> --- configure	1 Jan 2007 21:31:01 -0000	1.115
> +++ configure	3 Jan 2007 13:47:50 -0000
> @@ -103,7 +103,7 @@ targetos=`uname -s`
>  case $targetos in
>  CYGWIN*)
>  mingw32="yes"
> -CFLAGS="-O2 -mno-cygwin"
> +OS_CFLAGS="-mno-cygwin"
>  ;;
>  MINGW32*)
>  mingw32="yes"
> @@ -126,6 +126,7 @@ oss="yes"
>  Darwin)
>  bsd="yes"
>  darwin="yes"
> +OS_CFLAGS="-mdynamic-no-pic"
>  ;;
>  SunOS)
>  solaris="yes"
> @@ -243,6 +244,10 @@ for opt do
>    esac
>  done
>  
> +# default flags for all hosts
> +CFLAGS=$CFLAGS "-Wall -O2 -g -fno-strict-aliasing"
> +LDFLAGS=$LDFLAGS "-g"
> +
>  if test x"$show_help" = x"yes" ; then
>  cat << EOF
>  
> @@ -599,12 +604,10 @@ echo "#define CONFIG_QEMU_SHAREDIR \"$da
>  echo "MAKE=$make" >> $config_mak
>  echo "INSTALL=$install" >> $config_mak
>  echo "CC=$cc" >> $config_mak
> -if test "$have_gcc3_options" = "yes" ; then
> -  echo "HAVE_GCC3_OPTIONS=yes" >> $config_mak
> -fi
>  echo "HOST_CC=$host_cc" >> $config_mak
>  echo "AR=$ar" >> $config_mak
>  echo "STRIP=$strip -s -R .comment -R .note" >> $config_mak
> +echo "OS_CFLAGS=$OS_CFLAGS" >> $config_mak
>  echo "CFLAGS=$CFLAGS" >> $config_mak
>  echo "LDFLAGS=$LDFLAGS" >> $config_mak
>  echo "EXESUF=$EXESUF" >> $config_mak
> 
> 
> _______________________________________________
> Qemu-devel mailing list
> Qemu-devel@nongnu.org
> http://lists.nongnu.org/mailman/listinfo/qemu-devel
> 
> 

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

* Re: [Qemu-devel] qemu Makefile configure
  2007-01-03 15:43   ` Fabrice Bellard
@ 2007-01-03 16:16     ` Thiemo Seufer
  2007-01-03 16:58       ` Bernhard Fischer
  2007-01-04 12:26       ` Thiemo Seufer
  0 siblings, 2 replies; 17+ messages in thread
From: Thiemo Seufer @ 2007-01-03 16:16 UTC (permalink / raw)
  To: qemu-devel

Fabrice Bellard wrote:
> IMHO, CFLAGS and LDFLAGS overriding should not be allowed for QEMU as it 
> is almost sure to break the dyngen stuff. If ever it is allowed, it 
> should be done so that the CFLAGS for the files used by dyngen are not 
> modified.

That's why I made OP_CFLAGS a separate set of flags.

I append the next version of the patch, which incorporates the
suggestions made by Daniel and Bernhard, and fixes a gcc3 detection
bug I introduced earlier.


Thiemo


Index: Makefile
===================================================================
RCS file: /sources/qemu/qemu/Makefile,v
retrieving revision 1.107
diff -u -p -r1.107 Makefile
--- Makefile	1 Jan 2007 21:31:01 -0000	1.107
+++ Makefile	3 Jan 2007 16:10:06 -0000
@@ -5,19 +5,15 @@ include config-host.mak
 .PHONY: all clean distclean dvi info install install-doc tar tarbin \
 	speed test test2 html dvi info
 
-CFLAGS+=-Wall -O2 -g -fno-strict-aliasing -I.
-ifdef CONFIG_DARWIN
-CFLAGS+= -mdynamic-no-pic
-endif
+override CFLAGS += $(OS_CFLAGS)
 ifeq ($(ARCH),sparc)
-CFLAGS+=-mcpu=ultrasparc
+override CFLAGS += -mcpu=ultrasparc
 endif
-LDFLAGS+=-g
+CPPFLAGS += -I. -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
 LIBS=
-DEFINES+=-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
 TOOLS=qemu-img$(EXESUF)
 ifdef CONFIG_STATIC
-LDFLAGS+=-static
+override LDFLAGS += -static
 endif
 ifdef BUILD_DOCS
 DOCS=qemu-doc.html qemu-tech.html qemu.1 qemu-img.1
@@ -41,10 +37,10 @@ subdir-%: dyngen$(EXESUF)
 recurse-all: $(patsubst %,subdir-%, $(TARGET_DIRS))
 
 qemu-img$(EXESUF): qemu-img.c block.c block-raw.c block-cow.c block-qcow.c aes.c block-vmdk.c block-cloop.c block-dmg.c block-bochs.c block-vpc.c block-vvfat.c block-qcow2.c
-	$(CC) -DQEMU_TOOL $(CFLAGS) $(LDFLAGS) $(DEFINES) -o $@ $^ -lz $(LIBS)
+	$(CC) -DQEMU_TOOL $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o $@ $^ -lz $(LIBS)
 
 dyngen$(EXESUF): dyngen.c
-	$(HOST_CC) $(CFLAGS) $(DEFINES) -o $@ $^
+	$(HOST_CC) $(CFLAGS) $(CPPFLAGS) -o $@ $^
 
 clean:
 # avoid old build problems by removing potentially incorrect old files
Index: Makefile.target
===================================================================
RCS file: /sources/qemu/qemu/Makefile.target,v
retrieving revision 1.134
diff -u -p -r1.134 Makefile.target
--- Makefile.target	7 Dec 2006 18:15:35 -0000	1.134
+++ Makefile.target	3 Jan 2007 16:10:07 -0000
@@ -12,14 +12,12 @@ TARGET_BASE_ARCH:=sparc
 endif
 TARGET_PATH=$(SRC_PATH)/target-$(TARGET_BASE_ARCH)
 VPATH=$(SRC_PATH):$(TARGET_PATH):$(SRC_PATH)/hw:$(SRC_PATH)/audio
-DEFINES=-I. -I.. -I$(TARGET_PATH) -I$(SRC_PATH)
+CPPFLAGS=-I. -I.. -I$(TARGET_PATH) -I$(SRC_PATH)
 ifdef CONFIG_USER_ONLY
 VPATH+=:$(SRC_PATH)/linux-user
-DEFINES+=-I$(SRC_PATH)/linux-user -I$(SRC_PATH)/linux-user/$(TARGET_ARCH)
+CPPFLAGS+=-I$(SRC_PATH)/linux-user -I$(SRC_PATH)/linux-user/$(TARGET_ARCH)
 endif
-CFLAGS=-Wall -O2 -g -fno-strict-aliasing
 #CFLAGS+=-Werror
-LDFLAGS=-g
 LIBS=
 HELPER_CFLAGS=$(CFLAGS)
 DYNGEN=../dyngen$(EXESUF)
@@ -62,18 +60,20 @@ endif
 endif # !CONFIG_USER_ONLY
 
 ifdef CONFIG_STATIC
-LDFLAGS+=-static
+override LDFLAGS+=-static
 endif
 
+# We require -O2 to avoid the stack setup prologue in EXIT_TB
+OP_CFLAGS := -Wall -O2 -g -fno-strict-aliasing
+
 ifeq ($(ARCH),i386)
-HELPER_CFLAGS:=$(CFLAGS) -fomit-frame-pointer
-OP_CFLAGS:=$(CFLAGS) -mpreferred-stack-boundary=2 -fomit-frame-pointer
+HELPER_CFLAGS+=-fomit-frame-pointer
+override OP_CFLAGS+=-mpreferred-stack-boundary=2 -fomit-frame-pointer
 ifeq ($(HAVE_GCC3_OPTIONS),yes)
-OP_CFLAGS+= -falign-functions=0 -fno-gcse
+override OP_CFLAGS+= -falign-functions=0 -fno-gcse
 else
-OP_CFLAGS+= -malign-functions=0
+override OP_CFLAGS+= -malign-functions=0
 endif
-
 ifdef TARGET_GPROF
 USE_I386_LD=y
 endif
@@ -81,91 +81,92 @@ ifdef CONFIG_STATIC
 USE_I386_LD=y
 endif
 ifdef USE_I386_LD
-LDFLAGS+=-Wl,-T,$(SRC_PATH)/i386.ld
+override LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
 else
 # WARNING: this LDFLAGS is _very_ tricky : qemu is an ELF shared object
 # that the kernel ELF loader considers as an executable. I think this
 # is the simplest way to make it self virtualizable!
-LDFLAGS+=-Wl,-shared
+override LDFLAGS+=-Wl,-shared
 endif
 endif
 
 ifeq ($(ARCH),x86_64)
-OP_CFLAGS=$(CFLAGS) -falign-functions=0
-LDFLAGS+=-Wl,-T,$(SRC_PATH)/x86_64.ld
+override LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
 endif
 
 ifeq ($(ARCH),ppc)
-CFLAGS+= -D__powerpc__
-OP_CFLAGS=$(CFLAGS)
-LDFLAGS+=-Wl,-T,$(SRC_PATH)/ppc.ld
+CPPFLAGS+= -D__powerpc__
+override LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
 endif
 
 ifeq ($(ARCH),s390)
-OP_CFLAGS=$(CFLAGS)
-LDFLAGS+=-Wl,-T,$(SRC_PATH)/s390.ld
+override LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
 endif
 
 ifeq ($(ARCH),sparc)
 ifeq ($(CONFIG_SOLARIS),yes)
-CFLAGS+=-mcpu=ultrasparc -m32 -ffixed-g2 -ffixed-g3
-LDFLAGS+=-m32
-OP_CFLAGS=$(CFLAGS) -fno-delayed-branch -fno-omit-frame-pointer -ffixed-i0
+override CFLAGS+=-mcpu=ultrasparc -m32 -ffixed-g2 -ffixed-g3
+override LDFLAGS+=-m32
+override OP_CFLAGS+=-fno-delayed-branch -fno-omit-frame-pointer -ffixed-i0
 else
-CFLAGS+=-mcpu=ultrasparc -m32 -ffixed-g1 -ffixed-g2 -ffixed-g3 -ffixed-g6
-LDFLAGS+=-m32
-OP_CFLAGS=$(CFLAGS) -fno-delayed-branch -ffixed-i0
+override CFLAGS+=-mcpu=ultrasparc -m32 -ffixed-g1 -ffixed-g2 -ffixed-g3 -ffixed-g6
+override LDFLAGS+=-m32
+override OP_CFLAGS+=-fno-delayed-branch -ffixed-i0
 HELPER_CFLAGS=$(CFLAGS) -ffixed-i0 -mflat
 # -static is used to avoid g1/g3 usage by the dynamic linker
-LDFLAGS+=-Wl,-T,$(SRC_PATH)/sparc.ld -static
+override LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld -static
 endif
 endif
 
 ifeq ($(ARCH),sparc64)
-CFLAGS+=-mcpu=ultrasparc -m64 -ffixed-g1 -ffixed-g4 -ffixed-g5 -ffixed-g7
-LDFLAGS+=-m64
-LDFLAGS+=-Wl,-T,$(SRC_PATH)/sparc64.ld
-OP_CFLAGS=$(CFLAGS) -fno-delayed-branch -ffixed-i0
+override CFLAGS+=-mcpu=ultrasparc -m64 -ffixed-g1 -ffixed-g4 -ffixed-g5 -ffixed-g7
+override LDFLAGS+=-m64
+override LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
+override OP_CFLAGS+=-mcpu=ultrasparc -m64 -ffixed-g1 -ffixed-g4 -ffixed-g5 -ffixed-g7 -fno-delayed-branch -ffixed-i0
 endif
 
 ifeq ($(ARCH),alpha)
-# -msmall-data is not used because we want two-instruction relocations
-# for the constant constructions
-OP_CFLAGS=-Wall -O2 -g
+# -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
-LDFLAGS+=-Wl,-T,$(SRC_PATH)/alpha.ld
+override CFLAGS+=-msmall-data
+override LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
 endif
 
 ifeq ($(ARCH),ia64)
-CFLAGS += -mno-sdata
-OP_CFLAGS=$(CFLAGS)
-LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/ia64.ld
+override CFLAGS+=-mno-sdata
+override OP_CFLAGS+=-mno-sdata
+override LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/$(ARCH).ld
 endif
 
 ifeq ($(ARCH),arm)
-OP_CFLAGS=$(CFLAGS) -mno-sched-prolog -fno-omit-frame-pointer
-LDFLAGS+=-Wl,-T,$(SRC_PATH)/arm.ld
+override OP_CFLAGS+=-mno-sched-prolog -fno-omit-frame-pointer
+override LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
 endif
 
 ifeq ($(ARCH),m68k)
-OP_CFLAGS=$(CFLAGS) -fomit-frame-pointer
-LDFLAGS+=-Wl,-T,m68k.ld
+override OP_CFLAGS+=-fomit-frame-pointer
+override LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
+endif
+
+ifeq ($(ARCH),mips)
+override LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
 endif
 
 ifeq ($(HAVE_GCC3_OPTIONS),yes)
 # very important to generate a return at the end of every operation
-OP_CFLAGS+=-fno-reorder-blocks -fno-optimize-sibling-calls
+override OP_CFLAGS+=-fno-reorder-blocks -fno-optimize-sibling-calls
 endif
 
 ifeq ($(CONFIG_DARWIN),yes)
-OP_CFLAGS+= -mdynamic-no-pic
 LIBS+=-lmx
 endif
 
+override OP_CFLAGS+=$(OS_CFLAGS)
+
 #########################################################
 
-DEFINES+=-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
+CPPFLAGS+=-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
 LIBS+=-lm
 ifndef CONFIG_USER_ONLY
 LIBS+=-lz
@@ -179,8 +180,8 @@ endif
 
 # profiling code
 ifdef TARGET_GPROF
-LDFLAGS+=-p
-main.o: CFLAGS+=-p
+override LDFLAGS+=-p
+main.o: override CFLAGS+=-p
 endif
 
 OBJS= main.o syscall.o mmap.o signal.o path.o osdep.o thunk.o \
@@ -211,7 +212,7 @@ LIBOBJS+=fpu/softfloat.o
 else
 LIBOBJS+=fpu/softfloat-native.o
 endif
-DEFINES+=-I$(SRC_PATH)/fpu
+CPPFLAGS+=-I$(SRC_PATH)/fpu
 
 ifeq ($(TARGET_ARCH), i386)
 LIBOBJS+=helper.o helper2.o
@@ -324,7 +325,7 @@ LIBS += -lole32 -ldxguid
 endif
 ifdef CONFIG_FMOD
 AUDIODRV += fmodaudio.o
-audio.o fmodaudio.o: DEFINES := -I$(CONFIG_FMOD_INC) $(DEFINES)
+audio.o fmodaudio.o: CPPFLAGS := -I$(CONFIG_FMOD_INC) $(CPPFLAGS)
 LIBS += $(CONFIG_FMOD_LIB)
 endif
 ifdef CONFIG_ADLIB
@@ -347,14 +348,14 @@ VL_OBJS+= ide.o pckbd.o ps2.o vga.o $(SO
 VL_OBJS+= fdc.o mc146818rtc.o serial.o i8259.o i8254.o pcspk.o pc.o
 VL_OBJS+= cirrus_vga.o mixeng.o apic.o parallel.o acpi.o piix_pci.o
 VL_OBJS+= usb-uhci.o
-DEFINES += -DHAS_AUDIO
+CPPFLAGS += -DHAS_AUDIO
 endif
 ifeq ($(TARGET_BASE_ARCH), ppc)
 VL_OBJS+= ppc.o ide.o pckbd.o ps2.o vga.o $(SOUND_HW) dma.o $(AUDIODRV)
 VL_OBJS+= mc146818rtc.o serial.o i8259.o i8254.o fdc.o m48t59.o
 VL_OBJS+= ppc_prep.o ppc_chrp.o cuda.o adb.o openpic.o heathrow_pic.o mixeng.o
 VL_OBJS+= grackle_pci.o prep_pci.o unin_pci.o
-DEFINES += -DHAS_AUDIO
+CPPFLAGS += -DHAS_AUDIO
 endif
 ifeq ($(TARGET_ARCH), mips)
 VL_OBJS+= mips_r4k.o mips_timer.o dma.o vga.o serial.o i8254.o i8259.o ide.o
@@ -395,7 +396,7 @@ COCOA_LIBS+=-framework CoreAudio
 endif
 endif
 ifdef CONFIG_SLIRP
-DEFINES+=-I$(SRC_PATH)/slirp
+CPPFLAGS+=-I$(SRC_PATH)/slirp
 SLIRP_OBJS=cksum.o if.o ip_icmp.o ip_input.o ip_output.o \
 slirp.o mbuf.o misc.o sbuf.o socket.o tcp_input.o tcp_output.o \
 tcp_subr.o tcp_timer.o udp.o bootp.o debug.o tftp.o
@@ -418,7 +419,7 @@ endif
 endif
 endif
 ifdef TARGET_GPROF
-vl.o: CFLAGS+=-p
+vl.o: override CFLAGS+=-p
 VL_LDFLAGS+=-p
 endif
 
@@ -439,22 +440,22 @@ $(QEMU_SYSTEM): $(VL_OBJS) libqemu.a
 	$(CC) $(VL_LDFLAGS) -o $@ $^ $(LIBS) $(SDL_LIBS) $(COCOA_LIBS) $(VL_LIBS)
 
 cocoa.o: cocoa.m
-	$(CC) $(CFLAGS) $(DEFINES) -c -o $@ $<
+	$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
 
 sdl.o: sdl.c keymaps.c sdl_keysym.h
-	$(CC) $(CFLAGS) $(DEFINES) $(SDL_CFLAGS) -c -o $@ $<
+	$(CC) $(CFLAGS) $(CPPFLAGS) $(SDL_CFLAGS) -c -o $@ $<
 
 vnc.o: vnc.c keymaps.c sdl_keysym.h vnchextile.h
-	$(CC) $(CFLAGS) $(DEFINES) -c -o $@ $<
+	$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
 
 sdlaudio.o: sdlaudio.c
-	$(CC) $(CFLAGS) $(DEFINES) $(SDL_CFLAGS) -c -o $@ $<
+	$(CC) $(CFLAGS) $(CPPFLAGS) $(SDL_CFLAGS) -c -o $@ $<
 
 depend: $(SRCS)
-	$(CC) -MM $(CFLAGS) $(DEFINES) $^ 1>.depend
+	$(CC) -MM $(CFLAGS) $(CPPFLAGS) $^ 1>.depend
 
 vldepend: $(VL_OBJS:.o=.c)
-	$(CC) -MM $(CFLAGS) $(DEFINES) $^ 1>.depend
+	$(CC) -MM $(CFLAGS) $(CPPFLAGS) $^ 1>.depend
 
 # libqemu 
 
@@ -478,26 +479,26 @@ gen-op.h: op.o $(DYNGEN)
 	$(DYNGEN) -g -o $@ $<
 
 op.o: op.c
-	$(CC) $(OP_CFLAGS) $(DEFINES) -c -o $@ $<
+	$(CC) $(OP_CFLAGS) $(CPPFLAGS) -c -o $@ $<
 
 # HELPER_CFLAGS is used for all the code compiled with static register
 # variables
 ifeq ($(TARGET_BASE_ARCH), i386)
 # XXX: rename helper.c to op_helper.c
 helper.o: helper.c
-	$(CC) $(HELPER_CFLAGS) $(DEFINES) -c -o $@ $<
+	$(CC) $(HELPER_CFLAGS) $(CPPFLAGS) -c -o $@ $<
 else
 op_helper.o: op_helper.c
-	$(CC) $(HELPER_CFLAGS) $(DEFINES) -c -o $@ $<
+	$(CC) $(HELPER_CFLAGS) $(CPPFLAGS) -c -o $@ $<
 endif
 
 cpu-exec.o: cpu-exec.c
-	$(CC) $(HELPER_CFLAGS) $(DEFINES) -c -o $@ $<
+	$(CC) $(HELPER_CFLAGS) $(CPPFLAGS) -c -o $@ $<
 
 # 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) $(DEFINES) -c -o $@ $<
+	$(CC) $(HELPER_CFLAGS) $(CPPFLAGS) -c -o $@ $<
 
 ifeq ($(TARGET_BASE_ARCH), i386)
 op.o: op.c opreg_template.h ops_template.h ops_template_mem.h ops_mem.h ops_sse.h
@@ -539,10 +540,10 @@ endif
 $(OBJS) $(LIBOBJS) $(VL_OBJS): config.h ../config-host.h
 
 %.o: %.c
-	$(CC) $(CFLAGS) $(DEFINES) -c -o $@ $<
+	$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
 
 %.o: %.S
-	$(CC) $(DEFINES) -c -o $@ $<
+	$(CC) $(CPPFLAGS) -c -o $@ $<
 
 clean:
 	rm -f *.o  *.a *~ $(PROGS) gen-op.h opc.h op.h nwfpe/*.o slirp/*.o fpu/*.o
Index: configure
===================================================================
RCS file: /sources/qemu/qemu/configure,v
retrieving revision 1.115
diff -u -p -r1.115 configure
--- configure	1 Jan 2007 21:31:01 -0000	1.115
+++ configure	3 Jan 2007 16:10:07 -0000
@@ -103,7 +103,7 @@ targetos=`uname -s`
 case $targetos in
 CYGWIN*)
 mingw32="yes"
-CFLAGS="-O2 -mno-cygwin"
+OS_CFLAGS="-mno-cygwin"
 ;;
 MINGW32*)
 mingw32="yes"
@@ -126,6 +126,7 @@ oss="yes"
 Darwin)
 bsd="yes"
 darwin="yes"
+OS_CFLAGS="-mdynamic-no-pic"
 ;;
 SunOS)
 solaris="yes"
@@ -243,6 +244,10 @@ for opt do
   esac
 done
 
+# default flags for all hosts
+CFLAGS="$CFLAGS -Wall -O2 -g -fno-strict-aliasing"
+LDFLAGS="$LDFLAGS -g"
+
 if test x"$show_help" = x"yes" ; then
 cat << EOF
 
@@ -605,6 +610,7 @@ fi
 echo "HOST_CC=$host_cc" >> $config_mak
 echo "AR=$ar" >> $config_mak
 echo "STRIP=$strip -s -R .comment -R .note" >> $config_mak
+echo "OS_CFLAGS=$OS_CFLAGS" >> $config_mak
 echo "CFLAGS=$CFLAGS" >> $config_mak
 echo "LDFLAGS=$LDFLAGS" >> $config_mak
 echo "EXESUF=$EXESUF" >> $config_mak

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

* Re: [Qemu-devel] qemu Makefile configure
  2007-01-03 16:16     ` Thiemo Seufer
@ 2007-01-03 16:58       ` Bernhard Fischer
  2007-01-04 12:26       ` Thiemo Seufer
  1 sibling, 0 replies; 17+ messages in thread
From: Bernhard Fischer @ 2007-01-03 16:58 UTC (permalink / raw)
  To: qemu-devel

On Wed, Jan 03, 2007 at 04:16:53PM +0000, Thiemo Seufer wrote:
>Fabrice Bellard wrote:
>> IMHO, CFLAGS and LDFLAGS overriding should not be allowed for QEMU as it 
>> is almost sure to break the dyngen stuff. If ever it is allowed, it 
>> should be done so that the CFLAGS for the files used by dyngen are not 
>> modified.
>
>That's why I made OP_CFLAGS a separate set of flags.
>
>I append the next version of the patch, which incorporates the
>suggestions made by Daniel and Bernhard, and fixes a gcc3 detection
>bug I introduced earlier.

Is the override directive a common extension?
http://www.opengroup.org/onlinepubs/009695399/utilities/make.html

I'd avoid override if possible and use a different variable instead
(CC_CFLAGS, or the like) to be passed to the .c.o rules

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

* Re: [Qemu-devel] qemu Makefile configure
  2007-01-03 16:16     ` Thiemo Seufer
  2007-01-03 16:58       ` Bernhard Fischer
@ 2007-01-04 12:26       ` Thiemo Seufer
  2007-01-05  1:03         ` Thiemo Seufer
  1 sibling, 1 reply; 17+ messages in thread
From: Thiemo Seufer @ 2007-01-04 12:26 UTC (permalink / raw)
  To: qemu-devel

Thiemo Seufer wrote:
> Fabrice Bellard wrote:
> > IMHO, CFLAGS and LDFLAGS overriding should not be allowed for QEMU as it 
> > is almost sure to break the dyngen stuff. If ever it is allowed, it 
> > should be done so that the CFLAGS for the files used by dyngen are not 
> > modified.
> 
> That's why I made OP_CFLAGS a separate set of flags.
> 
> I append the next version of the patch, which incorporates the
> suggestions made by Daniel and Bernhard, and fixes a gcc3 detection
> bug I introduced earlier.

Next iteration, this uses BASE_CFLAGS and BASE_LDFLAGS instead of
gmake's override feature.


Thiemo


Index: Makefile
===================================================================
RCS file: /sources/qemu/qemu/Makefile,v
retrieving revision 1.107
diff -u -p -r1.107 Makefile
--- Makefile	1 Jan 2007 21:31:01 -0000	1.107
+++ Makefile	4 Jan 2007 11:47:40 -0000
@@ -5,19 +5,18 @@ include config-host.mak
 .PHONY: all clean distclean dvi info install install-doc tar tarbin \
 	speed test test2 html dvi info
 
-CFLAGS+=-Wall -O2 -g -fno-strict-aliasing -I.
-ifdef CONFIG_DARWIN
-CFLAGS+= -mdynamic-no-pic
-endif
+BASE_CFLAGS=
+BASE_LDFLAGS=
+
+BASE_CFLAGS += $(OS_CFLAGS)
 ifeq ($(ARCH),sparc)
-CFLAGS+=-mcpu=ultrasparc
+BASE_CFLAGS += -mcpu=ultrasparc
 endif
-LDFLAGS+=-g
+CPPFLAGS += -I. -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
 LIBS=
-DEFINES+=-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
 TOOLS=qemu-img$(EXESUF)
 ifdef CONFIG_STATIC
-LDFLAGS+=-static
+BASE_LDFLAGS += -static
 endif
 ifdef BUILD_DOCS
 DOCS=qemu-doc.html qemu-tech.html qemu.1 qemu-img.1
@@ -41,10 +40,10 @@ subdir-%: dyngen$(EXESUF)
 recurse-all: $(patsubst %,subdir-%, $(TARGET_DIRS))
 
 qemu-img$(EXESUF): qemu-img.c block.c block-raw.c block-cow.c block-qcow.c aes.c block-vmdk.c block-cloop.c block-dmg.c block-bochs.c block-vpc.c block-vvfat.c block-qcow2.c
-	$(CC) -DQEMU_TOOL $(CFLAGS) $(LDFLAGS) $(DEFINES) -o $@ $^ -lz $(LIBS)
+	$(CC) -DQEMU_TOOL $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) $(LDFLAGS) $(BASE_LDFLAGS) -o $@ $^ -lz $(LIBS)
 
 dyngen$(EXESUF): dyngen.c
-	$(HOST_CC) $(CFLAGS) $(DEFINES) -o $@ $^
+	$(HOST_CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -o $@ $^
 
 clean:
 # avoid old build problems by removing potentially incorrect old files
Index: Makefile.target
===================================================================
RCS file: /sources/qemu/qemu/Makefile.target,v
retrieving revision 1.134
diff -u -p -r1.134 Makefile.target
--- Makefile.target	7 Dec 2006 18:15:35 -0000	1.134
+++ Makefile.target	4 Jan 2007 11:47:40 -0000
@@ -12,14 +12,14 @@ TARGET_BASE_ARCH:=sparc
 endif
 TARGET_PATH=$(SRC_PATH)/target-$(TARGET_BASE_ARCH)
 VPATH=$(SRC_PATH):$(TARGET_PATH):$(SRC_PATH)/hw:$(SRC_PATH)/audio
-DEFINES=-I. -I.. -I$(TARGET_PATH) -I$(SRC_PATH)
+CPPFLAGS=-I. -I.. -I$(TARGET_PATH) -I$(SRC_PATH)
 ifdef CONFIG_USER_ONLY
 VPATH+=:$(SRC_PATH)/linux-user
-DEFINES+=-I$(SRC_PATH)/linux-user -I$(SRC_PATH)/linux-user/$(TARGET_ARCH)
+CPPFLAGS+=-I$(SRC_PATH)/linux-user -I$(SRC_PATH)/linux-user/$(TARGET_ARCH)
 endif
-CFLAGS=-Wall -O2 -g -fno-strict-aliasing
+BASE_CFLAGS=
+BASE_LDFLAGS=
 #CFLAGS+=-Werror
-LDFLAGS=-g
 LIBS=
 HELPER_CFLAGS=$(CFLAGS)
 DYNGEN=../dyngen$(EXESUF)
@@ -62,18 +62,20 @@ endif
 endif # !CONFIG_USER_ONLY
 
 ifdef CONFIG_STATIC
-LDFLAGS+=-static
+BASE_LDFLAGS+=-static
 endif
 
+# We require -O2 to avoid the stack setup prologue in EXIT_TB
+OP_CFLAGS = -Wall -O2 -g -fno-strict-aliasing
+
 ifeq ($(ARCH),i386)
-HELPER_CFLAGS:=$(CFLAGS) -fomit-frame-pointer
-OP_CFLAGS:=$(CFLAGS) -mpreferred-stack-boundary=2 -fomit-frame-pointer
+HELPER_CFLAGS+=-fomit-frame-pointer
+OP_CFLAGS+=-mpreferred-stack-boundary=2 -fomit-frame-pointer
 ifeq ($(HAVE_GCC3_OPTIONS),yes)
 OP_CFLAGS+= -falign-functions=0 -fno-gcse
 else
 OP_CFLAGS+= -malign-functions=0
 endif
-
 ifdef TARGET_GPROF
 USE_I386_LD=y
 endif
@@ -81,76 +83,76 @@ ifdef CONFIG_STATIC
 USE_I386_LD=y
 endif
 ifdef USE_I386_LD
-LDFLAGS+=-Wl,-T,$(SRC_PATH)/i386.ld
+BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
 else
 # WARNING: this LDFLAGS is _very_ tricky : qemu is an ELF shared object
 # that the kernel ELF loader considers as an executable. I think this
 # is the simplest way to make it self virtualizable!
-LDFLAGS+=-Wl,-shared
+BASE_LDFLAGS+=-Wl,-shared
 endif
 endif
 
 ifeq ($(ARCH),x86_64)
-OP_CFLAGS=$(CFLAGS) -falign-functions=0
-LDFLAGS+=-Wl,-T,$(SRC_PATH)/x86_64.ld
+BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
 endif
 
 ifeq ($(ARCH),ppc)
-CFLAGS+= -D__powerpc__
-OP_CFLAGS=$(CFLAGS)
-LDFLAGS+=-Wl,-T,$(SRC_PATH)/ppc.ld
+CPPFLAGS+= -D__powerpc__
+BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
 endif
 
 ifeq ($(ARCH),s390)
-OP_CFLAGS=$(CFLAGS)
-LDFLAGS+=-Wl,-T,$(SRC_PATH)/s390.ld
+BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
 endif
 
 ifeq ($(ARCH),sparc)
 ifeq ($(CONFIG_SOLARIS),yes)
-CFLAGS+=-mcpu=ultrasparc -m32 -ffixed-g2 -ffixed-g3
-LDFLAGS+=-m32
-OP_CFLAGS=$(CFLAGS) -fno-delayed-branch -fno-omit-frame-pointer -ffixed-i0
+BASE_CFLAGS+=-mcpu=ultrasparc -m32 -ffixed-g2 -ffixed-g3
+BASE_LDFLAGS+=-m32
+OP_CFLAGS+=-fno-delayed-branch -fno-omit-frame-pointer -ffixed-i0
 else
-CFLAGS+=-mcpu=ultrasparc -m32 -ffixed-g1 -ffixed-g2 -ffixed-g3 -ffixed-g6
-LDFLAGS+=-m32
-OP_CFLAGS=$(CFLAGS) -fno-delayed-branch -ffixed-i0
+BASE_CFLAGS+=-mcpu=ultrasparc -m32 -ffixed-g1 -ffixed-g2 -ffixed-g3 -ffixed-g6
+BASE_LDFLAGS+=-m32
+OP_CFLAGS+=-fno-delayed-branch -ffixed-i0
 HELPER_CFLAGS=$(CFLAGS) -ffixed-i0 -mflat
 # -static is used to avoid g1/g3 usage by the dynamic linker
-LDFLAGS+=-Wl,-T,$(SRC_PATH)/sparc.ld -static
+BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld -static
 endif
 endif
 
 ifeq ($(ARCH),sparc64)
-CFLAGS+=-mcpu=ultrasparc -m64 -ffixed-g1 -ffixed-g4 -ffixed-g5 -ffixed-g7
-LDFLAGS+=-m64
-LDFLAGS+=-Wl,-T,$(SRC_PATH)/sparc64.ld
-OP_CFLAGS=$(CFLAGS) -fno-delayed-branch -ffixed-i0
+BASE_CFLAGS+=-mcpu=ultrasparc -m64 -ffixed-g1 -ffixed-g4 -ffixed-g5 -ffixed-g7
+BASE_LDFLAGS+=-m64
+BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
+OP_CFLAGS+=-mcpu=ultrasparc -m64 -ffixed-g1 -ffixed-g4 -ffixed-g5 -ffixed-g7 -fno-delayed-branch -ffixed-i0
 endif
 
 ifeq ($(ARCH),alpha)
-# -msmall-data is not used because we want two-instruction relocations
-# for the constant constructions
-OP_CFLAGS=-Wall -O2 -g
+# -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
-LDFLAGS+=-Wl,-T,$(SRC_PATH)/alpha.ld
+BASE_CFLAGS+=-msmall-data
+BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
 endif
 
 ifeq ($(ARCH),ia64)
-CFLAGS += -mno-sdata
-OP_CFLAGS=$(CFLAGS)
-LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/ia64.ld
+BASE_CFLAGS+=-mno-sdata
+OP_CFLAGS+=-mno-sdata
+BASE_LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/$(ARCH).ld
 endif
 
 ifeq ($(ARCH),arm)
-OP_CFLAGS=$(CFLAGS) -mno-sched-prolog -fno-omit-frame-pointer
-LDFLAGS+=-Wl,-T,$(SRC_PATH)/arm.ld
+OP_CFLAGS+=-mno-sched-prolog -fno-omit-frame-pointer
+BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
 endif
 
 ifeq ($(ARCH),m68k)
-OP_CFLAGS=$(CFLAGS) -fomit-frame-pointer
-LDFLAGS+=-Wl,-T,m68k.ld
+OP_CFLAGS+=-fomit-frame-pointer
+BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
+endif
+
+ifeq ($(ARCH),mips)
+BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
 endif
 
 ifeq ($(HAVE_GCC3_OPTIONS),yes)
@@ -159,13 +161,14 @@ OP_CFLAGS+=-fno-reorder-blocks -fno-opti
 endif
 
 ifeq ($(CONFIG_DARWIN),yes)
-OP_CFLAGS+= -mdynamic-no-pic
 LIBS+=-lmx
 endif
 
+OP_CFLAGS+=$(OS_CFLAGS)
+
 #########################################################
 
-DEFINES+=-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
+CPPFLAGS+=-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
 LIBS+=-lm
 ifndef CONFIG_USER_ONLY
 LIBS+=-lz
@@ -179,8 +182,8 @@ endif
 
 # profiling code
 ifdef TARGET_GPROF
-LDFLAGS+=-p
-main.o: CFLAGS+=-p
+BASE_LDFLAGS+=-p
+main.o: BASE_CFLAGS+=-p
 endif
 
 OBJS= main.o syscall.o mmap.o signal.o path.o osdep.o thunk.o \
@@ -211,7 +214,7 @@ LIBOBJS+=fpu/softfloat.o
 else
 LIBOBJS+=fpu/softfloat-native.o
 endif
-DEFINES+=-I$(SRC_PATH)/fpu
+CPPFLAGS+=-I$(SRC_PATH)/fpu
 
 ifeq ($(TARGET_ARCH), i386)
 LIBOBJS+=helper.o helper2.o
@@ -288,7 +291,7 @@ endif
 all: $(PROGS)
 
 $(QEMU_USER): $(OBJS)
-	$(CC) $(LDFLAGS) -o $@ $^  $(LIBS)
+	$(CC) $(LDFLAGS) $(BASE_LDFLAGS) -o $@ $^  $(LIBS)
 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)
@@ -324,7 +327,7 @@ LIBS += -lole32 -ldxguid
 endif
 ifdef CONFIG_FMOD
 AUDIODRV += fmodaudio.o
-audio.o fmodaudio.o: DEFINES := -I$(CONFIG_FMOD_INC) $(DEFINES)
+audio.o fmodaudio.o: CPPFLAGS := -I$(CONFIG_FMOD_INC) $(CPPFLAGS)
 LIBS += $(CONFIG_FMOD_LIB)
 endif
 ifdef CONFIG_ADLIB
@@ -347,14 +350,14 @@ VL_OBJS+= ide.o pckbd.o ps2.o vga.o $(SO
 VL_OBJS+= fdc.o mc146818rtc.o serial.o i8259.o i8254.o pcspk.o pc.o
 VL_OBJS+= cirrus_vga.o mixeng.o apic.o parallel.o acpi.o piix_pci.o
 VL_OBJS+= usb-uhci.o
-DEFINES += -DHAS_AUDIO
+CPPFLAGS += -DHAS_AUDIO
 endif
 ifeq ($(TARGET_BASE_ARCH), ppc)
 VL_OBJS+= ppc.o ide.o pckbd.o ps2.o vga.o $(SOUND_HW) dma.o $(AUDIODRV)
 VL_OBJS+= mc146818rtc.o serial.o i8259.o i8254.o fdc.o m48t59.o
 VL_OBJS+= ppc_prep.o ppc_chrp.o cuda.o adb.o openpic.o heathrow_pic.o mixeng.o
 VL_OBJS+= grackle_pci.o prep_pci.o unin_pci.o
-DEFINES += -DHAS_AUDIO
+CPPFLAGS += -DHAS_AUDIO
 endif
 ifeq ($(TARGET_ARCH), mips)
 VL_OBJS+= mips_r4k.o mips_timer.o dma.o vga.o serial.o i8254.o i8259.o ide.o
@@ -395,7 +398,7 @@ COCOA_LIBS+=-framework CoreAudio
 endif
 endif
 ifdef CONFIG_SLIRP
-DEFINES+=-I$(SRC_PATH)/slirp
+CPPFLAGS+=-I$(SRC_PATH)/slirp
 SLIRP_OBJS=cksum.o if.o ip_icmp.o ip_input.o ip_output.o \
 slirp.o mbuf.o misc.o sbuf.o socket.o tcp_input.o tcp_output.o \
 tcp_subr.o tcp_timer.o udp.o bootp.o debug.o tftp.o
@@ -418,7 +421,7 @@ endif
 endif
 endif
 ifdef TARGET_GPROF
-vl.o: CFLAGS+=-p
+vl.o: BASE_CFLAGS+=-p
 VL_LDFLAGS+=-p
 endif
 
@@ -439,22 +442,22 @@ $(QEMU_SYSTEM): $(VL_OBJS) libqemu.a
 	$(CC) $(VL_LDFLAGS) -o $@ $^ $(LIBS) $(SDL_LIBS) $(COCOA_LIBS) $(VL_LIBS)
 
 cocoa.o: cocoa.m
-	$(CC) $(CFLAGS) $(DEFINES) -c -o $@ $<
+	$(CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
 
 sdl.o: sdl.c keymaps.c sdl_keysym.h
-	$(CC) $(CFLAGS) $(DEFINES) $(SDL_CFLAGS) -c -o $@ $<
+	$(CC) $(CFLAGS) $(CPPFLAGS) $(SDL_CFLAGS) $(BASE_CFLAGS) -c -o $@ $<
 
 vnc.o: vnc.c keymaps.c sdl_keysym.h vnchextile.h
-	$(CC) $(CFLAGS) $(DEFINES) -c -o $@ $<
+	$(CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
 
 sdlaudio.o: sdlaudio.c
-	$(CC) $(CFLAGS) $(DEFINES) $(SDL_CFLAGS) -c -o $@ $<
+	$(CC) $(CFLAGS) $(CPPFLAGS) $(SDL_CFLAGS) $(BASE_CFLAGS) -c -o $@ $<
 
 depend: $(SRCS)
-	$(CC) -MM $(CFLAGS) $(DEFINES) $^ 1>.depend
+	$(CC) -MM $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) $^ 1>.depend
 
 vldepend: $(VL_OBJS:.o=.c)
-	$(CC) -MM $(CFLAGS) $(DEFINES) $^ 1>.depend
+	$(CC) -MM $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) $^ 1>.depend
 
 # libqemu 
 
@@ -478,26 +481,26 @@ gen-op.h: op.o $(DYNGEN)
 	$(DYNGEN) -g -o $@ $<
 
 op.o: op.c
-	$(CC) $(OP_CFLAGS) $(DEFINES) -c -o $@ $<
+	$(CC) $(OP_CFLAGS) $(CPPFLAGS) -c -o $@ $<
 
 # HELPER_CFLAGS is used for all the code compiled with static register
 # variables
 ifeq ($(TARGET_BASE_ARCH), i386)
 # XXX: rename helper.c to op_helper.c
 helper.o: helper.c
-	$(CC) $(HELPER_CFLAGS) $(DEFINES) -c -o $@ $<
+	$(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
 else
 op_helper.o: op_helper.c
-	$(CC) $(HELPER_CFLAGS) $(DEFINES) -c -o $@ $<
+	$(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
 endif
 
 cpu-exec.o: cpu-exec.c
-	$(CC) $(HELPER_CFLAGS) $(DEFINES) -c -o $@ $<
+	$(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
 
 # 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) $(DEFINES) -c -o $@ $<
+	$(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
 
 ifeq ($(TARGET_BASE_ARCH), i386)
 op.o: op.c opreg_template.h ops_template.h ops_template_mem.h ops_mem.h ops_sse.h
@@ -539,10 +542,10 @@ endif
 $(OBJS) $(LIBOBJS) $(VL_OBJS): config.h ../config-host.h
 
 %.o: %.c
-	$(CC) $(CFLAGS) $(DEFINES) -c -o $@ $<
+	$(CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
 
 %.o: %.S
-	$(CC) $(DEFINES) -c -o $@ $<
+	$(CC) $(CPPFLAGS) -c -o $@ $<
 
 clean:
 	rm -f *.o  *.a *~ $(PROGS) gen-op.h opc.h op.h nwfpe/*.o slirp/*.o fpu/*.o
Index: configure
===================================================================
RCS file: /sources/qemu/qemu/configure,v
retrieving revision 1.115
diff -u -p -r1.115 configure
--- configure	1 Jan 2007 21:31:01 -0000	1.115
+++ configure	4 Jan 2007 11:47:41 -0000
@@ -103,7 +103,7 @@ targetos=`uname -s`
 case $targetos in
 CYGWIN*)
 mingw32="yes"
-CFLAGS="-O2 -mno-cygwin"
+OS_CFLAGS="-mno-cygwin"
 ;;
 MINGW32*)
 mingw32="yes"
@@ -126,6 +126,7 @@ oss="yes"
 Darwin)
 bsd="yes"
 darwin="yes"
+OS_CFLAGS="-mdynamic-no-pic"
 ;;
 SunOS)
 solaris="yes"
@@ -243,6 +244,10 @@ for opt do
   esac
 done
 
+# default flags for all hosts
+CFLAGS="$CFLAGS -Wall -O2 -g -fno-strict-aliasing"
+LDFLAGS="$LDFLAGS -g"
+
 if test x"$show_help" = x"yes" ; then
 cat << EOF
 
@@ -605,6 +610,7 @@ fi
 echo "HOST_CC=$host_cc" >> $config_mak
 echo "AR=$ar" >> $config_mak
 echo "STRIP=$strip -s -R .comment -R .note" >> $config_mak
+echo "OS_CFLAGS=$OS_CFLAGS" >> $config_mak
 echo "CFLAGS=$CFLAGS" >> $config_mak
 echo "LDFLAGS=$LDFLAGS" >> $config_mak
 echo "EXESUF=$EXESUF" >> $config_mak

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

* Re: [Qemu-devel] qemu Makefile configure
  2007-01-04 12:26       ` Thiemo Seufer
@ 2007-01-05  1:03         ` Thiemo Seufer
  0 siblings, 0 replies; 17+ messages in thread
From: Thiemo Seufer @ 2007-01-05  1:03 UTC (permalink / raw)
  To: qemu-devel

Thiemo Seufer wrote:
> Thiemo Seufer wrote:
> > Fabrice Bellard wrote:
> > > IMHO, CFLAGS and LDFLAGS overriding should not be allowed for QEMU as it 
> > > is almost sure to break the dyngen stuff. If ever it is allowed, it 
> > > should be done so that the CFLAGS for the files used by dyngen are not 
> > > modified.
> > 
> > That's why I made OP_CFLAGS a separate set of flags.
> > 
> > I append the next version of the patch, which incorporates the
> > suggestions made by Daniel and Bernhard, and fixes a gcc3 detection
> > bug I introduced earlier.
> 
> Next iteration, this uses BASE_CFLAGS and BASE_LDFLAGS instead of
> gmake's override feature.

Comitted, since it held up well for several people.


Thiemo

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

* Re: [Qemu-devel] qemu Makefile configure
  2007-01-03 14:23   ` Bernhard Fischer
  2007-01-03 15:09     ` Thiemo Seufer
@ 2007-01-07 21:58     ` Pierre d'Herbemont
  1 sibling, 0 replies; 17+ messages in thread
From: Pierre d'Herbemont @ 2007-01-07 21:58 UTC (permalink / raw)
  To: qemu-devel


On 3 janv. 07, at 15:23, Bernhard Fischer wrote:

> On Wed, Jan 03, 2007 at 01:59:50PM +0000, Thiemo Seufer wrote:
>> ifeq ($(ARCH),ppc)
> -> CFLAGS+= -D__powerpc__
> + CPPFLAGS += -D__powerpc__
>
> (doesn't cpp already define that on ppc?)

That's for the Darwin/Mac OS X PowerPC platforms where __powerpc__ is  
not defined by gcc.

Pierre

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

* [Qemu-devel] qemu Makefile configure
@ 2007-09-22 16:49 Paul Brook
  0 siblings, 0 replies; 17+ messages in thread
From: Paul Brook @ 2007-09-22 16:49 UTC (permalink / raw)
  To: qemu-devel

CVSROOT:	/sources/qemu
Module name:	qemu
Changes by:	Paul Brook <pbrook>	07/09/22 16:49:15

Modified files:
	.              : Makefile configure 

Log message:
	Only build qemu-img with softmmu targets.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/qemu/Makefile?cvsroot=qemu&r1=1.122&r2=1.123
http://cvs.savannah.gnu.org/viewcvs/qemu/configure?cvsroot=qemu&r1=1.155&r2=1.156

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

* [Qemu-devel] qemu Makefile configure
@ 2007-12-09  5:10 Thiemo Seufer
  0 siblings, 0 replies; 17+ messages in thread
From: Thiemo Seufer @ 2007-12-09  5:10 UTC (permalink / raw)
  To: qemu-devel

CVSROOT:	/sources/qemu
Module name:	qemu
Changes by:	Thiemo Seufer <ths>	07/12/09 05:10:03

Modified files:
	.              : Makefile configure 

Log message:
	SH4 big endian configuration, by Tomoyoshi Asano.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/qemu/Makefile?cvsroot=qemu&r1=1.136&r2=1.137
http://cvs.savannah.gnu.org/viewcvs/qemu/configure?cvsroot=qemu&r1=1.176&r2=1.177

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

end of thread, other threads:[~2007-12-09  5:10 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-22 16:49 [Qemu-devel] qemu Makefile configure Paul Brook
  -- strict thread matches above, loose matches on Subject: below --
2007-12-09  5:10 Thiemo Seufer
2007-01-01 21:31 Thiemo Seufer
2007-01-03 13:59 ` Thiemo Seufer
2007-01-03 14:23   ` Bernhard Fischer
2007-01-03 15:09     ` Thiemo Seufer
2007-01-07 21:58     ` Pierre d'Herbemont
2007-01-03 14:42   ` Thiemo Seufer
2007-01-03 14:55     ` Daniel Jacobowitz
2007-01-03 15:36       ` Thiemo Seufer
2007-01-03 15:43   ` Fabrice Bellard
2007-01-03 16:16     ` Thiemo Seufer
2007-01-03 16:58       ` Bernhard Fischer
2007-01-04 12:26       ` Thiemo Seufer
2007-01-05  1:03         ` Thiemo Seufer
2006-04-23 17:57 Paul Brook
2006-04-30 15:04 ` Leonardo E. Reiter

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