[libgda/wip/meson] meson: sql-parsing making lemon disabling out files



commit ae0b99c19df80a1b8a4c40a7376f043a7840fd92
Author: Daniel Espinosa <esodan gmail com>
Date:   Thu Jun 14 14:39:20 2018 -0500

    meson: sql-parsing making lemon disabling out files

 libgda/sql-parser/lemon.c     | 16 ++++++++++++----
 libgda/sql-parser/meson.build | 14 +++++++++-----
 libgda/sqlite/Makefile.am     |  6 +++---
 meson.build                   | 30 ------------------------------
 4 files changed, 24 insertions(+), 42 deletions(-)
---
diff --git a/libgda/sql-parser/lemon.c b/libgda/sql-parser/lemon.c
index afab40fd8..776c4618e 100644
--- a/libgda/sql-parser/lemon.c
+++ b/libgda/sql-parser/lemon.c
@@ -1395,6 +1395,8 @@ static void handle_T_option(char *z){
 }
 
 int local_out_dir = 0;
+int disable_header = 0;
+int disable_c = 0;
 
 /* The main program.  Parse the command line and do it... */
 int main(int argc, char **argv)
@@ -1424,6 +1426,8 @@ int main(int argc, char **argv)
     {OPT_FLAG, "s", (char*)&statistics,
                                    "Print parser stats to standard output."},
     {OPT_FLAG, "x", (char*)&version, "Print the version number."},
+    {OPT_FLAG, "h", (char*)&disable_header, "Disable header file generation"},
+    {OPT_FLAG, "z", (char*)&disable_c, "Disable C source code file generation"},
     {OPT_FLAG,0,0,0}
   };
   int i;
@@ -1514,13 +1518,17 @@ int main(int argc, char **argv)
     /* Generate a report of the parser generated.  (the "y.output" file) */
     if( !quiet ) ReportOutput(&lem);
 
-    /* Generate the source code for the parser */
-    ReportTable(&lem, mhflag);
+    if (!disable_c) {
+      /* Generate the source code for the parser */
+      ReportTable(&lem, mhflag);
+    }
 
     /* Produce a header file for use by the scanner.  (This step is
     ** omitted if the "-m" option is used because makeheaders will
     ** generate the file for us.) */
-    if( !mhflag ) ReportHeader(&lem);
+    if( !mhflag && !disable_header) {
+      ReportHeader(&lem);
+    }
   }
   if( statistics ){
     printf("Parser statistics: %d terminals, %d nonterminals, %d rules\n",
@@ -3627,6 +3635,7 @@ void ReportTable(
 
   in = tplt_open(lemp);
   if( in==0 ) return;
+
   out = file_open(lemp,".c","wb");
   if( out==0 ){
     fclose(in);
@@ -3643,7 +3652,6 @@ void ReportTable(
     free(name);
   }
   tplt_xfer(lemp->name,in,out,&lineno);
-
   /* Generate #defines for all tokens */
   if( mhflag ){
     const char *prefix;
diff --git a/libgda/sql-parser/meson.build b/libgda/sql-parser/meson.build
index a2b0c21bf..43e87fa53 100644
--- a/libgda/sql-parser/meson.build
+++ b/libgda/sql-parser/meson.build
@@ -2,7 +2,11 @@ lemonf = files([
        'lemon.c'
        ])
 
-lemon_exe = executable('lemon', lemonf, install: false)
+lemon_exe = executable('lemon',
+       lemonf,
+       dependencies: [gio_dep],
+       install: false
+)
 
 libgda_sql_parser_headers = [
        'gda-statement-struct-decl.h',
@@ -30,7 +34,7 @@ gendef_exe = executable('gen_def', 'gen_def.c',
        )
 
 lemon_parserc = custom_target('lemon-parser_c',
-       command : [lemon_exe, '-o'+meson.current_build_dir(),
+       command : [lemon_exe, '-d', '-h',
        '-T'+'@INPUT0@', '@INPUT1@'],
        input : ['lempar.c', 'parser.y'],
        output : ['parser.c'],
@@ -39,7 +43,7 @@ lemon_parserc = custom_target('lemon-parser_c',
 
 
 lemon_parserh = custom_target('lemon-parser_h',
-       command : [lemon_exe, '-o'+meson.current_build_dir(), '-h',
+       command : [lemon_exe, '-d', '-z',
        '-T'+'@INPUT0@', '@INPUT1@'],
        input : ['lempar.c', 'parser.y'],
        output : ['parser.h'],
@@ -47,7 +51,7 @@ lemon_parserh = custom_target('lemon-parser_h',
        )
 
 lemon_delimiterc = custom_target('lemon-delimiter_c',
-       command : [lemon_exe, '-q',
+       command : [lemon_exe, '-q', '-d', '-h',
        '-T'+'@INPUT0@', '@INPUT1@'],
        input : ['lempar.c', 'delimiter.y'],
        output : ['delimiter.c'],
@@ -55,7 +59,7 @@ lemon_delimiterc = custom_target('lemon-delimiter_c',
        )
 
 lemon_delimiterh = custom_target('lemon-delimiter_h',
-       command : [lemon_exe, '-q',
+       command : [lemon_exe, '-q', '-d', '-z',
        '-T'+'@INPUT0@', '@INPUT1@'],
        input : ['lempar.c', 'delimiter.y'],
        output : ['delimiter.h'],
diff --git a/libgda/sqlite/Makefile.am b/libgda/sqlite/Makefile.am
index 0b4debf03..d0e9a7183 100644
--- a/libgda/sqlite/Makefile.am
+++ b/libgda/sqlite/Makefile.am
@@ -27,8 +27,8 @@ AM_CPPFLAGS = \
 mkkeywordhash$(EXEEXT_FOR_BUILD): mkkeywordhash.c
        $(CC_FOR_BUILD) -o mkkeywordhash$(EXEEXT_FOR_BUILD) $(GDA_DEBUG_FLAGS) $<
 
-keywords_hash.c: mkkeywordhash$(EXEEXT_FOR_BUILD) $(top_srcdir)/libgda/sqlite/keywords.list
-       ./mkkeywordhash$(EXEEXT_FOR_BUILD) $(top_srcdir)/libgda/sqlite/keywords.list > keywords_hash.c
+keywords_hash.code: mkkeywordhash$(EXEEXT_FOR_BUILD) $(top_srcdir)/libgda/sqlite/keywords.list
+       ./mkkeywordhash$(EXEEXT_FOR_BUILD) $(top_srcdir)/libgda/sqlite/keywords.list > keywords_hash.code
 
 gen_emb_string$(EXEEXT_FOR_BUILD): gen_emb_string.c
        $(CC_FOR_BUILD) -o gen_emb_string$(EXEEXT_FOR_BUILD) $<
@@ -61,7 +61,7 @@ sqlitesources = \
        gda-symbols-util.h \
        gda-symbols-util.c
 
-BUILT_SOURCES = xml_embedded.h keywords_hash.c
+BUILT_SOURCES = xml_embedded.h keywords_hash.code
 
 libgda_sqlite_la_SOURCES = $(sqlitesources)
 libgda_sqlite_la_CFLAGS = -DPNAME=\""SQLite"\" -DCLASS_PREFIX=\""GdaSqlite"\" 
-DSEARCH_LIB_PATH=\""$(SQLITE_PATH)"\"
diff --git a/meson.build b/meson.build
index 45476f475..6bdddbd11 100644
--- a/meson.build
+++ b/meson.build
@@ -1,13 +1,7 @@
 project('libgda', 'c',
-<<<<<<< HEAD
         license: 'LGPL2+',
         version : '5.99.0',
         meson_version: '>= 0.44.1',
-=======
-        license: 'GPL2+',
-        version : '5.99.0',
-        meson_version: '>= 0.45.0',
->>>>>>> c742f7bee7503300367f49691c2a1ded27417030
         default_options: [
                         'c_std=gnu11',
                         'warning_level=2',
@@ -16,7 +10,6 @@ project('libgda', 'c',
 
 project_version = meson.project_version()
 version_split = project_version.split('.')
-<<<<<<< HEAD
 MAJOR_VERSION = version_split[0]
 MINOR_VERSION = version_split[1]
 MICRO_VERSION = version_split[2]
@@ -25,20 +18,12 @@ project_abi_version = MAJOR_VERSION+'.'+MINOR_VERSION
 project_abi_name = '"' + meson.project_name() + '-' + project_abi_version + '"'
 project_package = meson.project_name() + '-' + project_api_version
 
-=======
-
-MAJOR_VERSION = version_split[0]
-MINOR_VERSION = version_split[1]
-MICRO_VERSION = version_split[2]
->>>>>>> c742f7bee7503300367f49691c2a1ded27417030
-
 gda_current = '5'
 gda_revision ='1'
 gda_age = '1'
 
 conf = configuration_data()
 # Surround the version in quotes to make it a C string
-<<<<<<< HEAD
 conf.set_quoted('PACKAGE_LOCALE_DIR', join_paths(get_option('prefix'), get_option('datadir'), 'locale'))
 conf.set_quoted('GETTEXT_PACKAGE', project_package)
 
@@ -46,9 +31,6 @@ conf.set_quoted('GETTEXT_PACKAGE', project_package)
 if meson.get_compiler('c').has_header('locale.h')
        conf.set ('HAVE_LOCALE_H', '1')
 endif
-=======
-conf.set_quoted('VERSION', project_version)
->>>>>>> c742f7bee7503300367f49691c2a1ded27417030
 
 glib_genmarshal = find_program('glib-genmarshal', required : true)
 if glib_genmarshal.found()
@@ -64,13 +46,8 @@ else
   error ('glib-mkenums not found')
 endif
 
-<<<<<<< HEAD
 configh = configure_file(output : 'config.h',
                        configuration : conf)
-=======
-configure_file(output : 'config.h',
-               configuration : conf)
->>>>>>> c742f7bee7503300367f49691c2a1ded27417030
 
 req_ver_glib = '>= 2.38.0'
 glib_dep = dependency('glib-2.0', version : req_ver_glib)
@@ -89,7 +66,6 @@ glade_dep = dependency('gladeui-2.0', required : false)
 libxslt_dep = dependency('libxslt')
 jsonglib_dep = dependency('json-glib-1.0',required : false)
 soup_dep = dependency('libsoup-2.4', required : false)
-<<<<<<< HEAD
 sqlite = dependency ('sqlite3', version: '>= 3.6.11')
 
 c_args = ['-Wall',
@@ -102,9 +78,6 @@ c_args = ['-Wall',
        '-Wno-missing-field-initializers',
        '-DGSEAL_ENABLE',
        '-DLIBGDA_ABI_NAME='+project_abi_name]
-=======
-c_args = ''
->>>>>>> c742f7bee7503300367f49691c2a1ded27417030
 
 glade_catalog = ''
 glade_pixmap = ''
@@ -191,14 +164,11 @@ endif
 
 add_global_arguments(c_args, language : 'c')
 
-<<<<<<< HEAD
 
 inc_rooth = include_directories ('.')
 inc_rooth_dep = declare_dependency (include_directories : inc_rooth)
 
 subdir('po')
-=======
->>>>>>> c742f7bee7503300367f49691c2a1ded27417030
 subdir('libgda')
 #subdir('libgda-ui')
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]