Module: wine Branch: master Commit: 3602962275be6f4eb5173f28b6d7fa25c55e3648 URL: http://source.winehq.org/git/wine.git/?a=commit;h=3602962275be6f4eb5173f28b6...
Author: Alexandre Julliard julliard@winehq.org Date: Tue Feb 23 14:57:11 2016 +0900
makefiles: Generate dependencies for static libraries.
Signed-off-by: Alexandre Julliard julliard@winehq.org
---
Makefile.in | 2 -- dlls/d3dcompiler_43/Makefile.in | 2 +- dlls/d3dcompiler_46/Makefile.in | 2 +- dlls/d3dcompiler_47/Makefile.in | 2 +- libs/wine/Makefile.in | 2 +- tools/makedep.c | 80 ++++++++++++++++++++++++++++++++--------- tools/widl/Makefile.in | 2 +- tools/wrc/Makefile.in | 2 +- 8 files changed, 70 insertions(+), 24 deletions(-)
diff --git a/Makefile.in b/Makefile.in index 7486ba6..b78f43b 100644 --- a/Makefile.in +++ b/Makefile.in @@ -77,8 +77,6 @@ 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 PACKAGE_VERSION = @PACKAGE_VERSION@ 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@ diff --git a/dlls/d3dcompiler_43/Makefile.in b/dlls/d3dcompiler_43/Makefile.in index e9a927e..99c1f62 100644 --- a/dlls/d3dcompiler_43/Makefile.in +++ b/dlls/d3dcompiler_43/Makefile.in @@ -1,7 +1,7 @@ MODULE = d3dcompiler_43.dll IMPORTLIB = d3dcompiler IMPORTS = dxguid uuid -EXTRALIBS = $(LIBWPP) +EXTRALIBS = -lwpp
C_SRCS = \ asmparser.c \ diff --git a/dlls/d3dcompiler_46/Makefile.in b/dlls/d3dcompiler_46/Makefile.in index e13cbd0..0be92b1 100644 --- a/dlls/d3dcompiler_46/Makefile.in +++ b/dlls/d3dcompiler_46/Makefile.in @@ -1,6 +1,6 @@ MODULE = d3dcompiler_46.dll IMPORTS = dxguid uuid -EXTRALIBS = $(LIBWPP) +EXTRALIBS = -lwpp EXTRADEFS = -DD3D_COMPILER_VERSION=46 PARENTSRC = ../d3dcompiler_43
diff --git a/dlls/d3dcompiler_47/Makefile.in b/dlls/d3dcompiler_47/Makefile.in index cb7f557..48b343a 100644 --- a/dlls/d3dcompiler_47/Makefile.in +++ b/dlls/d3dcompiler_47/Makefile.in @@ -1,6 +1,6 @@ MODULE = d3dcompiler_47.dll IMPORTS = dxguid uuid -EXTRALIBS = $(LIBWPP) +EXTRALIBS = -lwpp EXTRADEFS = -DD3D_COMPILER_VERSION=47 PARENTSRC = ../d3dcompiler_43
diff --git a/libs/wine/Makefile.in b/libs/wine/Makefile.in index 161a6c1..02f266c 100644 --- a/libs/wine/Makefile.in +++ b/libs/wine/Makefile.in @@ -1,4 +1,4 @@ -EXTRALIBS = $(LIBPORT) $(DL_LIBS) $(COREFOUNDATION_LIBS) $(CORESERVICES_LIBS) +EXTRALIBS = $(DL_LIBS) $(COREFOUNDATION_LIBS) $(CORESERVICES_LIBS) EXTRADEFS = -DWINE_UNICODE_API=""
C_SRCS = \ diff --git a/tools/makedep.c b/tools/makedep.c index c9bfb15..d18018b 100644 --- a/tools/makedep.c +++ b/tools/makedep.c @@ -1892,6 +1892,60 @@ static struct strarray get_local_dependencies( const struct makefile *make, cons
/******************************************************************* + * has_static_lib + * + * Check if makefile builds the named static library. + */ +static int has_static_lib( const struct makefile *make, const char *name ) +{ + if (!make->staticlib) return 0; + if (strncmp( make->staticlib, "lib", 3 )) return 0; + if (strncmp( make->staticlib + 3, name, strlen(name) )) return 0; + return !strcmp( make->staticlib + 3 + strlen(name), ".a" ); +} + + +/******************************************************************* + * add_default_libraries + */ +static struct strarray add_default_libraries( const struct makefile *make, struct strarray *deps ) +{ + struct strarray ret = empty_strarray; + struct strarray all_libs = empty_strarray; + unsigned int i, j; + + strarray_add( &all_libs, "-lwine_port" ); + strarray_addall( &all_libs, get_expanded_make_var_array( make, "EXTRALIBS" )); + strarray_addall( &all_libs, libs ); + + for (i = 0; i < all_libs.count; i++) + { + int found = 0; + if (!strncmp( all_libs.str[i], "-l", 2 )) + { + const char *name = all_libs.str[i] + 2; + + for (j = 0; j < top_makefile->subdirs.count; j++) + { + const struct makefile *submake = top_makefile->submakes[j]; + + if ((found = has_static_lib( submake, name ))) + { + const char *lib = strmake( "%s/lib%s.a", + top_obj_dir_path( make, submake->base_dir ), name ); + strarray_add( deps, lib ); + strarray_add( &ret, lib ); + break; + } + } + } + if (!found) strarray_add( &ret, all_libs.str[i] ); + } + return ret; +} + + +/******************************************************************* * add_import_libs */ static struct strarray add_import_libs( const struct makefile *make, struct strarray *deps, @@ -1919,10 +1973,7 @@ static struct strarray add_import_libs( const struct makefile *make, struct stra break; }
- if (submake->staticlib && - !strncmp( submake->staticlib, "lib", 3 ) && - !strncmp( submake->staticlib + 3, name, strlen(name) ) && - !strcmp( submake->staticlib + 3 + strlen(name), ".a" )) + if (has_static_lib( submake, name )) { const char *dir = top_obj_dir_path( make, submake->base_dir );
@@ -2479,9 +2530,7 @@ static struct strarray output_sources( const struct makefile *make ) for (i = 0; i < make->delayimports.count; i++) strarray_add( &all_libs, strmake( "-Wb,-d%s", make->delayimports.str[i] )); strarray_add( &all_libs, "-lwine" ); - strarray_add( &all_libs, top_obj_dir_path( make, "libs/port/libwine_port.a" )); - strarray_addall( &all_libs, get_expanded_make_var_array( make, "EXTRALIBS" )); - strarray_addall( &all_libs, libs ); + strarray_addall( &all_libs, add_default_libraries( make, &dep_libs ));
if (*dll_ext) { @@ -2659,18 +2708,19 @@ static struct strarray output_sources( const struct makefile *make ) char *basename, *p; struct strarray names = get_shared_lib_names( make->sharedlib ); struct strarray all_libs = empty_strarray; + struct strarray dep_libs = empty_strarray;
basename = xstrdup( make->sharedlib ); if ((p = strchr( basename, '.' ))) *p = 0;
+ strarray_addall( &dep_libs, get_local_dependencies( make, basename, in_files )); strarray_addall( &all_libs, get_expanded_make_var_array( make, file_local_var( basename, "LDFLAGS" ))); - strarray_addall( &all_libs, get_expanded_make_var_array( make, "EXTRALIBS" )); - strarray_addall( &all_libs, libs ); + strarray_addall( &all_libs, add_default_libraries( make, &dep_libs ));
output( "%s:", obj_dir_path( make, make->sharedlib )); output_filenames_obj_dir( make, object_files ); - output_filenames( get_local_dependencies( make, basename, in_files )); + output_filenames( dep_libs ); output( "\n" ); output( "\t$(CC) -o $@" ); output_filenames_obj_dir( make, object_files ); @@ -2796,25 +2846,23 @@ static struct strarray output_sources( const struct makefile *make ) { char *program_installed = NULL; char *program = strmake( "%s%s", make->programs.str[i], exe_ext ); - struct strarray all_libs = empty_strarray; struct strarray deps = get_local_dependencies( make, make->programs.str[i], in_files ); + struct strarray all_libs = get_expanded_make_var_array( make, + file_local_var( make->programs.str[i], "LDFLAGS" )); struct strarray objs = get_expanded_make_var_array( make, file_local_var( make->programs.str[i], "OBJS" )); struct strarray symlinks = get_expanded_make_var_array( make, file_local_var( make->programs.str[i], "SYMLINKS" ));
if (!objs.count) objs = object_files; + strarray_addall( &all_libs, add_default_libraries( make, &deps )); + output( "%s:", obj_dir_path( make, program ) ); output_filenames_obj_dir( make, objs ); output_filenames( deps ); output( "\n" ); output( "\t$(CC) -o $@" ); output_filenames_obj_dir( make, objs ); - strarray_add( &all_libs, top_obj_dir_path( make, "libs/port/libwine_port.a" )); - strarray_addall( &all_libs, get_expanded_make_var_array( make, "EXTRALIBS" )); - strarray_addall( &all_libs, libs ); - strarray_addall( &all_libs, get_expanded_make_var_array( make, - file_local_var( make->programs.str[i], "LDFLAGS" )));
if (strarray_exists( &all_libs, "-lwine" )) { diff --git a/tools/widl/Makefile.in b/tools/widl/Makefile.in index f8111f3..b47a170 100644 --- a/tools/widl/Makefile.in +++ b/tools/widl/Makefile.in @@ -21,6 +21,6 @@ BISON_SRCS = parser.y
widl_EXTRADEFS = -DDEFAULT_INCLUDE_DIR="${includedir}/windows/"
-EXTRALIBS = $(LIBWPP) +EXTRALIBS = -lwpp
INSTALL_DEV = $(PROGRAMS) diff --git a/tools/wrc/Makefile.in b/tools/wrc/Makefile.in index 8c94ead..d502e4b 100644 --- a/tools/wrc/Makefile.in +++ b/tools/wrc/Makefile.in @@ -17,6 +17,6 @@ BISON_SRCS = parser.y
wrc_EXTRADEFS = -DINCLUDEDIR=""${includedir}""
-EXTRALIBS = $(GETTEXTPO_LIBS) $(LIBWPP) +EXTRALIBS = $(GETTEXTPO_LIBS) -lwpp
INSTALL_DEV = $(PROGRAMS)