{
  'includes': [ 'common-sqlite.gypi' ],
  'target_defaults': {
    'default_configuration': 'Debug',
    'configurations': {
      'Debug': {
        'defines': [ 'DEBUG', '_DEBUG' ],
        'msvs_settings': {
          'VCCLCompilerTool': {
            'RuntimeLibrary': 1, # static debug
          },
        },
      },
      'Release': {
        'defines': [ 'NDEBUG' ],
        'msvs_settings': {
          'VCCLCompilerTool': {
            'RuntimeLibrary': 0, # static release
          },
        },
      }
    },
    'msvs_settings': {
      'VCCLCompilerTool': {
      },
      'VCLibrarianTool': {
      },
      'VCLinkerTool': {
        'GenerateDebugInformation': 'true',
      },
    },
    'conditions': [
      ['OS == "win"', {
        'defines': [
          'WIN32'
        ],
      }]
    ],
  },

  'targets': [
    {
      'target_name': 'action_before_build',
      'type': 'none',
      'hard_dependency': 1,
      'actions': [
        {
          'action_name': 'unpack_sqlite_dep',
          'inputs': [
            './sqlite-autoconf-<@(sqlite_version).tar.gz'
          ],
          'outputs': [
            '<(SHARED_INTERMEDIATE_DIR)/sqlite-autoconf-<@(sqlite_version)/sqlite3.c'
          ],
          'action': ['python','./extract.py','./sqlite-autoconf-<@(sqlite_version).tar.gz','<(SHARED_INTERMEDIATE_DIR)']
        }
      ],
      'direct_dependent_settings': {
        'include_dirs': [
          '<(SHARED_INTERMEDIATE_DIR)',
        ],
        'sources': [
          '<(SHARED_INTERMEDIATE_DIR)/sqlite-autoconf-<@(sqlite_version)/sqlite3.c'
        ]
      },
    },
    {
      'target_name': 'sqlite3',
      'type': 'static_library',
      'include_dirs': [ './sqlite-autoconf-<@(sqlite_version)/' ],
      'dependencies': [
        'action_before_build'
      ],
      'direct_dependent_settings': {
        'include_dirs': [ './sqlite-autoconf-<@(sqlite_version)/' ],
        'defines': [
          'SQLITE_THREADSAFE=1',
          'SQLITE_ENABLE_FTS3',
          'SQLITE_ENABLE_RTREE'
        ],
      },
      'defines': [
        '_REENTRANT=1',
        'SQLITE_THREADSAFE=1',
        'SQLITE_ENABLE_FTS3',
        'SQLITE_ENABLE_RTREE'
      ],
      'export_dependent_settings': [
        'action_before_build',
      ]
    }
  ]
}

@@ -1427,80 +1427,8 @@
 : %5B%0A
-          '%3C(SHARED_INTERMEDIATE_DIR)',%0A        %5D,%0A        'sources': %5B%0A
     
@@ -1492,34 +1492,26 @@
 te_version)/
-sqlite3.c
 '
+,
 %0A        %5D%0A 
@@ -1612,33 +1612,58 @@
 clude_dirs': %5B '
-.
+%3C(SHARED_INTERMEDIATE_DIR)
 /sqlite-autoconf
@@ -1742,32 +1742,142 @@
 build'%0A      %5D,%0A
+      'sources': %5B%0A        '%3C(SHARED_INTERMEDIATE_DIR)/sqlite-autoconf-%3C@(sqlite_version)/sqlite3.c'%0A      %5D,%0A
       'direct_de
@@ -1924,17 +1924,42 @@
 rs': %5B '
-.
+%3C(SHARED_INTERMEDIATE_DIR)
 /sqlite-

fix include paths for sqlite3.h and avoid double build of sqlite3.o - refs #162 and #163