Host CPPFLAGS may contain architecture or target specific flags that don't apply to a PE cross compiler, to pass CPPFLAGS in such a case CROSSCPPFLAGS can now be used.
From: Billy Laws blaws05@gmail.com
Host CPPFLAGS may contain architecture or target specific flags that don't apply to a PE cross compiler, to pass CPPFLAGS in such a case CROSSCPPFLAGS can now be used. --- configure.ac | 6 +++++- tools/makedep.c | 13 ++++++++----- 2 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/configure.ac b/configure.ac index c015c049831..56d8453d8c7 100644 --- a/configure.ac +++ b/configure.ac @@ -172,7 +172,7 @@ case "$host_cpu" in x86_64) HOST_ARCH=x86_64 ;; esac m4_set_add_all([_AC_SUBST_VARS],[HOST_ARCH]m4_foreach([cpu],[aarch64,arm,arm64ec,i386,x86_64], - [m4_foreach([var],[CC,CFLAGS,EXTRACFLAGS,LDFLAGS,DEBUG,TARGET,DELAYLOADFLAG,DISABLED_SUBDIRS],[,cpu[_]var])])) + [m4_foreach([var],[CC,CFLAGS,CPPFLAGS,EXTRACFLAGS,LDFLAGS,DEBUG,TARGET,DELAYLOADFLAG,DISABLED_SUBDIRS],[,cpu[_]var])]))
AC_CACHE_CHECK([for the directory containing the Wine tools], wine_cv_toolsdir, [wine_cv_toolsdir="$with_wine_tools" @@ -794,6 +794,7 @@ AS_VAR_SET_IF([enable_archs],
saved_CC=$CC saved_CFLAGS=$CFLAGS +saved_CPPFLAGS=$CPPFLAGS saved_LDFLAGS=$LDFLAGS
AS_UNSET(extra_arch) @@ -832,9 +833,11 @@ do esac])
CFLAGS=${CROSSCFLAGS:-"-g -O2"} + CPPFLAGS=$CROSSCPPFLAGS LDFLAGS=$CROSSLDFLAGS AS_VAR_COPY([CC],[${wine_arch}_CC]) AS_VAR_COPY([${wine_arch}_CFLAGS],[CFLAGS]) + AS_VAR_COPY([${wine_arch}_CPPFLAGS],[CPPFLAGS]) AS_VAR_COPY([${wine_arch}_LDFLAGS],[LDFLAGS]) AS_VAR_SET([${wine_arch}_EXTRACFLAGS],["-D__WINE_PE_BUILD -Wall"])
@@ -1012,6 +1015,7 @@ done
CC=$saved_CC CFLAGS=$saved_CFLAGS +CPPFLAGS=$saved_CPPFLAGS LDFLAGS=$saved_LDFLAGS
case $HOST_ARCH in diff --git a/tools/makedep.c b/tools/makedep.c index 5e409d16cd9..6fb91922c00 100644 --- a/tools/makedep.c +++ b/tools/makedep.c @@ -135,7 +135,6 @@ static struct strarray linguas; static struct strarray dll_flags; static struct strarray unix_dllflags; static struct strarray msvcrt_flags; -static struct strarray cpp_flags; static struct strarray lddll_flags; static struct strarray libs; static struct strarray enable_tests; @@ -3198,7 +3197,7 @@ static void output_source_one_arch( struct makefile *make, struct incl_file *sou struct strarray defines, struct strarray *targets, unsigned int arch ) { - const char *obj_name, *var_cc, *var_cflags; + const char *obj_name, *var_cc, *var_cflags, *var_cppflags; struct strarray cflags = empty_strarray;
if (make->disabled[arch] && !(source->file->flags & FLAG_C_IMPLIB)) return; @@ -3235,6 +3234,7 @@ static void output_source_one_arch( struct makefile *make, struct incl_file *sou { var_cc = "$(x86_64_CC)"; var_cflags = "$(x86_64_CFLAGS)"; + var_cppflags = "$(x86_64_CPPFLAGS)"; strarray_add( &cflags, "-D__arm64ec_x64__" ); strarray_addall( &cflags, get_expanded_make_var_array( top_makefile, "x86_64_EXTRACFLAGS" )); } @@ -3242,6 +3242,7 @@ static void output_source_one_arch( struct makefile *make, struct incl_file *sou { var_cc = arch_make_variable( "CC", arch ); var_cflags = arch_make_variable( "CFLAGS", arch ); + var_cppflags = arch_make_variable( "CPPFLAGS", arch ); strarray_addall( &cflags, make->extlib ? extra_cflags_extlib[arch] : extra_cflags[arch] ); }
@@ -3264,13 +3265,12 @@ static void output_source_one_arch( struct makefile *make, struct incl_file *sou if (make->module && is_crt_module( make->module )) strarray_add( &cflags, "-fno-builtin" ); }
- strarray_addall( &cflags, cpp_flags ); - output( "%s: %s\n", obj_dir_path( make, obj_name ), source->filename ); output( "\t%s%s -c -o $@ %s", cmd_prefix( "CC" ), var_cc, source->filename ); output_filenames( defines ); output_filenames( cflags ); output_filename( var_cflags ); + output_filename( var_cppflags ); output( "\n" );
if (make->testdll && strendswith( source->name, ".c" ) && @@ -3301,14 +3301,18 @@ static void output_source_one_arch( struct makefile *make, struct incl_file *sou if ((source->file->flags & FLAG_ARM64EC_X64) && !strcmp( archs.str[arch], "arm64ec" )) { char *cflags = get_expanded_make_variable( make, "x86_64_CFLAGS" ); + char *cppflags = get_expanded_make_variable( make, "x86_64_CPPFLAGS" ); cmd->cmd = get_expanded_make_variable( make, "x86_64_CC" ); if (cflags) strarray_add( &cmd->args, cflags ); + if (cppflags) strarray_add( &cmd->args, cppflags ); } else { char *cflags = get_expanded_arch_var( make, "CFLAGS", arch ); + char *cppflags = get_expanded_arch_var( make, "CPPFLAGS", arch ); cmd->cmd = get_expanded_arch_var( make, "CC", arch ); if (cflags) strarray_add( &cmd->args, cflags ); + if (cppflags) strarray_add( &cmd->args, cppflags ); } list_add_tail( &compile_commands, &cmd->entry ); } @@ -4555,7 +4559,6 @@ int main( int argc, char *argv[] ) msvcrt_flags = get_expanded_make_var_array( top_makefile, "MSVCRTFLAGS" ); dll_flags = get_expanded_make_var_array( top_makefile, "DLLFLAGS" ); unix_dllflags = get_expanded_make_var_array( top_makefile, "UNIXDLLFLAGS" ); - cpp_flags = get_expanded_make_var_array( top_makefile, "CPPFLAGS" ); lddll_flags = get_expanded_make_var_array( top_makefile, "LDDLLFLAGS" ); libs = get_expanded_make_var_array( top_makefile, "LIBS" ); enable_tests = get_expanded_make_var_array( top_makefile, "ENABLE_TESTS" );
What is the use case for PE-specific CPPFLAGS?
On Wed Aug 14 09:53:39 2024 +0000, Alexandre Julliard wrote:
What is the use case for PE-specific CPPFLAGS?
If unix side header deps are being specified through CPPFLAGS (e.g. gstreamer) these end up unnecessarily polluting the cross compiler invocation too, I thought it best to avoid this kind of unix-PE argument mixing.
Sure, we can avoid the Unix ones, the question is whether we need PE-specific CPPFLAGS, given that we already have PE-specific CFLAGS.
Ah fair, I don't really see any reason except for completeness.