3 # Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 # Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 # Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 # Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
9 # All files in this archive are subject to the GNU General Public License.
10 # See the file COPYING in the source tree root for full license agreement.
12 # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
13 # KIND, either express or implied.
18 CCACHE
= $$
system(which ccache
)
20 message("using ccache")
21 QMAKE_CXX
= ccache $$QMAKE_CXX
22 QMAKE_CC
= ccache $$QMAKE_CC
26 MYBUILDDIR
= $$OUT_PWD
/build
/
27 MYLIBBUILDDIR
= $$MYBUILDDIR
/libs
/
28 OBJECTS_DIR
= $$MYBUILDDIR
/o
29 UI_DIR
= $$MYBUILDDIR
/ui
30 MOC_DIR
= $$MYBUILDDIR
/moc
31 RCC_DIR
= $$MYBUILDDIR
/rcc
39 # check version of Qt installation
40 VER
= $$
find(QT_VERSION
, ^
4\\.[5-9]+.*)
42 message("Qt >= 4.5 required!")
43 !isEmpty(QT_VERSION
) error("Qt found:" $$
[QT_VERSION
])
45 message("Qt version used:" $$VER
)
47 MACHINEFLAGS
= $$
find(QMAKE_CFLAGS
, -m
[63][42])
49 RBBASE_DIR
= $$_PRO_FILE_PWD_
50 RBBASE_DIR
= $$
replace(RBBASE_DIR
,/rbutil
/rbutilqt
,)
52 message("Rockbox Base dir: "$$RBBASE_DIR
)
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.
65 LIBSPEEX
= $$
system(pkg
-config
--silence
-errors
--libs speex speexdsp
)
67 # The external Makefiles use ar to create libs. To allow cross-compiling pass
68 # the ar that matches the current gcc. Since qmake doesn't provide a variable
69 # holding the correct ar without any additions we need to figure it ourselves
70 # here. This assumes that QMAKE_CC will always be "gcc", maybe with a postfix.
71 MYAR = $$replace(QMAKE_CC,gcc.*,ar)
73 librbspeex.commands = $$ADDENV \
74 BUILD_DIR=$$MYLIBBUILDDIR/rbspeex/ \
75 TARGET_DIR=$$MYLIBBUILDDIR \
76 SYS_SPEEX=\"$$LIBSPEEX\" \
77 CC=\"$$QMAKE_CC\" CFLAGS=\"$$MACHINEFLAGS\" AR=\"$$MYAR\" \
78 $(MAKE) -C $$RBBASE_DIR/tools/rbspeex librbspeex.a
79 libucl.commands = $$ADDENV \
80 BUILD_DIR=$$MYLIBBUILDDIR/ucl/ \
81 TARGET_DIR=$$MYLIBBUILDDIR \
82 CC=\"$$QMAKE_CC\" CFLAGS=\"$$MACHINEFLAGS\" AR=\"$$MYAR\" \
83 $(MAKE) -C $$RBBASE_DIR/tools/ucl/src libucl.a
84 libipodpatcher.commands = $$ADDENV \
85 BUILD_DIR=$$MYLIBBUILDDIR/ipodpatcher/ \
86 TARGET_DIR=$$MYLIBBUILDDIR \
87 APPVERSION=\"rbutil\" \
88 CC=\"$$QMAKE_CC\" CFLAGS=\"$$MACHINEFLAGS\" AR=\"$$MYAR\" \
89 $(MAKE) -C $$RBBASE_DIR/rbutil/ipodpatcher libipodpatcher.a
90 libsansapatcher.commands = $$ADDENV \
91 BUILD_DIR=$$MYLIBBUILDDIR/sansapatcher/ \
92 TARGET_DIR=$$MYLIBBUILDDIR \
93 APPVERSION=\"rbutil\" \
94 CC=\"$$QMAKE_CC\" CFLAGS=\"$$MACHINEFLAGS\" AR=\"$$MYAR\" \
95 $(MAKE) -C $$RBBASE_DIR/rbutil/sansapatcher libsansapatcher.a
96 libmkamsboot.commands = $$ADDENV \
97 BUILD_DIR=$$MYLIBBUILDDIR/mkamsboot/ \
98 TARGET_DIR=$$MYLIBBUILDDIR \
99 APPVERSION=\"rbutil\" \
100 CC=\"$$QMAKE_CC\" CFLAGS=\"$$MACHINEFLAGS\" AR=\"$$MYAR\" \
101 $(MAKE) -C $$RBBASE_DIR/rbutil/mkamsboot libmkamsboot.a
102 libmktccboot.commands = $$ADDENV \
103 BUILD_DIR=$$MYLIBBUILDDIR/mktccboot/ \
104 TARGET_DIR=$$MYLIBBUILDDIR \
105 APPVERSION=\"rbutil\" \
106 CC=\"$$QMAKE_CC\" CFLAGS=\"$$MACHINEFLAGS\" AR=\"$$MYAR\" \
107 $(MAKE) -C $$RBBASE_DIR/rbutil/mktccboot libmktccboot.a
108 libmkmpioboot.commands = $$ADDENV \
109 BUILD_DIR=$$MYLIBBUILDDIR/mkmpioboot/ \
110 TARGET_DIR=$$MYLIBBUILDDIR \
111 APPVERSION=\"rbutil\" \
112 CC=\"$$QMAKE_CC\" CFLAGS=\"$$MACHINEFLAGS\" AR=\"$$MYAR\" \
113 $(MAKE) -C $$RBBASE_DIR/rbutil/mkmpioboot libmkmpioboot.a
114 libchinachippatcher.commands = $$ADDENV \
115 BUILD_DIR=$$MYLIBBUILDDIR/chinachippatcher/ \
116 TARGET_DIR=$$MYLIBBUILDDIR \
117 APPVERSION=\"rbutil\" \
118 CC=\"$$QMAKE_CC\" CFLAGS=\"$$MACHINEFLAGS\" AR=\"$$MYAR\" \
119 $(MAKE) -C $$RBBASE_DIR/rbutil/chinachippatcher libchinachippatcher.a
120 libmkimxboot.commands = $$ADDENV \
121 BUILD_DIR=$$MYLIBBUILDDIR/mkimxboot/ \
122 TARGET_DIR=$$MYLIBBUILDDIR \
123 APPVERSION=\"rbutil\" \
124 CC=\"$$QMAKE_CC\" CFLAGS=\"$$MACHINEFLAGS\" AR=\"$$MYAR\" \
125 $(MAKE) -C $$RBBASE_DIR/rbutil/mkimxboot libmkimxboot.a
126 # Note: order is important for RBLIBS! The libs are appended to the linker
127 # flags in this order, put libucl at the end.
128 RBLIBS = librbspeex libipodpatcher libsansapatcher libmkamsboot libmktccboot \
129 libmkmpioboot libchinachippatcher libmkimxboot libucl
130 QMAKE_EXTRA_TARGETS += $$RBLIBS
131 PRE_TARGETDEPS += $$RBLIBS
133 # rule for creating ctags file
134 tags.commands = ctags -R --c++-kinds=+p --fields=+iaS --extra=+q $(SOURCES)
135 tags.depends = $(SOURCES)
136 QMAKE_EXTRA_TARGETS += tags
138 # add a custom rule for making the translations
139 lrelease.commands = $$[QT_INSTALL_BINS]/lrelease -silent $$_PRO_FILE_
140 QMAKE_EXTRA_TARGETS += lrelease
142 PRE_TARGETDEPS += lrelease
145 # Needed by QT on Win
146 INCLUDEPATH = $$_PRO_FILE_PWD_ $$_PRO_FILE_PWD_/irivertools \
147 $$_PRO_FILE_PWD_/zlib $$_PRO_FILE_PWD_/base \
148 $$_PRO_FILE_PWD_/zlib $$_PRO_FILE_PWD_/gui
149 INCLUDEPATH += $$RBBASE_DIR/rbutil/ipodpatcher $$RBBASE_DIR/rbutil/sansapatcher \
150 $$RBBASE_DIR/tools/rbspeex $$RBBASE_DIR/tools
152 DEPENDPATH = $$INCLUDEPATH
154 LIBS += -L$$OUT_PWD -L$$MYLIBBUILDDIR
155 # append all RBLIBS to LIBS
157 LIBS += -l$$replace(rblib, lib,)
160 # on win32 libz is linked implicitly.
165 # Add a (possibly found) libspeex now, don't do this before -lrbspeex!
166 !static
:!isEmpty(LIBSPEEX
) {
171 TARGET
= RockboxUtility
174 CONFIG
+= debug thread qt warn_on
175 DEFINES
-= QT_NO_DEBUG_OUTPUT
180 CONFIG
+= release thread qt
181 DEFINES
-= QT_NO_DEBUG_OUTPUT
186 DEFINES
+= RBUTIL _LARGEFILE64_SOURCE
190 # use MinGW's implementation of stdio functions for extended format string
192 DEFINES += __USE_MINGW_ANSI_STDIO=1
193 DEFINES += _CRT_SECURE_NO_WARNINGS
195 LIBS += -lsetupapi -lnetapi32
198 QMAKE_LFLAGS += -static-libgcc -static-libstdc++
200 unix:!static:!libusb0:!macx {
204 unix:!static:libusb0:!macx {
209 # force statically linking of libusb. Libraries that are appended
210 # later will get linked dynamically again.
211 LIBS += -Wl,-Bstatic -lusb -Wl,-Bdynamic
214 # if -config intel is specified use 10.5 SDK and don't build for PPC
217 QMAKE_LFLAGS_PPC
=-mmacosx
-version
-min
=10.4 -arch ppc
218 QMAKE_LFLAGS_X86
=-mmacosx
-version
-min
=10.4 -arch i386
219 QMAKE_MAC_SDK
=/Developer
/SDKs
/MacOSX10
.4u
.sdk
222 QMAKE_LFLAGS_X86
=-mmacosx
-version
-min
=10.5 -arch i386
223 QMAKE_MAC_SDK
=/Developer
/SDKs
/MacOSX10
.5
.sdk
224 QMAKE_MACOSX_DEPLOYMENT_TARGET
= 10.5
228 LIBS
+= -L
/usr
/local
/lib \
229 -framework IOKit
-framework CoreFoundation
-framework Carbon \
230 -framework SystemConfiguration
-framework CoreServices
231 INCLUDEPATH
+= /usr
/local
/include
233 # rule for creating a dmg file
234 dmg
.commands
= hdiutil create
-ov
-srcfolder rbutilqt
.app
/ rbutil
.dmg
235 QMAKE_EXTRA_TARGETS
+= dmg
239 QTPLUGIN
+= qtaccessiblewidgets
240 LIBS
+= -L$$
(QT_BUILD_TREE
)/plugins
/accessible
-lqtaccessiblewidgets
243 message("using static plugin")
247 target
.path
= /usr
/local
/bin
251 # source files are separate.
252 include(rbutilqt
.pri
)