summaryrefslogtreecommitdiff
path: root/src/bin/eolian
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@samsung.com>2019-02-06 14:07:35 +0100
committerDaniel Kolesa <d.kolesa@samsung.com>2019-02-06 14:31:23 +0100
commit347f096bf7ff316196213b722703bfb4bbcb1366 (patch)
treea5e8c4f211a8f2a3bff9ce76df3ef4b06e4b32fc /src/bin/eolian
parent3009bee9eea4ec5f527d72bfa5fe7b67a3d04521 (diff)
eolian_gen: add support for header-only depfiles
By default, dependency files are now generated only for headers. This makes sense for the C generator and our dependency tracking needs. If full dependencies are needed, there is now the 'D' output, which has the old behavior.
Diffstat (limited to 'src/bin/eolian')
-rw-r--r--src/bin/eolian/main.c35
1 files changed, 27 insertions, 8 deletions
diff --git a/src/bin/eolian/main.c b/src/bin/eolian/main.c
index 95d81a7..7db3429 100644
--- a/src/bin/eolian/main.c
+++ b/src/bin/eolian/main.c
@@ -15,12 +15,13 @@ enum
15 GEN_H_STUB = 1 << 2, 15 GEN_H_STUB = 1 << 2,
16 GEN_C = 1 << 3, 16 GEN_C = 1 << 3,
17 GEN_C_IMPL = 1 << 4, 17 GEN_C_IMPL = 1 << 4,
18 GEN_D = 1 << 5 18 GEN_D = 1 << 5,
19 GEN_D_FULL = 1 << 6
19}; 20};
20 21
21static const char *_dexts[6] = 22static const char *_dexts[7] =
22{ 23{
23 ".h", ".legacy.h", ".stub.h", ".c", ".c", ".d" 24 ".h", ".legacy.h", ".stub.h", ".c", ".c", ".d", ".d"
24}; 25};
25 26
26static int 27static int
@@ -51,7 +52,8 @@ _print_usage(const char *progn, FILE *outf)
51 " s: Stub C header file (.eo.stub.h/.eot.stub.h)\n" 52 " s: Stub C header file (.eo.stub.h/.eot.stub.h)\n"
52 " c: C source file (.eo.c)\n" 53 " c: C source file (.eo.c)\n"
53 " i: Implementation file (.c, merged with existing)\n" 54 " i: Implementation file (.c, merged with existing)\n"
54 " d: Make-style dependencies (.d)\n" 55 " d: Make-style dependencies, only for headers (.d)\n"
56 " D: Like 'd' but for all generated files (.d)\n"
55 "\n" 57 "\n"
56 "By default, the 'hc' set is used ('h' for .eot files).\n\n" 58 "By default, the 'hc' set is used ('h' for .eot files).\n\n"
57 "The system-wide Eolian directory is scanned for eo files\n" 59 "The system-wide Eolian directory is scanned for eo files\n"
@@ -103,6 +105,11 @@ _try_set_out(char t, char **outs, const char *val, int *what)
103 case 'd': 105 case 'd':
104 pos = _get_bit_pos(GEN_D); 106 pos = _get_bit_pos(GEN_D);
105 *what |= GEN_D; 107 *what |= GEN_D;
108 break;
109 case 'D':
110 pos = _get_bit_pos(GEN_D_FULL);
111 *what |= GEN_D_FULL;
112 break;
106 } 113 }
107 if (pos < 0) 114 if (pos < 0)
108 return EINA_FALSE; 115 return EINA_FALSE;
@@ -471,8 +478,12 @@ _write_deps(const Eolian_State *eos, const char *ofname, const char *ifname,
471 _append_dep_line(buf, dbuf, outs, gen_what, GEN_H); 478 _append_dep_line(buf, dbuf, outs, gen_what, GEN_H);
472 _append_dep_line(buf, dbuf, outs, gen_what, GEN_H_LEGACY); 479 _append_dep_line(buf, dbuf, outs, gen_what, GEN_H_LEGACY);
473 _append_dep_line(buf, dbuf, outs, gen_what, GEN_H_STUB); 480 _append_dep_line(buf, dbuf, outs, gen_what, GEN_H_STUB);
474 _append_dep_line(buf, dbuf, outs, gen_what, GEN_C); 481
475 _append_dep_line(buf, dbuf, outs, gen_what, GEN_C_IMPL); 482 if (gen_what & GEN_D_FULL)
483 {
484 _append_dep_line(buf, dbuf, outs, gen_what, GEN_C);
485 _append_dep_line(buf, dbuf, outs, gen_what, GEN_C_IMPL);
486 }
476 487
477 ret = _write_file(ofname, buf); 488 ret = _write_file(ofname, buf);
478result: 489result:
@@ -486,7 +497,9 @@ main(int argc, char **argv)
486{ 497{
487 int pret = 1; 498 int pret = 1;
488 499
489 char *outs[6] = { NULL, NULL, NULL, NULL, NULL, NULL }; 500 char *outs[sizeof(_dexts) / sizeof(void *)] = {
501 NULL, NULL, NULL, NULL, NULL, NULL, NULL
502 };
490 char *basen = NULL; 503 char *basen = NULL;
491 Eina_List *includes = NULL; 504 Eina_List *includes = NULL;
492 505
@@ -542,6 +555,9 @@ main(int argc, char **argv)
542 case 'd': 555 case 'd':
543 gen_what |= GEN_D; 556 gen_what |= GEN_D;
544 break; 557 break;
558 case 'D':
559 gen_what |= GEN_D_FULL;
560 break;
545 default: 561 default:
546 fprintf(stderr, "unknown type: '%c'\n", *wstr); 562 fprintf(stderr, "unknown type: '%c'\n", *wstr);
547 goto end; 563 goto end;
@@ -639,7 +655,10 @@ main(int argc, char **argv)
639 succ = _write_source(eos, outs[_get_bit_pos(GEN_C)], eobn, !strcmp(ext, ".eot")); 655 succ = _write_source(eos, outs[_get_bit_pos(GEN_C)], eobn, !strcmp(ext, ".eot"));
640 if (succ && (gen_what & GEN_C_IMPL)) 656 if (succ && (gen_what & GEN_C_IMPL))
641 succ = _write_impl(eos, outs[_get_bit_pos(GEN_C_IMPL)], eobn); 657 succ = _write_impl(eos, outs[_get_bit_pos(GEN_C_IMPL)], eobn);
642 if (succ && (gen_what & GEN_D)) 658
659 if (succ && (gen_what & GEN_D_FULL))
660 succ = _write_deps(eos, outs[_get_bit_pos(GEN_D_FULL)], eobn, outs, gen_what);
661 else if (succ && (gen_what & GEN_D))
643 succ = _write_deps(eos, outs[_get_bit_pos(GEN_D)], eobn, outs, gen_what); 662 succ = _write_deps(eos, outs[_get_bit_pos(GEN_D)], eobn, outs, gen_what);
644 663
645 if (!succ) 664 if (!succ)