Link libstdc++ and libgcc statically.
[maemo-rb.git] / rbutil / rbutilqt / rbutilqt.pro
blobc431c824c78bea3294af0a09d8b8b462cacd4236
2 # __________ __ ___.
3 # Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 # Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 # Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 # Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 # \/ \/ \/ \/ \/
8 # $Id$
10 # All files in this archive are subject to the GNU General Public License.
11 # See the file COPYING in the source tree root for full license agreement.
13 # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
14 # KIND, either express or implied.
17 # ccache
18 unix:!mac:!noccache {
19 CCACHE = $$system(which ccache)
20 !isEmpty(CCACHE) {
21 message("using ccache")
22 QMAKE_CXX = ccache g++
23 QMAKE_CC = ccache gcc
27 MYBUILDDIR = $$OUT_PWD/build/
28 OBJECTS_DIR = $$MYBUILDDIR/o
29 UI_DIR = $$MYBUILDDIR/ui
30 MOC_DIR = $$MYBUILDDIR/moc
31 RCC_DIR = $$MYBUILDDIR/rcc
34 # check version of Qt installation
35 VER = $$find(QT_VERSION, ^4\\.[5-9]+.*)
36 isEmpty(VER) {
37 message("Qt >= 4.5 required!")
38 !isEmpty(QT_VERSION) error("Qt found:" $$[QT_VERSION])
40 message("Qt version used:" $$VER)
42 RBBASE_DIR = $$_PRO_FILE_PWD_
43 RBBASE_DIR = $$replace(RBBASE_DIR,/rbutil/rbutilqt,)
45 message("Rockbox Base dir: "$$RBBASE_DIR)
47 # custom rules for rockbox-specific libs
48 !mac {
49 RBLIBPOSTFIX = .a
51 mac {
52 RBLIBPOSTFIX = -universal
54 # check for system speex. Add a custom rule for pre-building librbspeex if not
55 # found. Newer versions of speex are split up into libspeex and libspeexdsp,
56 # and some distributions package them separately. Check for both and fall back
57 # to librbspeex if not found.
58 # NOTE: keep adding the linker option after -lrbspeex, otherwise linker errors
59 # occur if the linker defaults to --as-needed
60 # (see http://www.gentoo.org/proj/en/qa/asneeded.xml)
62 # Always use our own copy when building statically. Don't search for libspeex
63 # on Mac, since we don't deploy statically there.
64 !static:unix:!mac {
65 LIBSPEEX = $$system(pkg-config --silence-errors --libs speex speexdsp)
68 rbspeex.commands = @$(MAKE) \
69 TARGET_DIR=$$MYBUILDDIR -C $$RBBASE_DIR/tools/rbspeex \
70 librbspeex$$RBLIBPOSTFIX CC=\"$$QMAKE_CC\" \
71 SYS_SPEEX=\"$$LIBSPEEX\"
72 libucl.commands = @$(MAKE) \
73 TARGET_DIR=$$MYBUILDDIR -C $$RBBASE_DIR/tools/ucl/src \
74 libucl$$RBLIBPOSTFIX CC=\"$$QMAKE_CC\"
75 libmkamsboot.commands = @$(MAKE) \
76 TARGET_DIR=$$MYBUILDDIR -C $$RBBASE_DIR/rbutil/mkamsboot \
77 libmkamsboot$$RBLIBPOSTFIX CC=\"$$QMAKE_CC\"
78 libmktccboot.commands = @$(MAKE) \
79 TARGET_DIR=$$MYBUILDDIR -C $$RBBASE_DIR/rbutil/mktccboot \
80 libmktccboot$$RBLIBPOSTFIX CC=\"$$QMAKE_CC\"
81 libmkmpioboot.commands = @$(MAKE) \
82 TARGET_DIR=$$MYBUILDDIR -C $$RBBASE_DIR/rbutil/mkmpioboot \
83 libmkmpioboot$$RBLIBPOSTFIX CC=\"$$QMAKE_CC\"
84 QMAKE_EXTRA_TARGETS += rbspeex libucl libmkamsboot libmktccboot libmkmpioboot
85 PRE_TARGETDEPS += rbspeex libucl libmkamsboot libmktccboot libmkmpioboot
87 # rule for creating ctags file
88 tags.commands = ctags -R --c++-kinds=+p --fields=+iaS --extra=+q $(SOURCES)
89 tags.depends = $(SOURCES)
90 QMAKE_EXTRA_TARGETS += tags
92 # add a custom rule for making the translations
93 lrelease.commands = $$[QT_INSTALL_BINS]/lrelease -silent $$_PRO_FILE_
94 QMAKE_EXTRA_TARGETS += lrelease
95 !dbg {
96 PRE_TARGETDEPS += lrelease
99 # Needed by QT on Win
100 INCLUDEPATH = $$_PRO_FILE_PWD_ $$_PRO_FILE_PWD_/irivertools \
101 $$_PRO_FILE_PWD_/zip $$_PRO_FILE_PWD_/zlib $$_PRO_FILE_PWD_/base
102 INCLUDEPATH += $$RBBASE_DIR/rbutil/ipodpatcher $$RBBASE_DIR/rbutil/sansapatcher \
103 $$RBBASE_DIR/tools/rbspeex $$RBBASE_DIR/tools
105 DEPENDPATH = $$INCLUDEPATH
107 LIBS += -L$$OUT_PWD -L$$MYBUILDDIR -lrbspeex -lmkamsboot -lmktccboot -lmkmpioboot -lucl
109 # Add a (possibly found) libspeex now, don't do this before -lrbspeex!
110 !static:!isEmpty(LIBSPEEX) {
111 LIBS += $$LIBSPEEX
114 TEMPLATE = app
115 TARGET = RockboxUtility
116 QT += network
117 dbg {
118 CONFIG += debug thread qt warn_on
119 DEFINES -= QT_NO_DEBUG_OUTPUT
120 message("debug")
122 !dbg {
123 CONFIG += release thread qt
124 DEFINES -= QT_NO_DEBUG_OUTPUT
125 DEFINES += NODEBUG
126 message("release")
129 DEFINES += RBUTIL _LARGEFILE64_SOURCE
131 # platform specific
132 win32 {
133 LIBS += -lsetupapi -lnetapi32
135 win32:static {
136 QMAKE_LFLAGS += -static-libgcc -static-libstdc++
138 unix:!static:!libusb1:!macx {
139 LIBS += -lusb
141 unix:!static:libusb1:!macx {
142 DEFINES += LIBUSB1
143 LIBS += -lusb-1.0
145 unix {
146 # explicitly link zlib, we do need it. Don't rely on implicit linking via Qt.
147 LIBS += -lz
150 unix:!macx:static {
151 # force statically linking of libusb. Libraries that are appended
152 # later will get linked dynamically again.
153 LIBS += -Wl,-Bstatic -lusb -Wl,-Bdynamic
156 # if -config intel is specified use 10.5 SDK and don't build for PPC
157 macx:!intel {
158 CONFIG += ppc
159 QMAKE_LFLAGS_PPC=-mmacosx-version-min=10.4 -arch ppc
160 QMAKE_LFLAGS_X86=-mmacosx-version-min=10.4 -arch i386
161 QMAKE_MAC_SDK=/Developer/SDKs/MacOSX10.4u.sdk
163 macx:intel {
164 QMAKE_LFLAGS_X86=-mmacosx-version-min=10.5 -arch i386
165 QMAKE_MAC_SDK=/Developer/SDKs/MacOSX10.5.sdk
166 QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.5
168 macx {
169 CONFIG += x86
170 LIBS += -L/usr/local/lib -lz \
171 -framework IOKit -framework CoreFoundation -framework Carbon \
172 -framework SystemConfiguration -framework CoreServices
173 INCLUDEPATH += /usr/local/include
175 # rule for creating a dmg file
176 dmg.commands = hdiutil create -ov -srcfolder rbutilqt.app/ rbutil.dmg
177 QMAKE_EXTRA_TARGETS += dmg
180 static {
181 QTPLUGIN += qtaccessiblewidgets
182 LIBS += -L$$(QT_BUILD_TREE)/plugins/accessible -lqtaccessiblewidgets
183 LIBS += -L.
184 DEFINES += STATIC
185 message("using static plugin")
188 unix {
189 target.path = /usr/local/bin
190 INSTALLS += target
193 # source files are separate.
194 include(rbutilqt.pri)