 
 (defun emacsql-sqlite-compile-switches ()
   "Return the compilation switches from the Makefile under sqlite/."
-  (let ((makefile (expand-file-name "sqlite/Makefile" emacsql-data-root))
+  (let ((makefile (expand-file-name "sqlite/Makefile" emacsql-sqlite-data-root))
         (case-fold-search nil))
     (with-temp-buffer
       (insert-file-contents makefile)

          ((not emacsql-sqlite-automatic-build)
           (prog1 nil
             (message "Local SQLite build disabled, skipping")))
          (t (mkdir (expand-file-name "bin" emacsql-data-root) t)
             (message "Compiling EmacSQL SQLite binary ...")
             (let ((log (get-buffer-create byte-compile-log-buffer)))
               (with-current-buffer log

;;; SQLite connection

(cl-eval-when (load compile)
  (defvar emacsql-sqlite-data-root
    (file-name-directory (or load-file-name buffer-file-name))
    "Directory where EmacSQL is installed."))

(cl-eval-when (load compile)
  (defvar emacsql-sqlite-executable
    (expand-file-name (format "bin/emacsql-sqlite-%s%s" (emacsql-system-tuple)
                              (if (memq system-type '(windows-nt cygwin ms-dos))
                                  ".exe"
                                ""))
                      emacsql-sqlite-data-root)
    "Path to the EmacSQL backend (this is not the sqlite3 shell)."))

(defvar emacsql-sqlite-reserved
