makefiles: Read variable definitions from the top makefile instead of using Make.vars.in.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2015-10-23 14:49:36 +09:00
parent 8a33dd43f6
commit ef557a8a8a
6 changed files with 114 additions and 94 deletions

View File

@ -1,77 +0,0 @@
# @configure_input@ -*-Makefile-*-
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
libdir = @libdir@
datarootdir = @datarootdir@
datadir = @datadir@
mandir = @mandir@
fontdir = ${datadir}/wine/fonts
includedir = @includedir@/wine
dlldir = @dlldir@
fakedlldir = ${dlldir}/fakedlls
top_srcdir = @top_srcdir@
top_builddir = @top_builddir@
srcdir = @srcdir@
SHELL = /bin/sh
RM = rm -f
MV = mv
CC = @CC@
CXX = @CXX@
CPPBIN = @CPPBIN@
CROSSCC = @CROSSCC@
CFLAGS = @CFLAGS@
CPPFLAGS = @CPPFLAGS@
EXTRACFLAGS = @EXTRACFLAGS@
MSVCRTFLAGS = @BUILTINFLAG@
TARGETFLAGS = @TARGETFLAGS@
UNWINDFLAGS = @UNWINDFLAGS@
LIBS = @LIBS@
BISON = @BISON@
FLEX = @FLEX@
EXEEXT = @EXEEXT@
DLLPREFIX = @DLLPREFIX@
TOOLSEXT = @TOOLSEXT@
DLLTOOL = @DLLTOOL@
AR = @AR@
ARFLAGS = @ARFLAGS@
RANLIB = @RANLIB@
STRIP = @STRIP@
LN_S = @LN_S@
TOOLSDIR = @TOOLSDIR@
LD = @LD@
LDFLAGS = @LDFLAGS@
DLLFLAGS = @DLLFLAGS@
PRELINK = @PRELINK@
FONTFORGE = @FONTFORGE@
RSVG = @RSVG@
CONVERT = @CONVERT@
ICOTOOL = @ICOTOOL@
MSGFMT = @MSGFMT@
CROSSTARGET = @CROSSTARGET@
LINGUAS = @LINGUAS@
RUNTESTFLAGS = -q -P wine
MAKEDEP = $(TOOLSDIR)/tools/makedep$(TOOLSEXT)
WINEBUILD = $(TOOLSDIR)/tools/winebuild/winebuild$(TOOLSEXT)
WRC = $(TOOLSDIR)/tools/wrc/wrc$(TOOLSEXT)
LIBPORT = $(top_builddir)/libs/port/libwine_port.a
LIBWPP = $(top_builddir)/libs/wpp/libwpp.a
LIBWINE = -L$(top_builddir)/libs/wine -lwine
LIBWINE_STATIC = $(top_builddir)/libs/wine/libwine_static.a
SED_CMD = LC_ALL=C sed -e 's,@bindir\@,$(bindir),g' -e 's,@dlldir\@,$(dlldir),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)
INSTALL_SCRIPT = $(top_srcdir)/tools/install-sh $(INSTALL_SCRIPT_FLAGS)
INSTALL_DATA = $(top_srcdir)/tools/install-sh -m 644 $(INSTALL_DATA_FLAGS)
prog_manext = 1
api_manext = 3w
conf_manext = 5
@ALL_VARS_RULES@
@SET_MAKE@
all:
.PHONY: all
# End of common header

View File

@ -18,6 +18,82 @@
# sgmlpages: compile sgml source for the Wine API Guide # sgmlpages: compile sgml source for the Wine API Guide
# xmlpages: compile xml source for the Wine API Guide # xmlpages: compile xml source for the Wine API Guide
# Start of common header
# The following variable definitions are copied into all makefiles
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
libdir = @libdir@
datarootdir = @datarootdir@
datadir = @datadir@
mandir = @mandir@
fontdir = ${datadir}/wine/fonts
includedir = @includedir@/wine
dlldir = @dlldir@
fakedlldir = ${dlldir}/fakedlls
top_srcdir = @top_srcdir@
top_builddir = @top_builddir@
srcdir = @srcdir@
SHELL = /bin/sh
RM = rm -f
MV = mv
CC = @CC@
CXX = @CXX@
CPPBIN = @CPPBIN@
CROSSCC = @CROSSCC@
CFLAGS = @CFLAGS@
CPPFLAGS = @CPPFLAGS@
EXTRACFLAGS = @EXTRACFLAGS@
MSVCRTFLAGS = @BUILTINFLAG@
TARGETFLAGS = @TARGETFLAGS@
UNWINDFLAGS = @UNWINDFLAGS@
LIBS = @LIBS@
BISON = @BISON@
FLEX = @FLEX@
EXEEXT = @EXEEXT@
DLLPREFIX = @DLLPREFIX@
TOOLSEXT = @TOOLSEXT@
DLLTOOL = @DLLTOOL@
AR = @AR@
ARFLAGS = @ARFLAGS@
RANLIB = @RANLIB@
STRIP = @STRIP@
LN_S = @LN_S@
TOOLSDIR = @TOOLSDIR@
LD = @LD@
LDFLAGS = @LDFLAGS@
DLLFLAGS = @DLLFLAGS@
PRELINK = @PRELINK@
FONTFORGE = @FONTFORGE@
RSVG = @RSVG@
CONVERT = @CONVERT@
ICOTOOL = @ICOTOOL@
MSGFMT = @MSGFMT@
CROSSTARGET = @CROSSTARGET@
LINGUAS = @LINGUAS@
RUNTESTFLAGS = -q -P wine
MAKEDEP = $(TOOLSDIR)/tools/makedep$(TOOLSEXT)
WINEBUILD = $(TOOLSDIR)/tools/winebuild/winebuild$(TOOLSEXT)
WRC = $(TOOLSDIR)/tools/wrc/wrc$(TOOLSEXT)
LIBPORT = $(top_builddir)/libs/port/libwine_port.a
LIBWPP = $(top_builddir)/libs/wpp/libwpp.a
LIBWINE = -L$(top_builddir)/libs/wine -lwine
LIBWINE_STATIC = $(top_builddir)/libs/wine/libwine_static.a
SED_CMD = LC_ALL=C sed -e 's,@bindir\@,$(bindir),g' -e 's,@dlldir\@,$(dlldir),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)
INSTALL_SCRIPT = $(top_srcdir)/tools/install-sh $(INSTALL_SCRIPT_FLAGS)
INSTALL_DATA = $(top_srcdir)/tools/install-sh -m 644 $(INSTALL_DATA_FLAGS)
prog_manext = 1
api_manext = 3w
conf_manext = 5
@ALL_VARS_RULES@
@SET_MAKE@
# End of common header
all: wine all: wine
@echo "Wine build complete." @echo "Wine build complete."

6
aclocal.m4 vendored
View File

@ -226,12 +226,12 @@ wine_fn_has_flag ()
wine_fn_depend_rules () wine_fn_depend_rules ()
{ {
wine_fn_append_rule \ wine_fn_append_rule \
"$ac_dir/Makefile: $srcdir/$ac_dir/Makefile.in $srcdir/Make.vars.in config.status \$(MAKEDEP) "$ac_dir/Makefile: $srcdir/$ac_dir/Makefile.in Makefile config.status \$(MAKEDEP)
@./config.status --file $ac_dir/Makefile:Make.vars.in:$ac_dir/Makefile.in && \$(MAKEDEP) $ac_dir @./config.status --file $ac_dir/Makefile && \$(MAKEDEP) $ac_dir
depend: $ac_dir/depend depend: $ac_dir/depend
.PHONY: $ac_dir/depend .PHONY: $ac_dir/depend
$ac_dir/depend: \$(MAKEDEP) dummy $ac_dir/depend: \$(MAKEDEP) dummy
@./config.status --file $ac_dir/Makefile:Make.vars.in:$ac_dir/Makefile.in && \$(MAKEDEP) $ac_dir" @./config.status --file $ac_dir/Makefile && \$(MAKEDEP) $ac_dir"
} }
wine_fn_pot_rules () wine_fn_pot_rules ()

12
configure vendored
View File

@ -7390,12 +7390,12 @@ wine_fn_has_flag ()
wine_fn_depend_rules () wine_fn_depend_rules ()
{ {
wine_fn_append_rule \ wine_fn_append_rule \
"$ac_dir/Makefile: $srcdir/$ac_dir/Makefile.in $srcdir/Make.vars.in config.status \$(MAKEDEP) "$ac_dir/Makefile: $srcdir/$ac_dir/Makefile.in Makefile config.status \$(MAKEDEP)
@./config.status --file $ac_dir/Makefile:Make.vars.in:$ac_dir/Makefile.in && \$(MAKEDEP) $ac_dir @./config.status --file $ac_dir/Makefile && \$(MAKEDEP) $ac_dir
depend: $ac_dir/depend depend: $ac_dir/depend
.PHONY: $ac_dir/depend .PHONY: $ac_dir/depend
$ac_dir/depend: \$(MAKEDEP) dummy $ac_dir/depend: \$(MAKEDEP) dummy
@./config.status --file $ac_dir/Makefile:Make.vars.in:$ac_dir/Makefile.in && \$(MAKEDEP) $ac_dir" @./config.status --file $ac_dir/Makefile && \$(MAKEDEP) $ac_dir"
} }
wine_fn_pot_rules () wine_fn_pot_rules ()
@ -17187,7 +17187,7 @@ CLEAN_FILES = *.o *.a *.so *.res *.fake *.ok *.tab.[ch] *.yy.c
.INIT: Makefile .INIT: Makefile
.MAKEFILEDEPS: .MAKEFILEDEPS:
all: Makefile all: Makefile
Makefile: $srcdir/Makefile.in $srcdir/Make.vars.in config.status \$(MAKEDEP) Makefile: $srcdir/Makefile.in config.status \$(MAKEDEP)
@./config.status Make.tmp Makefile" @./config.status Make.tmp Makefile"
test "$srcdir" = . && wine_fn_append_rule "all: .gitignore test "$srcdir" = . && wine_fn_append_rule "all: .gitignore
@ -18187,7 +18187,7 @@ fi
ac_config_commands="$ac_config_commands Makefile" ac_config_commands="$ac_config_commands Makefile"
ac_config_files="$ac_config_files Make.tmp:Make.vars.in:Makefile.in" ac_config_files="$ac_config_files Make.tmp:Makefile.in"
@ -19004,7 +19004,7 @@ do
"wine64") CONFIG_LINKS="$CONFIG_LINKS wine64:tools/winewrapper" ;; "wine64") CONFIG_LINKS="$CONFIG_LINKS wine64:tools/winewrapper" ;;
"tools/makedep") CONFIG_COMMANDS="$CONFIG_COMMANDS tools/makedep" ;; "tools/makedep") CONFIG_COMMANDS="$CONFIG_COMMANDS tools/makedep" ;;
"Makefile") CONFIG_COMMANDS="$CONFIG_COMMANDS Makefile" ;; "Makefile") CONFIG_COMMANDS="$CONFIG_COMMANDS Makefile" ;;
"Make.tmp") CONFIG_FILES="$CONFIG_FILES Make.tmp:Make.vars.in:Makefile.in" ;; "Make.tmp") CONFIG_FILES="$CONFIG_FILES Make.tmp:Makefile.in" ;;
".gitignore") CONFIG_COMMANDS="$CONFIG_COMMANDS .gitignore" ;; ".gitignore") CONFIG_COMMANDS="$CONFIG_COMMANDS .gitignore" ;;
*) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;

View File

@ -2682,7 +2682,7 @@ CLEAN_FILES = *.o *.a *.so *.res *.fake *.ok *.tab.[[ch]] *.yy.c
.INIT: Makefile .INIT: Makefile
.MAKEFILEDEPS: .MAKEFILEDEPS:
all: Makefile all: Makefile
Makefile: $srcdir/Makefile.in $srcdir/Make.vars.in config.status \$(MAKEDEP) Makefile: $srcdir/Makefile.in config.status \$(MAKEDEP)
@./config.status Make.tmp Makefile]) @./config.status Make.tmp Makefile])
test "$srcdir" = . && WINE_APPEND_RULE( test "$srcdir" = . && WINE_APPEND_RULE(
@ -3682,7 +3682,7 @@ _WINE_EOF
AS_ERROR([could not create Makefile]) AS_ERROR([could not create Makefile])
}]) }])
AC_CONFIG_FILES([Make.tmp:Make.vars.in:Makefile.in]) AC_CONFIG_FILES([Make.tmp:Makefile.in])
dnl Some final makefile rules dnl Some final makefile rules

View File

@ -1751,6 +1751,7 @@ static struct strarray output_sources( struct makefile *make, struct strarray *t
for (i = 0; i < linguas.count; i++) for (i = 0; i < linguas.count; i++)
strarray_add( &mo_files, strmake( "%s/%s.mo", top_obj_dir_path( make, "po" ), linguas.str[i] )); strarray_add( &mo_files, strmake( "%s/%s.mo", top_obj_dir_path( make, "po" ), linguas.str[i] ));
strarray_add( &phony_targets, "all" );
strarray_add( &includes, strmake( "-I%s", obj_dir_path( make, "" ))); strarray_add( &includes, strmake( "-I%s", obj_dir_path( make, "" )));
if (make->src_dir) strarray_add( &includes, strmake( "-I%s", make->src_dir )); if (make->src_dir) strarray_add( &includes, strmake( "-I%s", make->src_dir ));
if (make->parent_dir) strarray_add( &includes, strmake( "-I%s", src_dir_path( make, make->parent_dir ))); if (make->parent_dir) strarray_add( &includes, strmake( "-I%s", src_dir_path( make, make->parent_dir )));
@ -2512,32 +2513,52 @@ static void output_gitignore( const char *dest, struct strarray files )
} }
/*******************************************************************
* output_top_variables
*/
static void output_top_variables( struct makefile *make )
{
unsigned int i;
struct strarray *vars = &top_makefile->vars;
if (!make->base_dir) return; /* don't output variables in the top makefile */
output( "# Automatically generated by make depend; DO NOT EDIT!!\n\n" );
output( "all:\n\n" );
for (i = 0; i < vars->count; i += 2)
output( "%s = %s\n", vars->str[i], get_make_variable( make, vars->str[i] ));
output( "\n" );
}
/******************************************************************* /*******************************************************************
* output_dependencies * output_dependencies
*/ */
static void output_dependencies( struct makefile *make, const char *path ) static void output_dependencies( struct makefile *make, const char *path )
{ {
struct strarray targets, testlist_files = empty_strarray, ignore_files = empty_strarray; struct strarray targets, testlist_files = empty_strarray, ignore_files = empty_strarray;
FILE *src_file;
if (Separator && ((output_file = fopen( path, "r" )))) if (Separator && ((src_file = fopen( path, "r" ))))
{ {
char buffer[1024]; char buffer[1024];
FILE *tmp_file = create_temp_file( path );
int found = 0; int found = 0;
while (fgets( buffer, sizeof(buffer), output_file ) && !found) output_file = create_temp_file( path );
output_top_variables( make );
while (fgets( buffer, sizeof(buffer), src_file ) && !found)
{ {
if (fwrite( buffer, 1, strlen(buffer), tmp_file ) != strlen(buffer)) fatal_perror( "write" ); if (fwrite( buffer, 1, strlen(buffer), output_file ) != strlen(buffer)) fatal_perror( "write" );
found = !strncmp( buffer, Separator, strlen(Separator) ); found = !strncmp( buffer, Separator, strlen(Separator) );
} }
if (fclose( output_file )) fatal_perror( "write" ); if (fclose( src_file )) fatal_perror( "close" );
output_file = tmp_file;
if (!found) output( "\n%s\n", Separator ); if (!found) output( "\n%s\n", Separator );
} }
else else
{ {
if (!(output_file = fopen( path, Separator ? "a" : "w" ))) if (!(output_file = fopen( path, Separator ? "a" : "w" )))
fatal_perror( "%s", path ); fatal_perror( "%s", path );
output_top_variables( make );
} }
targets = output_sources( make, &testlist_files ); targets = output_sources( make, &testlist_files );