Rockbox Utility: build chinachippatcher as library.
[maemo-rb.git] / rbutil / rbutilqt / rbutilqt.pro
blobe8e2ac9fe0fa49d8147d5596491f04f2bbdf9596
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 MACHINEFLAGS = $$find(QMAKE_CFLAGS, -m[63][42])
44 RBBASE_DIR = $$_PRO_FILE_PWD_
45 RBBASE_DIR = $$replace(RBBASE_DIR,/rbutil/rbutilqt,)
47 message("Rockbox Base dir: "$$RBBASE_DIR)
49 # custom rules for rockbox-specific libs
50 !mac {
51 RBLIBPOSTFIX = .a
53 mac {
54 RBLIBPOSTFIX = -universal
56 # check for system speex. Add a custom rule for pre-building librbspeex if not
57 # found. Newer versions of speex are split up into libspeex and libspeexdsp,
58 # and some distributions package them separately. Check for both and fall back
59 # to librbspeex if not found.
60 # NOTE: keep adding the linker option after -lrbspeex, otherwise linker errors
61 # occur if the linker defaults to --as-needed
62 # (see http://www.gentoo.org/proj/en/qa/asneeded.xml)
64 # Always use our own copy when building statically. Don't search for libspeex
65 # on Mac, since we don't deploy statically there.
66 !static:unix:!mac {
67 LIBSPEEX = $$system(pkg-config --silence-errors --libs speex speexdsp)
69 # The external Makefiles use ar to create libs. To allow cross-compiling pass
70 # the ar that matches the current gcc. Since qmake doesn't provide a variable
71 # holding the correct ar without any additions we need to figure it ourselves
72 # here. This assumes that QMAKE_CC will always be "gcc", maybe with a postfix.
73 MYAR = $$replace(QMAKE_CC,gcc.*,ar)
75 librbspeex.commands = @$(MAKE) -s \
76 TARGET_DIR=$$MYBUILDDIR -C $$RBBASE_DIR/tools/rbspeex \
77 librbspeex$$RBLIBPOSTFIX \
78 SYS_SPEEX=\"$$LIBSPEEX\" \
79 CC=\"$$QMAKE_CC $$MACHINEFLAGS\" AR=\"$$MYAR\"
80 libucl.commands = @$(MAKE) -s \
81 TARGET_DIR=$$MYBUILDDIR -C $$RBBASE_DIR/tools/ucl/src \
82 libucl$$RBLIBPOSTFIX \
83 CC=\"$$QMAKE_CC $$MACHINEFLAGS\" AR=\"$$MYAR\"
84 libmkamsboot.commands = @$(MAKE) -s \
85 TARGET_DIR=$$MYBUILDDIR -C $$RBBASE_DIR/rbutil/mkamsboot \
86 APPVERSION=\"rbutil\" \
87 libmkamsboot$$RBLIBPOSTFIX \
88 CC=\"$$QMAKE_CC $$MACHINEFLAGS\" AR=\"$$MYAR\"
89 libmktccboot.commands = @$(MAKE) -s \
90 TARGET_DIR=$$MYBUILDDIR -C $$RBBASE_DIR/rbutil/mktccboot \
91 libmktccboot$$RBLIBPOSTFIX \
92 CC=\"$$QMAKE_CC $$MACHINEFLAGS\" AR=\"$$MYAR\"
93 libmkmpioboot.commands = @$(MAKE) -s \
94 TARGET_DIR=$$MYBUILDDIR -C $$RBBASE_DIR/rbutil/mkmpioboot \
95 APPVERSION=\"rbutil\" \
96 libmkmpioboot$$RBLIBPOSTFIX \
97 CC=\"$$QMAKE_CC $$MACHINEFLAGS\" AR=\"$$MYAR\"
98 libchinachip.commands = @$(MAKE) -s \
99 TARGET_DIR=$$MYBUILDDIR -C $$RBBASE_DIR/rbutil/chinachippatcher \
100 APPVERSION=\"rbutil\" \
101 libchinachip$$RBLIBPOSTFIX \
102 CC=\"$$QMAKE_CC $$MACHINEFLAGS\" AR=\"$$MYAR\"
103 # Note: order is important for RBLIBS! The libs are appended to the linker
104 # flags in this order, put libucl at the end.
105 RBLIBS = librbspeex libmkamsboot libmktccboot libmkmpioboot libchinachip libucl
106 QMAKE_EXTRA_TARGETS += $$RBLIBS
107 PRE_TARGETDEPS += $$RBLIBS
109 # rule for creating ctags file
110 tags.commands = ctags -R --c++-kinds=+p --fields=+iaS --extra=+q $(SOURCES)
111 tags.depends = $(SOURCES)
112 QMAKE_EXTRA_TARGETS += tags
114 # add a custom rule for making the translations
115 lrelease.commands = $$[QT_INSTALL_BINS]/lrelease -silent $$_PRO_FILE_
116 QMAKE_EXTRA_TARGETS += lrelease
117 !dbg {
118 PRE_TARGETDEPS += lrelease
121 # Needed by QT on Win
122 INCLUDEPATH = $$_PRO_FILE_PWD_ $$_PRO_FILE_PWD_/irivertools \
123 $$_PRO_FILE_PWD_/quazip $$_PRO_FILE_PWD_/zlib $$_PRO_FILE_PWD_/base
124 INCLUDEPATH += $$RBBASE_DIR/rbutil/ipodpatcher $$RBBASE_DIR/rbutil/sansapatcher \
125 $$RBBASE_DIR/tools/rbspeex $$RBBASE_DIR/tools
127 DEPENDPATH = $$INCLUDEPATH
129 LIBS += -L$$OUT_PWD -L$$MYBUILDDIR
130 # append all RBLIBS to LIBS
131 for(rblib, RBLIBS) {
132 LIBS += -l$$replace(rblib, lib,)
135 # on win32 libz is linked implicitly.
136 !win32 {
137 LIBS += -lz
140 # Add a (possibly found) libspeex now, don't do this before -lrbspeex!
141 !static:!isEmpty(LIBSPEEX) {
142 LIBS += $$LIBSPEEX
145 TEMPLATE = app
146 TARGET = RockboxUtility
147 QT += network
148 dbg {
149 CONFIG += debug thread qt warn_on
150 DEFINES -= QT_NO_DEBUG_OUTPUT
151 DEFINES += DBG
152 message("debug")
154 !dbg {
155 CONFIG += release thread qt
156 DEFINES -= QT_NO_DEBUG_OUTPUT
157 DEFINES += NODEBUG
158 message("release")
161 DEFINES += RBUTIL _LARGEFILE64_SOURCE
163 # platform specific
164 win32 {
165 # use MinGW's implementation of stdio functions for extended format string
166 # support.
167 DEFINES += __USE_MINGW_ANSI_STDIO=1
168 LIBS += -lsetupapi -lnetapi32
170 win32:static {
171 QMAKE_LFLAGS += -static-libgcc -static-libstdc++
173 unix:!static:!libusb0:!macx {
174 DEFINES += LIBUSB1
175 LIBS += -lusb-1.0
177 unix:!static:libusb0:!macx {
178 LIBS += -lusb
181 unix:!macx:static {
182 # force statically linking of libusb. Libraries that are appended
183 # later will get linked dynamically again.
184 LIBS += -Wl,-Bstatic -lusb -Wl,-Bdynamic
187 # if -config intel is specified use 10.5 SDK and don't build for PPC
188 macx:!intel {
189 CONFIG += ppc
190 QMAKE_LFLAGS_PPC=-mmacosx-version-min=10.4 -arch ppc
191 QMAKE_LFLAGS_X86=-mmacosx-version-min=10.4 -arch i386
192 QMAKE_MAC_SDK=/Developer/SDKs/MacOSX10.4u.sdk
194 macx:intel {
195 QMAKE_LFLAGS_X86=-mmacosx-version-min=10.5 -arch i386
196 QMAKE_MAC_SDK=/Developer/SDKs/MacOSX10.5.sdk
197 QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.5
199 macx {
200 CONFIG += x86
201 LIBS += -L/usr/local/lib \
202 -framework IOKit -framework CoreFoundation -framework Carbon \
203 -framework SystemConfiguration -framework CoreServices
204 INCLUDEPATH += /usr/local/include
206 # rule for creating a dmg file
207 dmg.commands = hdiutil create -ov -srcfolder rbutilqt.app/ rbutil.dmg
208 QMAKE_EXTRA_TARGETS += dmg
211 static {
212 QTPLUGIN += qtaccessiblewidgets
213 LIBS += -L$$(QT_BUILD_TREE)/plugins/accessible -lqtaccessiblewidgets
214 LIBS += -L.
215 DEFINES += STATIC
216 message("using static plugin")
219 unix {
220 target.path = /usr/local/bin
221 INSTALLS += target
224 # source files are separate.
225 include(rbutilqt.pri)