Alexandre Julliard : makedep: Generate rules for import libraries.

Alexandre Julliard julliard at winehq.org
Tue Dec 31 11:11:42 CST 2013


Module: wine
Branch: master
Commit: a37ef65ea83d5b1e9d257ed81fda7ab2be75d5bd
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=a37ef65ea83d5b1e9d257ed81fda7ab2be75d5bd

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Mon Dec 30 20:14:45 2013 +0100

makedep: Generate rules for import libraries.

---

 Make.rules.in   |   16 +---------------
 Make.vars.in    |    1 -
 configure       |    5 +----
 configure.ac    |    3 +--
 tools/makedep.c |   54 +++++++++++++++++++++++++++++++++++++++++++++++++++++-
 5 files changed, 56 insertions(+), 23 deletions(-)

diff --git a/Make.rules.in b/Make.rules.in
index 004e5f1..c368f9a 100644
--- a/Make.rules.in
+++ b/Make.rules.in
@@ -19,8 +19,7 @@ RCFLAGS      = --nostdinc $(PORCFLAGS) $(TARGETFLAGS) $(DEFS) $(EXTRARCFLAGS)
 IDL_GEN_C_SRCS  = $(IDL_C_SRCS:.idl=_c.c) $(IDL_I_SRCS:.idl=_i.c) \
                   $(IDL_P_SRCS:.idl=_p.c) $(IDL_S_SRCS:.idl=_s.c)
 
-CLEAN_TARGETS = $(IMPORTLIB:%=lib%. at IMPLIBEXT@) \
-                $(TESTMODULE) $(TESTMODULE_STRIPPED) $(CROSSTESTMODULE)
+CLEAN_TARGETS = $(TESTMODULE) $(TESTMODULE_STRIPPED) $(CROSSTESTMODULE)
 
 OBJS = $(C_SRCS:.c=.o) $(BISON_SRCS:.y=.tab.o) $(LEX_SRCS:.l=.yy.o) $(IDL_GEN_C_SRCS:.c=.o) $(OBJC_SRCS:.m=.o) \
        $(IDL_R_SRCS:.idl=_r.res) $(IDL_TLB_RES) $(RC_SRCS:.rc=.res) $(MC_SRCS:.mc=.res) $(EXTRA_OBJS)
@@ -42,19 +41,6 @@ $(STATICLIB:.a=.cross.a): $(CROSSOBJS)
 	$(CROSSAR) $(ARFLAGS) $@ $(CROSSOBJS)
 	$(CROSSRANLIB) $@
 
-# Rules for import libraries
-
-$(IMPORTLIB:%=lib%.def.a): $(IMPLIB_SRCS:.c=.o)
-	$(RM) $@
-	$(AR) $(ARFLAGS) $@ $(IMPLIB_SRCS:.c=.o)
-	$(RANLIB) $@
-
-$(IMPORTLIB:%=lib%.a): $(MAINSPEC) $(IMPLIB_SRCS:.c=.o)
-	$(WINEBUILD) $(TARGETFLAGS) -w --implib -o $@ --export $(MAINSPEC) $(IMPLIB_SRCS:.c=.o)
-
-$(IMPORTLIB:%=lib%.cross.a): $(MAINSPEC) $(IMPLIB_SRCS:.c=.cross.o)
-	$(WINEBUILD) $(CROSSTARGET:%=-b %) -w --implib -o $@ --export $(MAINSPEC) $(IMPLIB_SRCS:.c=.cross.o)
-
 # Rules for dependencies
 
 depend: dummy
diff --git a/Make.vars.in b/Make.vars.in
index 7b6e265..5246f89 100644
--- a/Make.vars.in
+++ b/Make.vars.in
@@ -30,7 +30,6 @@ FLEX            = @FLEX@
 EXEEXT          = @EXEEXT@
 DLLPREFIX       = @DLLPREFIX@
 TOOLSEXT        = @TOOLSEXT@
-IMPLIBEXT       = @IMPLIBEXT@
 DLLTOOL         = @DLLTOOL@
 AR              = @AR@
 ARFLAGS         = @ARFLAGS@
diff --git a/configure b/configure
index 6fb5933..8a254ad 100755
--- a/configure
+++ b/configure
@@ -711,7 +711,6 @@ READELF
 LDD
 LDRPATH_LOCAL
 LDRPATH_INSTALL
-IMPLIBEXT
 DLLFLAGS
 DLLPREFIX
 dlldir
@@ -6908,14 +6907,13 @@ DLLPREFIX=""
 
 DLLFLAGS="-D_REENTRANT"
 
-IMPLIBEXT="def"
-
 LDRPATH_INSTALL=""
 
 LDRPATH_LOCAL=""
 
 LIBEXT="so"
 DLLEXT=".so"
+IMPLIBEXT="def"
 STATIC_IMPLIBEXT="def.a"
 # Extract the first word of "ldd", so it can be a program name with args.
 set dummy ldd; ac_word=$2
@@ -17426,7 +17424,6 @@ wine_fn_ignore_file "config.status"
 wine_fn_ignore_file "configure.lineno"
 wine_fn_ignore_file "include/config.h"
 wine_fn_ignore_file "include/stamp-h"
-wine_fn_ignore_file "dlls/*/*.def"
 test "x$enable_fonts" = xno || wine_fn_ignore_file "fonts/*.fon"
 test "x$enable_winetest" = xno || wine_fn_ignore_file "programs/winetest/build.nfo"
 test "x$enable_winetest" = xno || wine_fn_ignore_file "programs/winetest/build.rc"
diff --git a/configure.ac b/configure.ac
index 9d9078c..a8a7da4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -675,11 +675,11 @@ dnl **** Check for working dll ****
 AC_SUBST(dlldir,"\${libdir}/wine")
 AC_SUBST(DLLPREFIX,"")
 AC_SUBST(DLLFLAGS,"-D_REENTRANT")
-AC_SUBST(IMPLIBEXT,"def")
 AC_SUBST(LDRPATH_INSTALL,"")
 AC_SUBST(LDRPATH_LOCAL,"")
 LIBEXT="so"
 DLLEXT=".so"
+IMPLIBEXT="def"
 STATIC_IMPLIBEXT="def.a"
 WINE_PATH_SONAME_TOOLS
 
@@ -3470,7 +3470,6 @@ WINE_IGNORE_FILE("config.status")
 WINE_IGNORE_FILE("configure.lineno")
 WINE_IGNORE_FILE("include/config.h")
 WINE_IGNORE_FILE("include/stamp-h")
-WINE_IGNORE_FILE("dlls/*/*.def")
 WINE_IGNORE_FILE("fonts/*.fon",enable_fonts)
 WINE_IGNORE_FILE("programs/winetest/build.nfo",enable_winetest)
 WINE_IGNORE_FILE("programs/winetest/build.rc",enable_winetest)
diff --git a/tools/makedep.c b/tools/makedep.c
index 0516cbb..f7bba41 100644
--- a/tools/makedep.c
+++ b/tools/makedep.c
@@ -1376,6 +1376,7 @@ static struct strarray output_sources(void)
     struct strarray mc_files = empty_strarray;
     struct strarray test_files = empty_strarray;
     struct strarray dlldata_files = empty_strarray;
+    struct strarray implib_objs = empty_strarray;
     struct strarray includes = empty_strarray;
     struct strarray subdirs = empty_strarray;
     struct strarray all_targets = empty_strarray;
@@ -1385,6 +1386,7 @@ static struct strarray output_sources(void)
     char *module = get_expanded_make_variable( "MODULE" );
     char *exeext = get_expanded_make_variable( "EXEEXT" );
     char *appmode = get_expanded_make_variable( "APPMODE" );
+    char *crosstarget = get_expanded_make_variable( "CROSSTARGET" );
 
     if (exeext && !strcmp( exeext, ".exe" )) dllext = "";
 
@@ -1569,6 +1571,7 @@ static struct strarray output_sources(void)
         else
         {
             if (source->flags & FLAG_GENERATED) strarray_add( &clean_files, source->filename );
+            if (source->flags & FLAG_C_IMPLIB) strarray_add( &implib_objs, strmake( "%s.o", obj ));
             for (i = 0; i < object_extensions.count; i++)
             {
                 output( "%s.%s: %s\n", obj, object_extensions.str[i], sourcedep );
@@ -1589,7 +1592,7 @@ static struct strarray output_sources(void)
                     output( "\n" );
                 }
             }
-            if (source->flags & FLAG_C_IMPLIB)
+            if (crosstarget && (source->flags & FLAG_C_IMPLIB))
             {
                 strarray_add( &crossobj_files, strmake( "%s.cross.o", obj ));
                 output( "%s.cross.o: %s\n", obj, sourcedep );
@@ -1653,6 +1656,8 @@ static struct strarray output_sources(void)
 
     if (module)
     {
+        int is_win16 = strendswith( module, "16" );
+        char *importlib = get_expanded_make_variable( "IMPORTLIB" );
         struct strarray all_libs = empty_strarray;
         char *spec_file = appmode ? NULL : replace_extension( module, ".dll", ".spec" );
 
@@ -1695,6 +1700,53 @@ static struct strarray output_sources(void)
         output_filenames( all_libs );
         output_filename( "$(LDFLAGS)" );
         output( "\n" );
+
+        if (spec_file && importlib)
+        {
+            if (*dllext)
+            {
+                strarray_add( &clean_files, strmake( "lib%s.def", importlib ));
+                output( "lib%s.def: %s\n", importlib, spec_file );
+                output( "\t$(WINEBUILD) -w --def -o $@ --export %s", spec_file );
+                output_filenames( get_expanded_make_var_array( "TARGETFLAGS" ));
+                if (is_win16) output_filename( "-m16" );
+                output( "\n" );
+                if (implib_objs.count)
+                {
+                    strarray_add( &clean_files, strmake( "lib%s.def.a", importlib ));
+                    output( "lib%s.def.a:", importlib );
+                    output_filenames( implib_objs );
+                    output( "\n" );
+                    output( "\t$(RM) $@\n" );
+                    output( "\t$(AR) $(ARFLAGS) $@" );
+                    output_filenames( implib_objs );
+                    output( "\n" );
+                    output( "\t$(RANLIB) $@\n" );
+                }
+            }
+            else
+            {
+                strarray_add( &clean_files, strmake( "lib%s.a", importlib ));
+                output( "lib%s.a: %s", importlib, spec_file );
+                output_filenames( implib_objs );
+                output( "\n" );
+                output( "\t$(WINEBUILD) -w --implib -o $@ --export %s", spec_file );
+                output_filenames( get_expanded_make_var_array( "TARGETFLAGS" ));
+                output_filenames( implib_objs );
+                output( "\n" );
+            }
+            if (crosstarget && !is_win16)
+            {
+                struct strarray cross_files = strarray_replace_extension( &implib_objs, ".o", ".cross.o" );
+                strarray_add( &clean_files, strmake( "lib%s.cross.a", importlib ));
+                output( "lib%s.cross.a: %s", importlib, spec_file );
+                output_filenames( cross_files );
+                output( "\n" );
+                output( "\t$(WINEBUILD) -b %s -w --implib -o $@ --export %s", crosstarget, spec_file );
+                output_filenames( cross_files );
+                output( "\n" );
+            }
+        }
     }
 
     if (is_test)




More information about the wine-cvs mailing list