Alexandre Julliard : makedep: Add support for magic comments in . rc files so we can generate proper dependencies for them.

Alexandre Julliard julliard at wine.codeweavers.com
Wed Dec 27 10:37:33 CST 2006


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Tue Dec 26 15:02:03 2006 +0100

makedep: Add support for magic comments in .rc files so we can generate proper dependencies for them.

---

 dlls/atl/Makefile.in    |    2 -
 dlls/atl/rsrc.rc        |    1 +
 dlls/itss/Makefile.in   |    2 -
 dlls/itss/rsrc.rc       |    1 +
 dlls/mshtml/Makefile.in |    2 -
 dlls/mshtml/rsrc.rc     |    2 +
 dlls/urlmon/Makefile.in |    2 -
 dlls/urlmon/rsrc.rc     |    1 +
 tools/makedep.c         |   64 ++++++++++++++++++++++++++++++++++++++++++++++-
 9 files changed, 68 insertions(+), 9 deletions(-)

diff --git a/dlls/atl/Makefile.in b/dlls/atl/Makefile.in
index 4331990..d419a5d 100644
--- a/dlls/atl/Makefile.in
+++ b/dlls/atl/Makefile.in
@@ -19,6 +19,4 @@ IDL_H_SRCS = \
 
 @MAKE_DLL_RULES@
 
-rsrc.res: atl.rgs
-
 @DEPENDENCIES@  # everything below this line is overwritten by make depend
diff --git a/dlls/atl/rsrc.rc b/dlls/atl/rsrc.rc
index 59cfb60..c559533 100644
--- a/dlls/atl/rsrc.rc
+++ b/dlls/atl/rsrc.rc
@@ -16,4 +16,5 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
+/* @makedep: atl.rgs */
 101 REGISTRY atl.rgs
diff --git a/dlls/itss/Makefile.in b/dlls/itss/Makefile.in
index 612e419..ccde6c2 100644
--- a/dlls/itss/Makefile.in
+++ b/dlls/itss/Makefile.in
@@ -19,6 +19,4 @@ RC_SRCS = rsrc.rc
 
 @MAKE_DLL_RULES@
 
-rsrc.res: itss.inf
-
 @DEPENDENCIES@  # everything below this line is overwritten by make depend
diff --git a/dlls/itss/rsrc.rc b/dlls/itss/rsrc.rc
index b9f961d..2b0edd8 100644
--- a/dlls/itss/rsrc.rc
+++ b/dlls/itss/rsrc.rc
@@ -16,4 +16,5 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
+/* @makedep: itss.inf */
 REGINST REGINST itss.inf
diff --git a/dlls/mshtml/Makefile.in b/dlls/mshtml/Makefile.in
index 0e8f988..919e5d0 100644
--- a/dlls/mshtml/Makefile.in
+++ b/dlls/mshtml/Makefile.in
@@ -49,6 +49,4 @@ IDL_H_SRCS = nsiface.idl
 
 @MAKE_DLL_RULES@
 
-rsrc.res: mshtml.inf blank.htm
-
 @DEPENDENCIES@  # everything below this line is overwritten by make depend
diff --git a/dlls/mshtml/rsrc.rc b/dlls/mshtml/rsrc.rc
index 3e3daae..bbf7a81 100644
--- a/dlls/mshtml/rsrc.rc
+++ b/dlls/mshtml/rsrc.rc
@@ -48,6 +48,8 @@
 
 LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
 
+/* @makedep: mshtml.inf */
 REGINST REGINST mshtml.inf
 
+/* @makedep: blank.htm */
 blank.htm HTML "blank.htm"
diff --git a/dlls/urlmon/Makefile.in b/dlls/urlmon/Makefile.in
index a19a78a..be3b6a4 100644
--- a/dlls/urlmon/Makefile.in
+++ b/dlls/urlmon/Makefile.in
@@ -25,6 +25,4 @@ RC_SRCS = rsrc.rc
 
 @MAKE_DLL_RULES@
 
-rsrc.res: urlmon.inf
-
 @DEPENDENCIES@  # everything below this line is overwritten by make depend
diff --git a/dlls/urlmon/rsrc.rc b/dlls/urlmon/rsrc.rc
index 2fa1a30..d71b2fa 100644
--- a/dlls/urlmon/rsrc.rc
+++ b/dlls/urlmon/rsrc.rc
@@ -16,6 +16,7 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
+/* @makedep: urlmon.inf */
 REGINST REGINST urlmon.inf
 
 #include "version.rc"
diff --git a/tools/makedep.c b/tools/makedep.c
index 759d3bd..1d070b2 100644
--- a/tools/makedep.c
+++ b/tools/makedep.c
@@ -629,6 +629,63 @@ static void parse_c_file( INCL_FILE *pFi
 
 
 /*******************************************************************
+ *         parse_rc_file
+ */
+static void parse_rc_file( INCL_FILE *pFile, FILE *file )
+{
+    char *buffer, *include;
+
+    input_line = 0;
+    while ((buffer = get_line( file )))
+    {
+        char quote;
+        char *p = buffer;
+        while (*p && isspace(*p)) p++;
+
+        if (p[0] == '/' && p[1] == '*')  /* check for magic makedep comment */
+        {
+            p += 2;
+            while (*p && isspace(*p)) p++;
+            if (strncmp( p, "@makedep:", 9 )) continue;
+            p += 9;
+            while (*p && isspace(*p)) p++;
+            quote = '"';
+            if (*p == quote)
+            {
+                include = ++p;
+                while (*p && *p != quote) p++;
+            }
+            else
+            {
+                include = p;
+                while (*p && !isspace(*p) && *p != '*') p++;
+            }
+            if (!*p)
+                fatal_error( "%s:%d: Malformed makedep comment\n", pFile->filename, input_line );
+            *p = 0;
+        }
+        else  /* check for #include */
+        {
+            if (*p++ != '#') continue;
+            while (*p && isspace(*p)) p++;
+            if (strncmp( p, "include", 7 )) continue;
+            p += 7;
+            while (*p && isspace(*p)) p++;
+            if (*p != '\"' && *p != '<' ) continue;
+            quote = *p++;
+            if (quote == '<') quote = '>';
+            include = p;
+            while (*p && (*p != quote)) p++;
+            if (!*p) fatal_error( "%s:%d: Malformed #include directive\n",
+                                  pFile->filename, input_line );
+            *p = 0;
+        }
+        add_include( pFile, include, input_line, (quote == '>') );
+    }
+}
+
+
+/*******************************************************************
  *         parse_generated_idl
  */
 static void parse_generated_idl( INCL_FILE *source )
@@ -688,8 +745,13 @@ static void parse_file( INCL_FILE *pFile
         parse_idl_file( pFile, file, 1 );
     else if (strendswith( pFile->filename, ".idl" ))
         parse_idl_file( pFile, file, 0 );
-    else
+    else if (strendswith( pFile->filename, ".c" ) ||
+             strendswith( pFile->filename, ".h" ) ||
+             strendswith( pFile->filename, ".l" ) ||
+             strendswith( pFile->filename, ".y" ))
         parse_c_file( pFile, file );
+    else if (strendswith( pFile->filename, ".rc" ))
+        parse_rc_file( pFile, file );
     fclose(file);
 }
 




More information about the wine-cvs mailing list