build: Add proper infrastructure for adding and checking host CPPFLAGS
This commit is contained in:
		
							parent
							
								
									2aac411fd4
								
							
						
					
					
						commit
						4cc4b33f71
					
				
							
								
								
									
										2
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								Makefile
									
									
									
									
									
								
							@ -28,7 +28,7 @@ CFLAGS     += $(ECFLAGS)
 | 
				
			|||||||
CCFLAGS     = $(CPPFLAGS) $(CFLAGS)
 | 
					CCFLAGS     = $(CPPFLAGS) $(CFLAGS)
 | 
				
			||||||
ASFLAGS    := $(CPPFLAGS) $(ASFLAGS)
 | 
					ASFLAGS    := $(CPPFLAGS) $(ASFLAGS)
 | 
				
			||||||
YASMFLAGS  += $(IFLAGS:%=%/) -Pconfig.asm
 | 
					YASMFLAGS  += $(IFLAGS:%=%/) -Pconfig.asm
 | 
				
			||||||
HOSTCCFLAGS = $(IFLAGS) $(HOSTCFLAGS)
 | 
					HOSTCCFLAGS = $(IFLAGS) $(HOSTCPPFLAGS) $(HOSTCFLAGS)
 | 
				
			||||||
LDFLAGS    := $(ALLFFLIBS:%=$(LD_PATH)lib%) $(LDFLAGS)
 | 
					LDFLAGS    := $(ALLFFLIBS:%=$(LD_PATH)lib%) $(LDFLAGS)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
define COMPILE
 | 
					define COMPILE
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										17
									
								
								configure
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										17
									
								
								configure
									
									
									
									
										vendored
									
									
								
							@ -224,6 +224,7 @@ Advanced options (experts only):
 | 
				
			|||||||
  --ld=LD                  use linker LD
 | 
					  --ld=LD                  use linker LD
 | 
				
			||||||
  --host-cc=HOSTCC         use host C compiler HOSTCC
 | 
					  --host-cc=HOSTCC         use host C compiler HOSTCC
 | 
				
			||||||
  --host-cflags=HCFLAGS    use HCFLAGS when compiling for host
 | 
					  --host-cflags=HCFLAGS    use HCFLAGS when compiling for host
 | 
				
			||||||
 | 
					  --host-cppflags=HCPPFLAGS use HCPPFLAGS when compiling for host
 | 
				
			||||||
  --host-ld=HOSTLD         use host linker HOSTLD
 | 
					  --host-ld=HOSTLD         use host linker HOSTLD
 | 
				
			||||||
  --host-ldflags=HLDFLAGS  use HLDFLAGS when linking for host
 | 
					  --host-ldflags=HLDFLAGS  use HLDFLAGS when linking for host
 | 
				
			||||||
  --host-libs=HLIBS        use libs HLIBS when linking for host
 | 
					  --host-libs=HLIBS        use libs HLIBS when linking for host
 | 
				
			||||||
@ -648,6 +649,10 @@ add_extralibs(){
 | 
				
			|||||||
    prepend extralibs $($ldflags_filter "$@")
 | 
					    prepend extralibs $($ldflags_filter "$@")
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					add_host_cppflags(){
 | 
				
			||||||
 | 
					    append host_cppflags "$@"
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
add_host_cflags(){
 | 
					add_host_cflags(){
 | 
				
			||||||
    append host_cflags $($host_cflags_filter "$@")
 | 
					    append host_cflags $($host_cflags_filter "$@")
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -962,6 +967,13 @@ check_host_cc(){
 | 
				
			|||||||
    check_cmd $host_cc $host_cflags "$@" $HOSTCC_C $(hostcc_o $TMPO) $TMPC
 | 
					    check_cmd $host_cc $host_cflags "$@" $HOSTCC_C $(hostcc_o $TMPO) $TMPC
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					check_host_cppflags(){
 | 
				
			||||||
 | 
					    log check_host_cppflags "$@"
 | 
				
			||||||
 | 
					    check_host_cc "$@" <<EOF && append host_cppflags "$@"
 | 
				
			||||||
 | 
					int x;
 | 
				
			||||||
 | 
					EOF
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
check_host_cflags(){
 | 
					check_host_cflags(){
 | 
				
			||||||
    log check_host_cflags "$@"
 | 
					    log check_host_cflags "$@"
 | 
				
			||||||
    set -- $($host_cflags_filter "$@")
 | 
					    set -- $($host_cflags_filter "$@")
 | 
				
			||||||
@ -1400,6 +1412,7 @@ CMDLINE_SET="
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
CMDLINE_APPEND="
 | 
					CMDLINE_APPEND="
 | 
				
			||||||
    extra_cflags
 | 
					    extra_cflags
 | 
				
			||||||
 | 
					    host_cppflags
 | 
				
			||||||
"
 | 
					"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# code dependency declarations
 | 
					# code dependency declarations
 | 
				
			||||||
@ -1889,7 +1902,8 @@ HOSTCC_C='-c'
 | 
				
			|||||||
HOSTCC_O='-o $@'
 | 
					HOSTCC_O='-o $@'
 | 
				
			||||||
HOSTLD_O='-o $@'
 | 
					HOSTLD_O='-o $@'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
host_cflags='-D_ISOC99_SOURCE -D_XOPEN_SOURCE=600 -O3 -g'
 | 
					host_cflags='-O3 -g'
 | 
				
			||||||
 | 
					host_cppflags='-D_ISOC99_SOURCE -D_XOPEN_SOURCE=600'
 | 
				
			||||||
host_libs='-lm'
 | 
					host_libs='-lm'
 | 
				
			||||||
host_cflags_filter=echo
 | 
					host_cflags_filter=echo
 | 
				
			||||||
host_ldflags_filter=echo
 | 
					host_ldflags_filter=echo
 | 
				
			||||||
@ -3922,6 +3936,7 @@ AS_DEPFLAGS=$AS_DEPFLAGS
 | 
				
			|||||||
HOSTCC=$host_cc
 | 
					HOSTCC=$host_cc
 | 
				
			||||||
HOSTLD=$host_ld
 | 
					HOSTLD=$host_ld
 | 
				
			||||||
HOSTCFLAGS=$host_cflags
 | 
					HOSTCFLAGS=$host_cflags
 | 
				
			||||||
 | 
					HOSTCPPFLAGS=$host_cppflags
 | 
				
			||||||
HOSTEXESUF=$HOSTEXESUF
 | 
					HOSTEXESUF=$HOSTEXESUF
 | 
				
			||||||
HOSTLDFLAGS=$host_ldflags
 | 
					HOSTLDFLAGS=$host_ldflags
 | 
				
			||||||
HOSTLIBS=$host_libs
 | 
					HOSTLIBS=$host_libs
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user