Alexandre Julliard : makedep: Generate rules for the main module.

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


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

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

makedep: Generate rules for the main module.

---

 Make.rules.in   |    7 +-----
 configure       |   14 -----------
 configure.ac    |   14 -----------
 tools/makedep.c |   67 +++++++++++++++++++++++++++++++++++++++++++++++++++++-
 4 files changed, 66 insertions(+), 36 deletions(-)

diff --git a/Make.rules.in b/Make.rules.in
index 08b790d..004e5f1 100644
--- a/Make.rules.in
+++ b/Make.rules.in
@@ -19,7 +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 = $(MODULE) $(IMPORTLIB:%=lib%. at IMPLIBEXT@) \
+CLEAN_TARGETS = $(IMPORTLIB:%=lib%. at IMPLIBEXT@) \
                 $(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) \
@@ -28,11 +28,6 @@ OBJS = $(C_SRCS:.c=.o) $(BISON_SRCS:.y=.tab.o) $(LEX_SRCS:.l=.yy.o) $(IDL_GEN_C_
 CROSSOBJS = $(OBJS:.o=.cross.o)
 ALLCROSSCFLAGS = $(DEFS) -DWINE_CROSSTEST $(CPPFLAGS) $(CFLAGS)
 
-# Rules for main module
-
-$(MODULE) $(MODULE:%=%.so) $(MODULE:%=%.fake): $(MAINSPEC) $(OBJS)
-	$(WINEGCC) $(APPMODE) $(MODULEFLAGS) $(OBJS) -o $@ $(DELAYIMPORTS:%=-l%) $(IMPORTS:%=-l%) $(DELAYIMPORTS:%=-Wb,-d%) -lwine $(LIBPORT) $(EXTRALIBS) $(LDFLAGS) $(LIBS)
-
 # Rules for static libraries
 
 all: $(STATICLIB)
diff --git a/configure b/configure
index a3c36ce..6fb5933 100755
--- a/configure
+++ b/configure
@@ -16556,20 +16556,9 @@ all: \$(STATICLIB:.a=.cross.a)
 fi
 
 
-if test -n "$DLLEXT"
-then
-    deps="\$(MODULE)$DLLEXT \$(MODULE).fake"
-else
-    deps="\$(MODULE)"
-fi
-
 MAKE_DLL_RULES="
 DLLFLAGS    = $DLLFLAGS
 MAINSPEC    = \$(srcdir)/\$(MODULE:%.dll=%).spec
-IDL_TLB_RES = \$(IDL_TLB_SRCS:.idl=_t.res)
-MODULEFLAGS = -shared \$(MAINSPEC) \$(EXTRADLLFLAGS)
-
-all: $deps
 
 manpages:: dummy
 	\$(C2MAN) -o \$(top_builddir)/documentation/man\$(api_manext) -R\$(top_builddir) -C\$(srcdir) \$(PARENTSRC:%=-P%) -I\$(top_srcdir)/include \$(MAINSPEC:%=-w %) \$(C_SRCS)
@@ -16585,8 +16574,6 @@ xmlpages:: dummy
 
 MAKE_PROG_RULES="
 DLLFLAGS    = $DLLFLAGS
-
-all: $deps
 "
 
 
@@ -17428,7 +17415,6 @@ zh_TW"
 wine_fn_ignore_file "*.a"
 wine_fn_ignore_file "*.exe"
 test -n "$DLLEXT" && wine_fn_ignore_file "*$DLLEXT"
-test -n "$DLLEXT" && wine_fn_ignore_file "*.fake"
 wine_fn_ignore_file ".gitignore"
 wine_fn_ignore_file "Makefile"
 wine_fn_ignore_file "TAGS"
diff --git a/configure.ac b/configure.ac
index 964c068..9d9078c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2613,20 +2613,9 @@ fi
 
 dnl Dll and program rules
 
-if test -n "$DLLEXT"
-then
-    deps="\$(MODULE)$DLLEXT \$(MODULE).fake"
-else
-    deps="\$(MODULE)"
-fi
-
 AC_SUBST(MAKE_DLL_RULES,"
 DLLFLAGS    = $DLLFLAGS
 MAINSPEC    = \$(srcdir)/\$(MODULE:%.dll=%).spec
-IDL_TLB_RES = \$(IDL_TLB_SRCS:.idl=_t.res)
-MODULEFLAGS = -shared \$(MAINSPEC) \$(EXTRADLLFLAGS)
-
-all: $deps
 
 manpages:: dummy
 	\$(C2MAN) -o \$(top_builddir)/documentation/man\$(api_manext) -R\$(top_builddir) -C\$(srcdir) \$(PARENTSRC:%=-P%) -I\$(top_srcdir)/include \$(MAINSPEC:%=-w %) \$(C_SRCS)
@@ -2641,8 +2630,6 @@ xmlpages:: dummy
 
 AC_SUBST(MAKE_PROG_RULES,"
 DLLFLAGS    = $DLLFLAGS
-
-all: $deps
 ")
 
 dnl Test rules
@@ -3472,7 +3459,6 @@ dnl Main ignore file
 WINE_IGNORE_FILE("*.a")
 WINE_IGNORE_FILE("*.exe")
 test -n "$DLLEXT" && WINE_IGNORE_FILE("*$DLLEXT")
-test -n "$DLLEXT" && WINE_IGNORE_FILE("*.fake")
 WINE_IGNORE_FILE(".gitignore")
 WINE_IGNORE_FILE("Makefile")
 WINE_IGNORE_FILE("TAGS")
diff --git a/tools/makedep.c b/tools/makedep.c
index c8a3a6f..0516cbb 100644
--- a/tools/makedep.c
+++ b/tools/makedep.c
@@ -1366,6 +1366,7 @@ static struct strarray output_sources(void)
 {
     struct incl_file *source;
     int i;
+    const char *dllext = ".so";
     int is_test = find_src_file( "testlist.o" ) != NULL;
     struct strarray object_files = empty_strarray;
     struct strarray crossobj_files = empty_strarray;
@@ -1377,7 +1378,15 @@ static struct strarray output_sources(void)
     struct strarray dlldata_files = empty_strarray;
     struct strarray includes = empty_strarray;
     struct strarray subdirs = empty_strarray;
+    struct strarray all_targets = empty_strarray;
     struct strarray phony_targets = empty_strarray;
+    struct strarray imports = get_expanded_make_var_array( "IMPORTS" );
+    struct strarray delayimports = get_expanded_make_var_array( "DELAYIMPORTS" );
+    char *module = get_expanded_make_variable( "MODULE" );
+    char *exeext = get_expanded_make_variable( "EXEEXT" );
+    char *appmode = get_expanded_make_variable( "APPMODE" );
+
+    if (exeext && !strcmp( exeext, ".exe" )) dllext = "";
 
     strarray_add( &includes, "-I." );
     if (src_dir) strarray_add( &includes, strmake( "-I%s", src_dir ));
@@ -1642,6 +1651,52 @@ static struct strarray output_sources(void)
         output( "\n" );
     }
 
+    if (module)
+    {
+        struct strarray all_libs = empty_strarray;
+        char *spec_file = appmode ? NULL : replace_extension( module, ".dll", ".spec" );
+
+        if (spec_file && src_dir) spec_file = strmake( "%s/%s", src_dir, spec_file );
+        for (i = 0; i < delayimports.count; i++)
+            strarray_add( &all_libs, strmake( "-l%s", delayimports.str[i] ));
+        for (i = 0; i < imports.count; i++)
+            strarray_add( &all_libs, strmake( "-l%s", imports.str[i] ));
+        for (i = 0; i < delayimports.count; i++)
+            strarray_add( &all_libs, strmake( "-Wb,-d%s", delayimports.str[i] ));
+        strarray_add( &all_libs, "-lwine" );
+        strarray_addall( &all_libs, get_expanded_make_var_array( "LIBPORT" ));
+        strarray_addall( &all_libs, get_expanded_make_var_array( "EXTRALIBS" ));
+        strarray_addall( &all_libs, get_expanded_make_var_array( "LIBS" ));
+
+        if (*dllext)
+        {
+            strarray_add( &all_targets, strmake( "%s%s", module, dllext ));
+            strarray_add( &all_targets, strmake( "%s.fake", module ));
+            output( "%s%s %s.fake:", module, dllext, module );
+        }
+        else
+        {
+            strarray_add( &all_targets, module );
+            output( "%s:", module );
+        }
+        if (spec_file) output_filename( spec_file );
+        output_filenames( object_files );
+        output_filenames( res_files );
+        output( "\n" );
+        output( "\t$(WINEGCC) -o $@" );
+        if (spec_file)
+        {
+            output( " -shared %s", spec_file );
+            output_filenames( get_expanded_make_var_array( "EXTRADLLFLAGS" ));
+        }
+        else output_filename( appmode );
+        output_filenames( object_files );
+        output_filenames( res_files );
+        output_filenames( all_libs );
+        output_filename( "$(LDFLAGS)" );
+        output( "\n" );
+    }
+
     if (is_test)
     {
         struct strarray ok_files = strarray_replace_extension( &test_files, ".c", ".ok" );
@@ -1662,9 +1717,17 @@ static struct strarray output_sources(void)
         strarray_add( &phony_targets, "testclean" );
     }
 
+    if (all_targets.count)
+    {
+        output( "all:" );
+        output_filenames( all_targets );
+        output( "\n" );
+    }
+
     strarray_addall( &clean_files, object_files );
     strarray_addall( &clean_files, crossobj_files );
     strarray_addall( &clean_files, res_files );
+    strarray_addall( &clean_files, all_targets );
 
     if (clean_files.count)
     {
@@ -1780,7 +1843,7 @@ static void output_dependencies( const char *path )
         }
         if (fclose( output_file )) fatal_perror( "write" );
         output_file = tmp_file;
-        if (!found && !list_empty(&sources)) output( "\n%s\n", Separator );
+        if (!found) output( "\n%s\n", Separator );
     }
     else
     {
@@ -1788,7 +1851,7 @@ static void output_dependencies( const char *path )
             fatal_perror( "%s", path );
     }
 
-    if (!list_empty( &sources )) targets = output_sources();
+    targets = output_sources();
 
     fclose( output_file );
     output_file = NULL;




More information about the wine-cvs mailing list