--- a/lgi/Makefile
+++ b/lgi/Makefile
@@ -7,13 +7,13 @@
 
 PREFIX = /usr/local
 HOST_OS = $(shell uname -s | tr A-Z a-z)
-LUA_VERSION=5.1
-LUA_LIBDIR = $(PREFIX)/lib/lua/$(LUA_VERSION)
-LUA_SHAREDIR = $(PREFIX)/share/lua/$(LUA_VERSION)
+PKG_CONFIG ?= pkg-config
+LUA_VERSION=5.4
+LUA_LIBDIR = $(shell $(PKG_CONFIG) lua54 --variable INSTALL_CMOD)
+LUA_SHAREDIR = $(shell $(PKG_CONFIG) lua54 --variable INSTALL_LMOD)
 
-PKG_CONFIG = pkg-config
 GINAME = gobject-introspection-1.0
-PKGS = $(GINAME) gmodule-2.0 libffi
+PKGS = $(GINAME) gmodule-2.0 libffi lua54
 VERSION_FILE = version.lua
 
 ifneq ($(filter cygwin% msys% mingw%, $(HOST_OS)),)
@@ -27,7 +27,7 @@
 CCSHARED = -fno-common
 GOBJECT_INTROSPECTION_LIBDIR = $(shell $(PKG_CONFIG) --variable=libdir $(GINAME))
 else
-CORE = corelgilua51.so
+CORE = corelgilua54.so
 LIBFLAG = -shared
 CCSHARED = -fPIC
 endif
