Prevent unnecessary rebuilding of libs.
[maemo-rb.git] / rbutil / rbutilqt / rbutilqt.pro
blob64a5ed7f892085323bd14e0674e3aeb2b8d6b577
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)
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 rbspeex.commands = @$(MAKE) -s \
74 TARGET_DIR=$$MYBUILDDIR -C $$RBBASE_DIR/tools/rbspeex \
75 librbspeex$$RBLIBPOSTFIX \
76 SYS_SPEEX=\"$$LIBSPEEX\" \
77 CC=\"$$QMAKE_CC\" AR=\"$$MYAR\"
78 libucl.commands = @$(MAKE) -s \
79 TARGET_DIR=$$MYBUILDDIR -C $$RBBASE_DIR/tools/ucl/src \
80 libucl$$RBLIBPOSTFIX \
81 CC=\"$$QMAKE_CC\" AR=\"$$MYAR\"
82 libmkamsboot.commands = @$(MAKE) -s \
83 TARGET_DIR=$$MYBUILDDIR -C $$RBBASE_DIR/rbutil/mkamsboot \
84 APPVERSION=\"rbutil\" \
85 libmkamsboot$$RBLIBPOSTFIX \
86 CC=\"$$QMAKE_CC\" AR=\"$$MYAR\"
87 libmktccboot.commands = @$(MAKE) -s \
88 TARGET_DIR=$$MYBUILDDIR -C $$RBBASE_DIR/rbutil/mktccboot \
89 libmktccboot$$RBLIBPOSTFIX \
90 CC=\"$$QMAKE_CC\" AR=\"$$MYAR\"
91 libmkmpioboot.commands = @$(MAKE) -s \
92 TARGET_DIR=$$MYBUILDDIR -C $$RBBASE_DIR/rbutil/mkmpioboot \
93 APPVERSION=\"rbutil\" \
94 libmkmpioboot$$RBLIBPOSTFIX \
95 CC=\"$$QMAKE_CC\" AR=\"$$MYAR\"
96 QMAKE_EXTRA_TARGETS += rbspeex libucl libmkamsboot libmktccboot libmkmpioboot
97 PRE_TARGETDEPS += rbspeex libucl libmkamsboot libmktccboot libmkmpioboot
99 # rule for creating ctags file
100 tags.commands = ctags -R --c++-kinds=+p --fields=+iaS --extra=+q $(SOURCES)
101 tags.depends = $(SOURCES)
102 QMAKE_EXTRA_TARGETS += tags
104 # add a custom rule for making the translations
105 lrelease.commands = $$[QT_INSTALL_BINS]/lrelease -silent $$_PRO_FILE_
106 QMAKE_EXTRA_TARGETS += lrelease
107 !dbg {
108 PRE_TARGETDEPS += lrelease
111 # Needed by QT on Win
112 INCLUDEPATH = $$_PRO_FILE_PWD_ $$_PRO_FILE_PWD_/irivertools \
113 $$_PRO_FILE_PWD_/quazip $$_PRO_FILE_PWD_/zlib $$_PRO_FILE_PWD_/base
114 INCLUDEPATH += $$RBBASE_DIR/rbutil/ipodpatcher $$RBBASE_DIR/rbutil/sansapatcher \
115 $$RBBASE_DIR/tools/rbspeex $$RBBASE_DIR/tools
117 DEPENDPATH = $$INCLUDEPATH
119 LIBS += -L$$OUT_PWD -L$$MYBUILDDIR -lrbspeex -lmkamsboot -lmktccboot -lmkmpioboot -lucl
120 !win32 {
121 LIBS += -lz
124 # Add a (possibly found) libspeex now, don't do this before -lrbspeex!
125 !static:!isEmpty(LIBSPEEX) {
126 LIBS += $$LIBSPEEX
129 TEMPLATE = app
130 TARGET = RockboxUtility
131 QT += network
132 dbg {
133 CONFIG += debug thread qt warn_on
134 DEFINES -= QT_NO_DEBUG_OUTPUT
135 DEFINES += DBG
136 message("debug")
138 !dbg {
139 CONFIG += release thread qt
140 DEFINES -= QT_NO_DEBUG_OUTPUT
141 DEFINES += NODEBUG
142 message("release")
145 DEFINES += RBUTIL _LARGEFILE64_SOURCE
147 # platform specific
148 win32 {
149 # use MinGW's implementation of stdio functions for extended format string
150 # support.
151 DEFINES += __USE_MINGW_ANSI_STDIO=1
152 LIBS += -lsetupapi -lnetapi32
154 win32:static {
155 QMAKE_LFLAGS += -static-libgcc -static-libstdc++
157 unix:!static:!libusb0:!macx {
158 DEFINES += LIBUSB1
159 LIBS += -lusb-1.0
161 unix:!static:libusb0:!macx {
162 LIBS += -lusb
165 unix:!macx:static {
166 # force statically linking of libusb. Libraries that are appended
167 # later will get linked dynamically again.
168 LIBS += -Wl,-Bstatic -lusb -Wl,-Bdynamic
171 # if -config intel is specified use 10.5 SDK and don't build for PPC
172 macx:!intel {
173 CONFIG += ppc
174 QMAKE_LFLAGS_PPC=-mmacosx-version-min=10.4 -arch ppc
175 QMAKE_LFLAGS_X86=-mmacosx-version-min=10.4 -arch i386
176 QMAKE_MAC_SDK=/Developer/SDKs/MacOSX10.4u.sdk
178 macx:intel {
179 QMAKE_LFLAGS_X86=-mmacosx-version-min=10.5 -arch i386
180 QMAKE_MAC_SDK=/Developer/SDKs/MacOSX10.5.sdk
181 QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.5
183 macx {
184 CONFIG += x86
185 LIBS += -L/usr/local/lib \
186 -framework IOKit -framework CoreFoundation -framework Carbon \
187 -framework SystemConfiguration -framework CoreServices
188 INCLUDEPATH += /usr/local/include
190 # rule for creating a dmg file
191 dmg.commands = hdiutil create -ov -srcfolder rbutilqt.app/ rbutil.dmg
192 QMAKE_EXTRA_TARGETS += dmg
195 static {
196 QTPLUGIN += qtaccessiblewidgets
197 LIBS += -L$$(QT_BUILD_TREE)/plugins/accessible -lqtaccessiblewidgets
198 LIBS += -L.
199 DEFINES += STATIC
200 message("using static plugin")
203 unix {
204 target.path = /usr/local/bin
205 INSTALLS += target
208 # source files are separate.
209 include(rbutilqt.pri)