summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@osg.samsung.com>2017-11-14 13:42:38 +0100
committerDaniel Kolesa <d.kolesa@osg.samsung.com>2017-11-14 13:47:09 +0100
commit2f81b2636775ce5fdd0cf9d76595e751da3930d9 (patch)
tree8e21d03f0741fcd56f8db0471a689537e1fe21bd
parent7e83545ab331e993b8f73c287a3a39f57dd1fe59 (diff)
eolian: scan system dir by default
The '-S' option lets you reverse that. But by default, most people will want the prefix to be scanned for eo files.
-rw-r--r--pc/eo.pc.in2
-rw-r--r--src/Makefile.am1
-rw-r--r--src/Makefile_Eolian_Files_Helper.am8
-rw-r--r--src/bin/eolian/main.c46
-rw-r--r--src/examples/eolian_cxx/Makefile.am4
-rw-r--r--src/tests/eolian/eolian_generation.c2
6 files changed, 45 insertions, 18 deletions
diff --git a/pc/eo.pc.in b/pc/eo.pc.in
index 998bf23..2547193 100644
--- a/pc/eo.pc.in
+++ b/pc/eo.pc.in
@@ -5,7 +5,7 @@ includedir=@includedir@
5datarootdir=@datarootdir@ 5datarootdir=@datarootdir@
6datadir=@datadir@ 6datadir=@datadir@
7eoincludedir=@datadir@/eolian/include 7eoincludedir=@datadir@/eolian/include
8eolian_flags=-I${pc_sysrootdir}${eoincludedir}/eo-@VMAJ@ 8eolian_flags=-S -I${pc_sysrootdir}${eoincludedir}/eo-@VMAJ@
9 9
10Name: Eo 10Name: Eo
11Description: EFL's generic object system library. 11Description: EFL's generic object system library.
diff --git a/src/Makefile.am b/src/Makefile.am
index c696978..2651fd8 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -4,6 +4,7 @@ CLEANFILES =
4BUILT_SOURCES = 4BUILT_SOURCES =
5 5
6EOLIAN_FLAGS = -I$(srcdir) 6EOLIAN_FLAGS = -I$(srcdir)
7EOLIAN_GEN_FLAGS = -S
7 8
8DIST_SUBDIRS = 9DIST_SUBDIRS =
9SUBDIRS = 10SUBDIRS =
diff --git a/src/Makefile_Eolian_Files_Helper.am b/src/Makefile_Eolian_Files_Helper.am
index bf14567..463433c 100644
--- a/src/Makefile_Eolian_Files_Helper.am
+++ b/src/Makefile_Eolian_Files_Helper.am
@@ -8,19 +8,19 @@ SUFFIXES = .eo .eo.c .eo.h .eo.legacy.h .eot .eot.h
8%.eo.c: %.eo ${_EOLIAN_GEN_DEP} 8%.eo.c: %.eo ${_EOLIAN_GEN_DEP}
9 $(AM_V_EOL) \ 9 $(AM_V_EOL) \
10 $(MKDIR_P) $(dir $@); \ 10 $(MKDIR_P) $(dir $@); \
11 $(EOLIAN_GEN) $(EOLIAN_FLAGS) -gc -o c:$@ $< 11 $(EOLIAN_GEN) $(EOLIAN_FLAGS) $(EOLIAN_GEN_FLAGS) -gc -o c:$@ $<
12 12
13%.eo.h: %.eo ${_EOLIAN_GEN_DEP} 13%.eo.h: %.eo ${_EOLIAN_GEN_DEP}
14 $(AM_V_EOL) \ 14 $(AM_V_EOL) \
15 $(MKDIR_P) $(dir $@); \ 15 $(MKDIR_P) $(dir $@); \
16 $(EOLIAN_GEN) $(EOLIAN_FLAGS) -gh -o h:$@ $< 16 $(EOLIAN_GEN) $(EOLIAN_FLAGS) $(EOLIAN_GEN_FLAGS) -gh -o h:$@ $<
17 17
18%.eot.h: %.eot ${_EOLIAN_GEN_DEP} 18%.eot.h: %.eot ${_EOLIAN_GEN_DEP}
19 $(AM_V_EOL) \ 19 $(AM_V_EOL) \
20 $(MKDIR_P) $(dir $@); \ 20 $(MKDIR_P) $(dir $@); \
21 $(EOLIAN_GEN) $(EOLIAN_FLAGS) -gh -o h:$@ $< 21 $(EOLIAN_GEN) $(EOLIAN_FLAGS) $(EOLIAN_GEN_FLAGS) -gh -o h:$@ $<
22 22
23%.eo.legacy.h: %.eo ${_EOLIAN_GEN_DEP} 23%.eo.legacy.h: %.eo ${_EOLIAN_GEN_DEP}
24 $(AM_V_EOL) \ 24 $(AM_V_EOL) \
25 $(MKDIR_P) $(dir $@); \ 25 $(MKDIR_P) $(dir $@); \
26 $(EOLIAN_GEN) $(EOLIAN_FLAGS) -gl -o l:$@ $< 26 $(EOLIAN_GEN) $(EOLIAN_FLAGS) $(EOLIAN_GEN_FLAGS) -gl -o l:$@ $<
diff --git a/src/bin/eolian/main.c b/src/bin/eolian/main.c
index 65ee41c..fdb5ca2 100644
--- a/src/bin/eolian/main.c
+++ b/src/bin/eolian/main.c
@@ -37,6 +37,7 @@ _print_usage(const char *progn, FILE *outf)
37 fprintf(outf, "Usage: %s [options] [input]\n", progn); 37 fprintf(outf, "Usage: %s [options] [input]\n", progn);
38 fprintf(outf, "Options:\n" 38 fprintf(outf, "Options:\n"
39 " -I inc include path \"inc\"\n" 39 " -I inc include path \"inc\"\n"
40 " -S do not scan system dir for eo files\n"
40 " -g type generate file of type \"type\"\n" 41 " -g type generate file of type \"type\"\n"
41 " -o name specify the base name for output\n" 42 " -o name specify the base name for output\n"
42 " -o type:name specify a particular output filename\n" 43 " -o type:name specify a particular output filename\n"
@@ -50,7 +51,9 @@ _print_usage(const char *progn, FILE *outf)
50 " c: C source file (.eo.c)\n" 51 " c: C source file (.eo.c)\n"
51 " i: Implementation file (.c, merged with existing)\n" 52 " i: Implementation file (.c, merged with existing)\n"
52 "\n" 53 "\n"
53 "By default, the 'hc' set is used ('h' for .eot files).\n" 54 "By default, the 'hc' set is used ('h' for .eot files).\n\n"
55 "The system-wide Eolian directory is scanned for eo files\n"
56 "by default, together with all specified '-I' flags.\n\n"
54 "Output filenames are determined from input .eo filename.\n" 57 "Output filenames are determined from input .eo filename.\n"
55 "Default output path is where the input file is.\n\n" 58 "Default output path is where the input file is.\n\n"
56 "Also, specifying a type-dependent input file automatically\n" 59 "Also, specifying a type-dependent input file automatically\n"
@@ -420,6 +423,10 @@ main(int argc, char **argv)
420{ 423{
421 int pret = 1; 424 int pret = 1;
422 425
426 char *outs[5] = { NULL, NULL, NULL, NULL, NULL };
427 char *basen = NULL;
428 Eina_List *includes = NULL;
429
423 eina_init(); 430 eina_init();
424 eolian_init(); 431 eolian_init();
425 432
@@ -433,21 +440,20 @@ main(int argc, char **argv)
433 440
434 eina_log_timing(_eolian_gen_log_dom, EINA_LOG_STATE_STOP, EINA_LOG_STATE_INIT); 441 eina_log_timing(_eolian_gen_log_dom, EINA_LOG_STATE_STOP, EINA_LOG_STATE_INIT);
435 442
436 char *outs[5] = { NULL, NULL, NULL, NULL, NULL };
437 char *basen = NULL;
438
439 int gen_what = 0; 443 int gen_what = 0;
440 for (int opt; (opt = getopt(argc, argv, "I:g:o:hv")) != -1;) 444 Eina_Bool scan_system = EINA_TRUE;
445
446 for (int opt; (opt = getopt(argc, argv, "SI:g:o:hv")) != -1;)
441 switch (opt) 447 switch (opt)
442 { 448 {
443 case 0: 449 case 0:
444 break; 450 break;
451 case 'S':
452 scan_system = EINA_FALSE;
453 break;
445 case 'I': 454 case 'I':
446 if (!eolian_directory_scan(optarg)) 455 /* just a pointer to argv contents, so it persists */
447 { 456 includes = eina_list_append(includes, optarg);
448 fprintf(stderr, "eolian: could not scan '%s'\n", optarg);
449 goto end;
450 }
451 break; 457 break;
452 case 'g': 458 case 'g':
453 for (const char *wstr = optarg; *wstr; ++wstr) 459 for (const char *wstr = optarg; *wstr; ++wstr)
@@ -522,6 +528,25 @@ main(int argc, char **argv)
522 goto end; 528 goto end;
523 } 529 }
524 530
531 if (scan_system)
532 {
533 if (!eolian_system_directory_scan())
534 {
535 fprintf(stderr, "eolian: could not scan system directory\n");
536 goto end;
537 }
538 }
539
540 const char *inc;
541 EINA_LIST_FREE(includes, inc)
542 {
543 if (!eolian_directory_scan(inc))
544 {
545 fprintf(stderr, "eolian: could not scan '%s'\n", inc);
546 goto end;
547 }
548 }
549
525 const Eolian_Unit *src = eolian_file_parse(input); 550 const Eolian_Unit *src = eolian_file_parse(input);
526 if (!src) 551 if (!src)
527 { 552 {
@@ -559,6 +584,7 @@ end:
559 eina_log_domain_unregister(_eolian_gen_log_dom); 584 eina_log_domain_unregister(_eolian_gen_log_dom);
560 } 585 }
561 586
587 eina_list_free(includes);
562 for (size_t i = 0; i < (sizeof(_dexts) / sizeof(char *)); ++i) 588 for (size_t i = 0; i < (sizeof(_dexts) / sizeof(char *)); ++i)
563 free(outs[i]); 589 free(outs[i]);
564 free(basen); 590 free(basen);
diff --git a/src/examples/eolian_cxx/Makefile.am b/src/examples/eolian_cxx/Makefile.am
index ece5318..df5a370 100644
--- a/src/examples/eolian_cxx/Makefile.am
+++ b/src/examples/eolian_cxx/Makefile.am
@@ -138,10 +138,10 @@ eolian_cxx_callbacks_01_SOURCES = eolian_cxx_callbacks_01.cc
138 true $< 138 true $<
139 139
140%.eo.c: %.eo 140%.eo.c: %.eo
141 $(AM_V_EOL)$(EOLIAN_GEN) $(EOLIAN_FLAGS) -gc -o c:$@ $< 141 $(AM_V_EOL)$(EOLIAN_GEN) $(EOLIAN_FLAGS) $(EOLIAN_GEN_FLAGS) -gc -o c:$@ $<
142 142
143%.eo.h: %.eo 143%.eo.h: %.eo
144 $(AM_V_EOL)$(EOLIAN_GEN) $(EOLIAN_FLAGS) -gh -o h:$@ $< 144 $(AM_V_EOL)$(EOLIAN_GEN) $(EOLIAN_FLAGS) $(EOLIAN_GEN_FLAGS) -gh -o h:$@ $<
145 145
146examples: $(ECXX_EXAMPLE_EOS) $(GENERATED) $(EXTRA_PROGRAMS) 146examples: $(ECXX_EXAMPLE_EOS) $(GENERATED) $(EXTRA_PROGRAMS)
147 147
diff --git a/src/tests/eolian/eolian_generation.c b/src/tests/eolian/eolian_generation.c
index c339b29..eb9f7d3 100644
--- a/src/tests/eolian/eolian_generation.c
+++ b/src/tests/eolian/eolian_generation.c
@@ -85,7 +85,7 @@ _eolian_gen_execute(const char *eo_filename, const char *options, const char *ou
85{ 85{
86 char command[PATH_MAX]; 86 char command[PATH_MAX];
87 snprintf(command, PATH_MAX, 87 snprintf(command, PATH_MAX,
88 EOLIAN_GEN" %s -I \""PACKAGE_DATA_DIR"/data\" -o %s %s", 88 EOLIAN_GEN" %s -S -I \""PACKAGE_DATA_DIR"/data\" -o %s %s",
89 options, output_filename, eo_filename); 89 options, output_filename, eo_filename);
90 return system(command); 90 return system(command);
91} 91}