« Return to Thread: [Cooker] How to properly override C(++) lags for Makefiles generated by qmake?

Re: [Cooker] How to properly override C(++) lags for Makefiles generated by qmake?

by Amrein-Marie Christophe :: Rate this Message:

Reply to Author | View in Thread

Le dimanche 05 juillet 2009 à 14:08 +0400, Andrey Borzenkov a écrit :

> On Sunday 05 of July 2009 13:31:05 Amrein-Marie Christophe wrote:
> > Le dimanche 05 juillet 2009 à 13:23 +0400, Andrey Borzenkov a écrit :
> > > I'm trying to build aqemu. It fails on printf format error, but
> > > disabling it in specs is ineffective; Makefile is generated by
> > > qmake and C(XX)FLAGS are statically set in Makefile.
> > >
> > > Unfortunately using make CFLAGS=... does not work either because
> > > CFLAGS are built from other variables as well:
> > >
> > > CXXFLAGS      = -pipe -O2 -g -pipe -Wformat -Werror=format-security
> > > - Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector
> > > --param=ssp- buffer-size=4 -Wall -W -D_REENTRANT $(DEFINES)
> > >
> > > I hope, that it is possible to override template CFLAGS during
> > > qmake invocation. Is it possible?
> >
> > Use %{qmake_qt4} to create the Makefiles in your rpm .spec file.
>
> This does not work because our qmake templates *unconditionally* add
> options (have you actually tried it? Passing QMAKE_CXXFLAGS at qmake
> invocation was the first thing I tried :) )

Well, I built an rpm package for test. I just used:

>
> + CPPFLAGS='-O2 -g -pipe  -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-
> protector --param=ssp-buffer-size=4 -DPIC -fPIC'
> + export CPPFLAGS
> + /usr/lib/qt4/bin/qmake 'QMAKE_CFLAGS=-O2 -g -pipe  -Wp,-
> D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-
> size=4 -DPIC -fPIC' 'QMAKE_CXXFLAGS=-O2 -g -pipe  -Wp,-
> D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-
> size=4 -DPIC -fPIC' 'QMAKE_LFLAGS= -Wl,--as-needed -Wl,--no-undefined -
> Wl,-z,relro' AQEMU.pro
> + make
> make -f Makefile.Release
> ...
> g++ -c -O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-
> protector --param=ssp-buffer-size=4 -DPIC -fPIC -O2 -g -pipe -Wformat -
> Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-
> protector --param=ssp-buffer-size=4 -Wall -W -D_REENTRANT -DVNC_DISPLAY
> -DQT_NO_DEBUG -DQT_XML_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -
> DQT_SHARED -I/usr/lib/qt4/mkspecs/linux-g++ -I. -
> I/usr/lib/qt4/include/QtCore -I/usr/lib/qt4/include/QtNetwork -
> I/usr/lib/qt4/include/QtGui -I/usr/lib/qt4/include/QtXml -
> I/usr/lib/qt4/include -I/usr/lib/qt4/include/QtTest -I. -Irelease -I. -o
> release/About_Window.o About_Window.cpp

 « Return to Thread: [Cooker] How to properly override C(++) lags for Makefiles generated by qmake?