From 1fd60d5656d9dda8486f1e4fcf8a45ab2188de43 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Fri, 30 Nov 2018 13:26:36 +0100 Subject: [PATCH] makefiles: Expand more variables into the generated makefiles. Signed-off-by: Alexandre Julliard --- Makefile.in | 2 +- tools/makedep.c | 26 ++++++++++++++++++-------- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/Makefile.in b/Makefile.in index 13b5a5a0536..5e7ad68afcb 100644 --- a/Makefile.in +++ b/Makefile.in @@ -75,7 +75,7 @@ RUNTESTFLAGS = -q -P wine MAKEDEP = $(TOOLSDIR)/tools/makedep$(TOOLSEXT) WRC = $(TOOLSDIR)/tools/wrc/wrc$(TOOLSEXT) PACKAGE_VERSION = @PACKAGE_VERSION@ -SED_CMD = LC_ALL=C sed -e 's,@bindir\@,$(bindir),g' -e 's,@dlldir\@,$(dlldir),g' -e 's,@srcdir\@,$(srcdir),g' -e 's,@PACKAGE_STRING\@,@PACKAGE_STRING@,g' -e 's,@PACKAGE_VERSION\@,@PACKAGE_VERSION@,g' +SED_CMD = LC_ALL=C sed -e 's,@bindir\@,${bindir},g' -e 's,@dlldir\@,${dlldir},g' -e 's,@srcdir\@,${srcdir},g' -e 's,@PACKAGE_STRING\@,@PACKAGE_STRING@,g' -e 's,@PACKAGE_VERSION\@,@PACKAGE_VERSION@,g' LDRPATH_INSTALL = @LDRPATH_INSTALL@ LDRPATH_LOCAL = @LDRPATH_LOCAL@ INSTALL_PROGRAM = STRIPPROG="$(STRIP)" $(top_srcdir)/tools/install-sh $(INSTALL_PROGRAM_FLAGS) diff --git a/tools/makedep.c b/tools/makedep.c index 355f7fc0130..6b631b69022 100644 --- a/tools/makedep.c +++ b/tools/makedep.c @@ -148,11 +148,16 @@ static const char *man_ext; static const char *crosstarget; static const char *fontforge; static const char *convert; +static const char *flex; +static const char *bison; +static const char *ar; +static const char *ranlib; static const char *rsvg; static const char *icotool; static const char *dlltool; static const char *msgfmt; static const char *ln_s; +static const char *sed_cmd; struct makefile { @@ -2492,15 +2497,15 @@ static void output_source_y( struct makefile *make, struct incl_file *source, co if (find_include_file( make, header )) { output( "%s: %s\n", obj_dir_path( make, header ), source->filename ); - output( "\t$(BISON) -p %s_ -o %s.tab.c -d %s\n", - obj, obj_dir_path( make, obj ), source->filename ); + output( "\t%s -p %s_ -o %s.tab.c -d %s\n", + bison, obj, obj_dir_path( make, obj ), source->filename ); output( "%s.tab.c: %s %s\n", obj_dir_path( make, obj ), source->filename, obj_dir_path( make, header )); strarray_add( &make->clean_files, header ); } else output( "%s.tab.c: %s\n", obj, source->filename ); - output( "\t$(BISON) -p %s_ -o $@ %s\n", obj, source->filename ); + output( "\t%s -p %s_ -o $@ %s\n", bison, obj, source->filename ); } @@ -2510,7 +2515,7 @@ static void output_source_y( struct makefile *make, struct incl_file *source, co static void output_source_l( struct makefile *make, struct incl_file *source, const char *obj ) { output( "%s.yy.c: %s\n", obj_dir_path( make, obj ), source->filename ); - output( "\t$(FLEX) -o$@ %s\n", source->filename ); + output( "\t%s -o$@ %s\n", flex, source->filename ); } @@ -2825,7 +2830,7 @@ static void output_source_in( struct makefile *make, struct incl_file *source, c strarray_add( &make->in_files, xstrdup(obj) ); strarray_add( &make->all_targets, xstrdup(obj) ); output( "%s: %s\n", obj_dir_path( make, obj ), source->filename ); - output( "\t$(SED_CMD) %s >$@ || (rm -f $@ && false)\n", source->filename ); + output( "\t%s %s >$@ || (rm -f $@ && false)\n", sed_cmd, source->filename ); output( "%s:", obj_dir_path( make, obj )); output_filenames( source->dependencies ); output( "\n" ); @@ -3177,9 +3182,9 @@ static void output_static_lib( struct makefile *make ) output( "%s:", obj_dir_path( make, make->staticlib )); output_filenames_obj_dir( make, make->object_files ); output( "\n\trm -f $@\n" ); - output( "\t$(AR) $(ARFLAGS) $@" ); + output( "\t%s rc $@", ar ); output_filenames_obj_dir( make, make->object_files ); - output( "\n\t$(RANLIB) $@\n" ); + output( "\n\t%s $@\n", ranlib ); add_install_rule( make, make->staticlib, make->staticlib, strmake( "d$(dlldir)/%s", make->staticlib )); if (crosstarget && make->module) @@ -3190,7 +3195,7 @@ static void output_static_lib( struct makefile *make ) output( "%s:", obj_dir_path( make, name )); output_filenames_obj_dir( make, make->crossobj_files ); output( "\n\trm -f $@\n" ); - output( "\t%s-ar $(ARFLAGS) $@", crosstarget ); + output( "\t%s-ar rc $@", crosstarget ); output_filenames_obj_dir( make, make->crossobj_files ); output( "\n\t%s-ranlib $@\n", crosstarget ); } @@ -4229,10 +4234,15 @@ int main( int argc, char *argv[] ) crosstarget = get_expanded_make_variable( top_makefile, "CROSSTARGET" ); fontforge = get_expanded_make_variable( top_makefile, "FONTFORGE" ); convert = get_expanded_make_variable( top_makefile, "CONVERT" ); + flex = get_expanded_make_variable( top_makefile, "FLEX" ); + bison = get_expanded_make_variable( top_makefile, "BISON" ); + ar = get_expanded_make_variable( top_makefile, "AR" ); + ranlib = get_expanded_make_variable( top_makefile, "RANLIB" ); rsvg = get_expanded_make_variable( top_makefile, "RSVG" ); icotool = get_expanded_make_variable( top_makefile, "ICOTOOL" ); dlltool = get_expanded_make_variable( top_makefile, "DLLTOOL" ); msgfmt = get_expanded_make_variable( top_makefile, "MSGFMT" ); + sed_cmd = get_expanded_make_variable( top_makefile, "SED_CMD" ); ln_s = get_expanded_make_variable( top_makefile, "LN_S" ); if (root_src_dir && !strcmp( root_src_dir, "." )) root_src_dir = NULL;