TEMPLATE        = app
LANGUAGE        = C++

DEFINES += BUILDING_RECOLL

@QMAKE_ENABLE_WEBKIT@ QT += webkit
@QMAKE_DISABLE_WEBKIT@ QMAKE_CXXFLAGS += -DRESLIST_TEXTBROWSER -DSNIPPETS_TEXTBROWSER

@QMAKE_ENABLE_ZEITGEIST@ QT += dbus
@QMAKE_ENABLE_ZEITGEIST@ QMAKE_CXXFLAGS += -DUSE_ZEITGEIST

QT += xml
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets webkitwidgets printsupport

CONFIG  += qt warn_on thread release 

HEADERS += \
        advsearch_w.h \
        advshist.h \
        confgui/confgui.h \
        confgui/confguiindex.h \
        crontool.h \
        editdialog.h \
        firstidx.h \
        fragbuts.h \
        idxsched.h \
        listdialog.h \
        preview_w.h \
        preview_load.h \
        preview_plaintorich.h \
        ptrans_w.h \
        rclhelp.h \
        rclmain_w.h \
        reslist.h \
        restable.h \
        rtitool.h \
        searchclause_w.h \
        snippets_w.h \
        specialindex.h \
        spell_w.h \
        ssearch_w.h \
        systray.h \
        uiprefs_w.h \
        viewaction_w.h \

SOURCES += \
        advsearch_w.cpp \
        advshist.cpp \
        confgui/confgui.cpp \
        confgui/confguiindex.cpp \
        crontool.cpp \
        fragbuts.cpp \
        guiutils.cpp \
        main.cpp \
        multisave.cpp \
        preview_w.cpp \
        preview_load.cpp \
        preview_plaintorich.cpp \
        ptrans_w.cpp \
        rclhelp.cpp \
        rclmain_w.cpp \
        rclm_idx.cpp \
        rclm_preview.cpp \
        rclm_saveload.cpp \
        rclm_view.cpp \
        rclm_wins.cpp \
        rclzg.cpp \
        respopup.cpp \
        reslist.cpp \
        restable.cpp \
        rtitool.cpp \
        searchclause_w.cpp \
        snippets_w.cpp \
        spell_w.cpp \
        ssearch_w.cpp \
        systray.cpp \
        uiprefs_w.cpp \
        viewaction_w.cpp \
        xmltosd.cpp

FORMS   = \
        advsearch.ui \
        crontool.ui \
        editdialog.ui \
        firstidx.ui \
        idxsched.ui \
        listdialog.ui \
        ptrans.ui \
        rclmain.ui \
        restable.ui \
        rtitool.ui \
        specialindex.ui \
        spell.ui \
        snippets.ui \
        ssearchb.ui \
        uiprefs.ui \
        viewaction.ui \

RESOURCES = recoll.qrc

unix {
  UI_DIR = .ui
  MOC_DIR = .moc
  OBJECTS_DIR = .obj
  LIBS += -L../.libs -lrecoll

  !macx {
    # Note: libdir may be substituted with sthing like $(exec_prefix)/lib
    # at this point and will go as such in the Makefile. Expansion will be
    # completed at make time.
    LIBS += -Wl,-rpath=@libdir@/recoll
  }

  LIBS +=  @LIBXAPIAN@ $(LIBXAPIANSTATICEXTRA) \
       @LIBICONV@ $(BDYNAMIC) @LIBQZEITGEIST@ -lz

  INCLUDEPATH += ../common ../index ../internfile ../query ../unac \
              ../utils ../aspell ../rcldb ../qtgui ../xaposix \
              confgui
  DEPENDPATH += $$INCLUDEPATH
}

UNAME = $$system(uname -s)
contains( UNAME, [lL]inux ) {
	  LIBS += -ldl -lX11
}

contains( UNAME, SunOS ) {
          LIBS += -ldl
}

macx {
    ICON = images/recoll.icns
}

TRANSLATIONS = \
	     i18n/recoll_cs.ts \
	     i18n/recoll_da.ts \
	     i18n/recoll_de.ts \
	     i18n/recoll_el.ts \
	     i18n/recoll_es.ts \
             i18n/recoll_fr.ts \
             i18n/recoll_it.ts \
             i18n/recoll_lt.ts \
             i18n/recoll_ru.ts \
             i18n/recoll_tr.ts \
             i18n/recoll_uk.ts \
             i18n/recoll_xx.ts \
             i18n/recoll_zh_CN.ts \
             i18n/recoll_zh.ts \

unix {
  isEmpty(PREFIX) {
    PREFIX = /usr/local
  }
  message("Prefix is $$PREFIX")
  DEFINES += PREFIX=\\\"$$PREFIX\\\"

 # Installation stuff
  target.path = "$$PREFIX/bin"

  imdata.files = mtpics/*.png
  imdata.path = $$PREFIX/share/recoll/images
  trdata.files = i18n/*.qm
  trdata.path = $$PREFIX/share/recoll/translations
  desktop.files += ../desktop/recoll-searchgui.desktop
  desktop.path = $$PREFIX/share/applications/
  icona.files += ../desktop/recoll.png
  icona.path = $$PREFIX/share/icons/hicolor/48x48/apps/
  iconb.files += ../desktop/recoll.png
  iconb.path = $$PREFIX/share/pixmaps/
  appdata.files = ../desktop/recoll.appdata.xml
  appdata.path = $$PREFIX/share/appdata/
  INSTALLS += target imdata trdata desktop icona iconb appdata

  # The recollinstall script used to do the following to install zh_CN as
  # zh. Is this still needed?
  #${INSTALL} -m 0444 ${I18N}/recoll_zh_CN.qm \
  #  ${datadir}/recoll/translations/recoll_zh.qm || exit 1
}
