On Jan 13, 2012, at 1:56 PM, Gaetan Nadon wrote:

> On 12-01-13 03:07 PM, Jeremy Huddleston wrote:
>> CFLAGS can include flags which are not useful to the preprocessor
>> or can even cause it to fail.  This fixes a build issue on darwin
>> when building for more than one architecture.
>> 
>> Signed-off-by: Jeremy Huddleston <[email protected]>
>> ---
>> hw/xfree86/Makefile.am |    4 ++--
>> 1 files changed, 2 insertions(+), 2 deletions(-)
>> 
>> diff --git a/hw/xfree86/Makefile.am b/hw/xfree86/Makefile.am
>> index 72be889..c0b81c3 100644
>> --- a/hw/xfree86/Makefile.am
>> +++ b/hw/xfree86/Makefile.am
>> @@ -38,7 +38,7 @@ DIST_SUBDIRS = common ddc i2c x86emu int10 fbdevhw 
>> os-support \
>> bin_PROGRAMS = Xorg
>> nodist_Xorg_SOURCES = sdksyms.c
>> 
>> -AM_CFLAGS = $(DIX_CFLAGS) @XORG_CFLAGS@
>> +AM_CPPFLAGS = $(DIX_CFLAGS) @XORG_CFLAGS@
> DIX_CFLAGS and XORG_CFLAGS contain compiler flags (no strict aliasing
> and visibility flags).  AM_CPPFLAGS should never contain compiler flags
> (only pre-processor) as it may break in some targets.

Right.  I agree.  I missed that:
DIX_CFLAGS = -DHAVE_DIX_CONFIG_H $(CWARNFLAGS) -fno-strict-aliasing 
-D_BSD_SOURCE -DHAS_FCHOWN -DHAS_STICKY_DIR_BIT -I/opt/X11/include 
-I/opt/X11/include/pixman-1 -I/opt/X11/include/freetype2   
-I$(top_srcdir)/include -I$(top_builddir)/include -I$(top_srcdir)/Xext 
-I$(top_srcdir)/composite -I$(top_srcdir)/damageext -I$(top_srcdir)/xfixes 
-I$(top_srcdir)/Xi -I$(top_srcdir)/mi -I$(top_srcdir)/miext/sync 
-I$(top_srcdir)/miext/shadow  -I$(top_srcdir)/miext/damage 
-I$(top_srcdir)/render -I$(top_srcdir)/randr -I$(top_srcdir)/fb 
-fvisibility=hidden

XORG_CFLAGS =  -DHAVE_XORG_CONFIG_H -fvisibility=hidden -I/opt/X11/include  

> It is used in all
> sort of places in the generated Makefile, not just in the sdksysms target.
> 
> http://www.gnu.org/software/automake/manual/automake.html#index-AM_005fCPPFLAGS-515

So then we need to split up XORG_CFLAGS into XORG_CFLAGS and XORG_CPPFLAGS ... 
ugg...

> 
>> INCLUDES = $(XORG_INCS) -I$(srcdir)/parser -I$(top_srcdir)/miext/cw \
>>      -I$(srcdir)/ddc -I$(srcdir)/i2c -I$(srcdir)/modes -I$(srcdir)/ramdac
>> 
>> @@ -109,7 +109,7 @@ CLEANFILES = sdksyms.c sdksyms.dep
>> EXTRA_DIST += sdksyms.sh
>> 
>> sdksyms.dep sdksyms.c: sdksyms.sh
>> -    CPP='$(CPP)' AWK='$(AWK)' $(SHELL) $(srcdir)/sdksyms.sh $(top_srcdir) 
>> $(CFLAGS) $(AM_CFLAGS) $(INCLUDES)
>> +    CPP='$(CPP)' AWK='$(AWK)' $(SHELL) $(srcdir)/sdksyms.sh $(top_srcdir) 
>> $(CPPFLAGS) $(AM_CPPFLAGS) 
> The order is wrong. CFLAGS and CPPFLAGS should come last to allow user
> to override the flags set by AM_*. Check any generated Makefile, the
> order is:
> 
> COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) 
> $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)

Ok, well the order was wrong to begin with then, but I'll change it.



_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to