Alexandre Julliard : makefiles: Add support for .x template files.

Alexandre Julliard julliard at winehq.org
Thu May 5 12:08:08 CDT 2011


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Thu May  5 15:02:25 2011 +0200

makefiles: Add support for .x template files.

---

 Make.rules.in        |    2 +-
 include/Makefile.in  |    5 +++--
 tools/make_makefiles |    4 ++++
 tools/makedep.c      |   27 +++++++++++++++++++++++++--
 4 files changed, 33 insertions(+), 5 deletions(-)

diff --git a/Make.rules.in b/Make.rules.in
index cd9c22e..bd2013c 100644
--- a/Make.rules.in
+++ b/Make.rules.in
@@ -27,7 +27,7 @@ IDL_GEN_HEADERS = $(IDL_H_SRCS:.idl=.h) $(IDL_C_SRCS:.idl=.h) $(IDL_I_SRCS:.idl=
 CLEAN_FILES   = *.o *.a *.so *.ln *.res *.fake *.$(LIBEXT) \\\#*\\\# *~ *% .\\\#* *.bak *.orig *.rej *.flc core
 CLEAN_TARGETS = $(IDL_GEN_C_SRCS) $(IDL_GEN_HEADERS) $(IDL_TLB_SRCS:.idl=.tlb) $(IDL_P_SRCS:%=dlldata.c) \
                 $(BISON_SRCS:.y=.tab.c) $(BISON_SRCS:.y=.tab.h) $(LEX_SRCS:.l=.yy.c) \
-                $(PO_SRCS:%=rsrc.pot) $(MC_SRCS:%=msg.pot)
+                $(PO_SRCS:%=rsrc.pot) $(MC_SRCS:%=msg.pot) $(XTEMPLATE_SRCS:.x=.h)
 
 OBJS = $(C_SRCS:.c=.o) $(BISON_SRCS:.y=.tab.o) $(LEX_SRCS:.l=.yy.o) $(IDL_GEN_C_SRCS:.c=.o) \
        $(IDL_R_SRCS:.idl=_r.res) $(RC_SRCS:.rc=.res) $(MC_SRCS:.mc=.res) $(EXTRA_OBJS)
diff --git a/include/Makefile.in b/include/Makefile.in
index 1155d30..0bd54f7 100644
--- a/include/Makefile.in
+++ b/include/Makefile.in
@@ -110,6 +110,7 @@ IDL_TLB_SRCS = \
 SRCDIR_INCLUDES = \
 	$(IDL_TLB_SRCS) \
 	$(PUBLIC_IDL_H_SRCS) \
+	$(XTEMPLATE_SRCS) \
 	accctrl.h \
 	access.idl \
 	aclapi.h \
@@ -575,9 +576,9 @@ IDL_H_SRCS = $(PUBLIC_IDL_H_SRCS) $(PRIVATE_IDL_H_SRCS)
 
 @MAKE_RULES@
 
-OBJDIR_INCLUDES = $(PUBLIC_IDL_H_SRCS:.idl=.h)
+OBJDIR_INCLUDES = $(PUBLIC_IDL_H_SRCS:.idl=.h) $(XTEMPLATE_SRCS:.x=.h)
 
-all: $(IDL_H_SRCS:.idl=.h) $(IDL_TLB_SRCS:.idl=.tlb)
+all: $(IDL_H_SRCS:.idl=.h) $(IDL_TLB_SRCS:.idl=.tlb) $(XTEMPLATE_SRCS:.x=.h)
 
 install install-dev:: $(OBJDIR_INCLUDES) $(INSTALLDIRS)
 	for f in $(SRCDIR_INCLUDES); do case $$f in \
diff --git a/tools/make_makefiles b/tools/make_makefiles
index 182aef5..b512d62 100755
--- a/tools/make_makefiles
+++ b/tools/make_makefiles
@@ -122,6 +122,7 @@ my @ignore_srcs = (
     [ 'IDL_S_SRCS',   '\.idl', '_s.c' ],
     [ 'PUBLIC_IDL_H_SRCS',  '\.idl', '.h' ],
     [ 'PRIVATE_IDL_H_SRCS', '\.idl', '.h' ],
+    [ 'XTEMPLATE_SRCS',     '\.x',   '.h' ],
 );
 
 my %exported_wine_headers = (
@@ -362,6 +363,7 @@ sub assign_sources_to_makefiles(@)
             if ($name =~ /stdole2\.idl$/) { push @{${$make}{"=IDL_TLB_SRCS"}}, $name; }
             elsif ($private_idl_headers{$name}) { push @{${$make}{"=SRCDIR_INCLUDES"}}, $name; }
             elsif ($name =~ /\.h$/) { push @{${$make}{"=SRCDIR_INCLUDES"}}, $name; }
+            elsif ($name =~ /\.x$/) { push @{${$make}{"=XTEMPLATE_SRCS"}}, $name; }
             elsif ($name =~ /\.rh$/) { push @{${$make}{"=SRCDIR_INCLUDES"}}, $name; }
             elsif ($name =~ /\.inl$/) { push @{${$make}{"=SRCDIR_INCLUDES"}}, $name; }
             elsif ($name =~ /\.idl$/) { push @{${$make}{"=PUBLIC_IDL_H_SRCS"}}, $name; }
@@ -386,6 +388,7 @@ sub assign_sources_to_makefiles(@)
 
     # add extra variables to include source list
     my $make = $makefiles{"include/Makefile"};
+    unshift @{${$make}{"=SRCDIR_INCLUDES"}}, "\$(XTEMPLATE_SRCS)";
     unshift @{${$make}{"=SRCDIR_INCLUDES"}}, "\$(PUBLIC_IDL_H_SRCS)";
     unshift @{${$make}{"=SRCDIR_INCLUDES"}}, "\$(IDL_TLB_SRCS)";
 }
@@ -492,6 +495,7 @@ sub update_makefiles(@)
         replace_makefile_variable( $file, "PRIVATE_IDL_H_SRCS" );
         replace_makefile_variable( $file, "PUBLIC_IDL_H_SRCS" );
         replace_makefile_variable( $file, "IDL_TLB_SRCS" );
+        replace_makefile_variable( $file, "XTEMPLATE_SRCS" );
         replace_makefile_variable( $file, "SRCDIR_INCLUDES" );
         replace_makefile_variable( $file, "EXTRASUBDIRS" );
     }
diff --git a/tools/makedep.c b/tools/makedep.c
index f1b0a12..7818a2e 100644
--- a/tools/makedep.c
+++ b/tools/makedep.c
@@ -471,6 +471,28 @@ static FILE *open_include_file( INCL_FILE *pFile )
         free( filename );
     }
 
+    /* check for corresponding .x file in global includes */
+
+    if (strendswith( pFile->name, "tmpl.h" ))
+    {
+        if (top_src_dir)
+            filename = strmake( "%s/include/%.*s.x",
+                                top_src_dir, strlen(pFile->name) - 2, pFile->name );
+        else if (top_obj_dir)
+            filename = strmake( "%s/include/%.*s.x",
+                                top_obj_dir, strlen(pFile->name) - 2, pFile->name );
+        else
+            filename = NULL;
+
+        if (filename && (file = fopen( filename, "r" )))
+        {
+            pFile->sourcename = filename;
+            pFile->filename = strmake( "%s/include/%s", top_obj_dir, pFile->name );
+            return file;
+        }
+        free( filename );
+    }
+
     /* now try in global includes */
     if (top_obj_dir)
     {
@@ -761,9 +783,10 @@ static void parse_file( INCL_FILE *pFile, int src )
         return;
     }
 
-    /* don't try to open .tlb or .res files */
+    /* don't try to open certain types of files */
     if (strendswith( pFile->name, ".tlb" ) ||
-        strendswith( pFile->name, ".res" ))
+        strendswith( pFile->name, ".res" ) ||
+        strendswith( pFile->name, ".x" ))
     {
         pFile->filename = xstrdup( pFile->name );
         return;




More information about the wine-cvs mailing list