- CXXFLAGS = $(shell pkg-config --cflags QtCore QtGui 2>/dev/null) -Wall -O4
- QTLDLIBS = $(shell pkg-config --libs QtCore QtGui 2>/dev/null)
- LUALIB += -ldl
- LDLIBS += -ltermcap -lncurses
- MOC = $(shell pkg-config --variable=moc_location QtCore)
- # Below is a variant you can use if you have problems compiling with QT5 on ubuntu. see http://www.proxmark.org/forum/viewtopic.php?id=1661 for more info.
- #MOC = /usr/lib/x86_64-linux-gnu/qt4/bin/moc
- LUAPLATFORM = linux
+ ifeq ($(platform),Darwin)
+ LUAPLATFORM = macosx
+ else
+ LUALIB += -ldl
+ LDLIBS += -ltermcap -lncurses
+ LUAPLATFORM = linux
+ endif
+endif
+
+# Check for correctly configured Qt5
+QTINCLUDES = $(shell pkg-config --cflags Qt5Core Qt5Widgets 2>/dev/null)
+QTLDLIBS = $(shell pkg-config --libs Qt5Core Qt5Widgets 2>/dev/null)
+MOC = $(shell pkg-config --variable=host_bins Qt5Core)/moc
+ifeq ($(QTINCLUDES), )
+# if Qt5 not found Check for correctly configured Qt4
+ QTINCLUDES = $(shell pkg-config --cflags QtCore QtGui 2>/dev/null)
+ QTLDLIBS = $(shell pkg-config --libs QtCore QtGui 2>/dev/null)
+ MOC = $(shell pkg-config --variable=moc_location QtCore)
+endif
+ifeq ($(QTINCLUDES), )
+# if both pkg-config commands failed, search in common places
+ ifneq ($(QTDIR), )
+ QTINCLUDES = -I$(QTDIR)/include -I$(QTDIR)/include/QtCore -I$(QTDIR)/include/QtGui
+ QTLDLIBS = -L$(QTDIR)/lib -lQtCore4 -lQtGui4
+ ifneq ($(wildcard $(QTDIR)/include/QtWidgets),)
+ QTINCLUDES += -I$(QTDIR)/include/QtWidgets
+ QTLDLIBS = -L$(QTDIR)/lib -lQt5Widgets -lQt5Gui -lQt5Core
+ endif
+ MOC = $(QTDIR)/bin/moc
+ endif