cedric pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=70df9f48bae3a55ab9bd0e9ca555f6cfb8b2da4c

commit 70df9f48bae3a55ab9bd0e9ca555f6cfb8b2da4c
Author: Dinesh Dwivedi <[email protected]>
Date:   Tue Mar 31 17:40:30 2015 +0200

    edje: add option to dump gnu style include dependencies in edje_cc.
    
    Summary:
    We were facing one problem in tizen sdk's build system as it does not 
trigger build for edc file
    if only sub-edc files are changed. During analysis, we found that there is 
no option in edje_cc
    for dumping include dependencies which other compiler (clang/ gcc etc) does 
have. We can do other
    hack to solve this problem but it will be great if edje_cc can emit gnu 
style include dependency
    target.
    
    This patch will add support to generate gnu format include dependency file 
while compiling edc file.
    similar to what gcc generates with option '-MMD -MF=<dep_file> 
-MT<dep_file>'
    https://gcc.gnu.org/onlinedocs/gcc-4.9.2/gcc/Preprocessor-Options.html
    
    Test Plan: no failure in existing test
    
    Reviewers: raster, cedric
    
    Reviewed By: cedric
    
    Projects: #efl
    
    Differential Revision: https://phab.enlightenment.org/D2263
    
    Signed-off-by: Cedric BAIL <[email protected]>
---
 src/bin/edje/edje_cc.c       |  8 ++++++++
 src/bin/edje/edje_cc.h       |  1 +
 src/bin/edje/edje_cc_parse.c |  8 +++++++-
 src/bin/edje/epp/cpplib.c    | 17 +++++++++++++----
 4 files changed, 29 insertions(+), 5 deletions(-)

diff --git a/src/bin/edje/edje_cc.c b/src/bin/edje/edje_cc.c
index df58b6e..87e69a5 100644
--- a/src/bin/edje/edje_cc.c
+++ b/src/bin/edje/edje_cc.c
@@ -22,6 +22,7 @@ char      *file_in = NULL;
 char      *tmp_dir = NULL;
 char      *file_out = NULL;
 char      *watchfile = NULL;
+char      *depfile = NULL;
 char      *authors = NULL;
 char      *license = NULL;
 Eina_List *licenses = NULL;
@@ -91,6 +92,7 @@ main_help(void)
       "\n"
       "-w files.txt             Dump all sources files path into files.txt\n"
       "-anotate                 Anotate the dumped files.\n"
+      "-deps files.txt          Dump gnu style include dependencies path into 
files.txt\n"
       "-id image/directory      Add a directory to look in for relative path 
images\n"
       "-fd font/directory       Add a directory to look in for relative path 
fonts\n"
       "-sd sound/directory      Add a directory to look in for relative path 
sounds samples\n"
@@ -281,6 +283,12 @@ main(int argc, char **argv)
          {
              anotate = 1;
           }
+       else if ((!strcmp(argv[i], "-deps")) && (i < (argc - 1)))
+         {
+            i++;
+            depfile = argv[i];
+            unlink(depfile);
+         }
        else if (!file_in)
          file_in = argv[i];
        else if (!file_out)
diff --git a/src/bin/edje/edje_cc.h b/src/bin/edje/edje_cc.h
index d5ee9aa..a54341f 100644
--- a/src/bin/edje/edje_cc.h
+++ b/src/bin/edje/edje_cc.h
@@ -258,6 +258,7 @@ extern Eina_List             *data_dirs;
 extern char                  *file_in;
 extern char                  *file_out;
 extern char                  *watchfile;
+extern char                  *depfile;
 extern char                  *license;
 extern char                  *authors;
 extern Eina_List             *licenses;
diff --git a/src/bin/edje/edje_cc_parse.c b/src/bin/edje/edje_cc_parse.c
index ef35ef2..bfe80d2 100644
--- a/src/bin/edje/edje_cc_parse.c
+++ b/src/bin/edje/edje_cc_parse.c
@@ -972,7 +972,13 @@ compile(void)
                    eina_prefix_lib_get(pfx));
         if (ecore_file_exists(buf2))
           {
-             if (anotate)
+             if (depfile)
+               snprintf(buf, sizeof(buf), "%s -MMD %s -MT %s %s -I%s %s -o %s"
+                        " -DEFL_VERSION_MAJOR=%d -DEFL_VERSION_MINOR=%d",
+                        buf2, depfile, file_out, file_in,
+                        inc, def, clean_file,
+                        EINA_VERSION_MAJOR, EINA_VERSION_MINOR);
+             else if (anotate)
                snprintf(buf, sizeof(buf), "%s -anotate -a %s %s -I%s %s -o %s"
                         " -DEFL_VERSION_MAJOR=%d -DEFL_VERSION_MINOR=%d",
                         buf2, watchfile ? watchfile : "/dev/null", file_in,
diff --git a/src/bin/edje/epp/cpplib.c b/src/bin/edje/epp/cpplib.c
index af6dbfb..22a4c7a 100644
--- a/src/bin/edje/epp/cpplib.c
+++ b/src/bin/edje/epp/cpplib.c
@@ -6502,10 +6502,10 @@ cpp_handle_options(cpp_reader * pfile, int argc, char 
**argv)
                  /* The style of the choices here is a bit mixed.
                   * The chosen scheme is a hybrid of keeping all options in 
one string
                   * and specifying each option in a separate argument:
-                  * -M|-MM|-MD file|-MMD file [-MG].  An alternative is:
-                  * -M|-MM|-MD file|-MMD file|-MG|-MMG; or more concisely:
-                  * -M[M][G][D file].  This is awkward to handle in specs, and 
is not
-                  * as extensible.  */
+                  * -M|-MM|-MT file|-MD file|-MMD file [-MG].  An alternative 
is:
+                  * -M|-MM|-MT file|-MD file|-MMD file|-MG|-MMG; or more 
concisely:
+                  * -M[M][G][D file][T file].  This is awkward to handle in 
specs, and is
+                  * not as extensible.  */
                  /* ??? -MG must be specified in addition to one of -M or -MM.
                   * This can be relaxed in the future without breaking 
anything.
                   * The converse isn't true.  */
@@ -6532,6 +6532,15 @@ cpp_handle_options(cpp_reader * pfile, int argc, char 
**argv)
                                    argv[i]);
                       opts->deps_file = argv[++i];
                    }
+                 /* For MT option, use file named by next arg as Target-name 
to write
+                  * with the dependency information.  */
+                 else if (!strcmp(argv[i], "-MT"))
+                   {
+                      if (i + 1 == argc)
+                         cpp_fatal("Filename missing after %s option",
+                                   argv[i]);
+                      opts->deps_target = argv[++i];
+                   }
                  else
                    {
                       /* For -M and -MM, write deps on standard output

-- 


Reply via email to