#-*- mode: makefile; tab-width: 4; -*-
#
######### libfwbuilder/qmake.inc.in
#
QTDIR = $$(QTDIR)
TEMPLATE = lib
DEFINES += $$(DEFINES)
INCLUDEPATH += .. ../.. $$(INCLUDEPATH)
DEPENDPATH  += .. ../..
LANGUAGE = C++

HAVE_CPPUNIT = @HAVE_CPPUNIT@
CPPUNIT_CFLAGS = @CPPUNIT_CFLAGS@
CPPUNIT_LIBS = @CPPUNIT_LIBS@

CONFIG -= qt

QMAKE_CXXFLAGS_DEBUG += -D__STDC_FORMAT_MACROS
QMAKE_CXXFLAGS_RELEASE += -D__STDC_FORMAT_MACROS


unix {
    CONFIG += warn_on debug

    UI_DIR = .ui
    MOC_DIR = .moc
    OBJECTS_DIR = .obj

    prefix = @prefix@

    QMAKE_CXX = @CCACHE@ @DISTCC@ $$QMAKE_CXX

    # We put /usr/include into INCLUDEPATH to fix a problem compiling
    # fwbuilder/snmp.cpp on freebsd.
    INCLUDEPATH += /usr/include @XML_CFLAGS_Q@ @XSLT_CFLAGS_Q@
    LIBS += @PTHREAD_LIBS@ @XML_LIBS@ @XSLT_LIBS@ @LIBSNMP_LIBS@ @LIB_RESOLV@ @LIBS@

    QMAKE_CFLAGS_DEBUG += -Wno-unused-parameter
    QMAKE_CFLAGS_RELEASE += -Wno-unused-parameter
    QMAKE_CXXFLAGS_DEBUG += -Wno-unused-parameter @CXXFLAGS@
    QMAKE_CXXFLAGS_RELEASE += -Wno-unused-parameter @CXXFLAGS@

    exec_prefix = @EXEC_PREFIX@
    DESTDIR =

    target.path = @LIBDIR@
    dtd.path = @RES_DIR@/
    migration.path = @RES_DIR@/migration
    doc.path = @DOCDIR@
}

win32 {
    prefix = "c:/tmp/build_root"
    DOCDIR = "$$prefix/doc/"
    exec_prefix = "$$prefix"
    DESTDIR = ""

    target.path = "$$prefix/lib"
    dtd.path = "$$prefix/resources"
    migration.path = "$$prefix/resources/migration"
    doc.path = "$$prefix/doc/libfwbuilder"

    CONFIG -= debug
    CONFIG += thread rtti stl warn_on release
    CONFIG += staticlib

    DEFINES += LIBXML_STATIC LIBXSLT_STATIC 
    INCLUDEPATH += c:/local/include c:/local/include/libxml2 c:/MinGW/include
    LIBS += -LC:\local\lib
#    LIBS += ws2_32.lib pthreadVC.lib 
    LIBS += pthreadVC.lib 
    LIBS += libxml2.lib libxslt_a.lib libz.a  # zlib.lib
}

macx {
    prefix = "$$prefix"
    DOCDIR = "$$prefix/doc/"
    exec_prefix = "$$prefix"
    DESTDIR =

# these path definitions are not used since we do not run make install on Mac
# (see fwbuilder.def file where it is defined that we don't do that)
# But I need to assign these variables some value to make qmake happy.
    target.path = "$$prefix/lib"
    dtd.path = "$$prefix/"
    migration.path = "$$prefix/migration"
    doc.path = "$$prefix/doc/"

    CONFIG += x86 

# If I build on 10.6 without these, generated binary depends on
# /usr/lib/libxml2.2.dynlib that has compatibility version 10.0.0
# which does not work on 10.5 where its compatibility version is
# 9.0.0. Chances are, the same thing may be happening with other
# dependency libraries. Building on 10.6 with deployment target 10.5
# should solve the problem
    QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.5
    QMAKE_MAC_SDK = /Developer/SDKs/MacOSX10.5.sdk

    QMAKE_LFLAGS_SONAME = -Wl,-install_name,@executable_path/../Frameworks/
}


INSTALLS += target
