Consolidate libraries list in project file a bit.

Instead of having to mention each library several times (extra targets, target
dependencies, linker flags) create a list of libraries we build directly and
create all other lists from them. Note that libraries get processed in the
order of the list, which is important for linking order. As a result libucl
needs to come last.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31116 a1c6a512-1295-4272-9138-f99709370657
diff --git a/rbutil/rbutilqt/rbutilqt.pro b/rbutil/rbutilqt/rbutilqt.pro
index 7f9ebb8..fc54752 100644
--- a/rbutil/rbutilqt/rbutilqt.pro
+++ b/rbutil/rbutilqt/rbutilqt.pro
@@ -72,7 +72,7 @@
 # here. This assumes that QMAKE_CC will always be "gcc", maybe with a postfix.
 MYAR = $$replace(QMAKE_CC,gcc.*,ar)
 
-rbspeex.commands = @$(MAKE) -s \
+librbspeex.commands = @$(MAKE) -s \
         TARGET_DIR=$$MYBUILDDIR -C $$RBBASE_DIR/tools/rbspeex \
         librbspeex$$RBLIBPOSTFIX \
         SYS_SPEEX=\"$$LIBSPEEX\" \
@@ -95,8 +95,11 @@
         APPVERSION=\"rbutil\" \
         libmkmpioboot$$RBLIBPOSTFIX \
         CC=\"$$QMAKE_CC $$MACHINEFLAGS\" AR=\"$$MYAR\"
-QMAKE_EXTRA_TARGETS += rbspeex libucl libmkamsboot libmktccboot libmkmpioboot
-PRE_TARGETDEPS += rbspeex libucl libmkamsboot libmktccboot libmkmpioboot
+# Note: order is important for RBLIBS! The libs are appended to the linker
+# flags in this order, put libucl at the end.
+RBLIBS = librbspeex libmkamsboot libmktccboot libmkmpioboot libucl
+QMAKE_EXTRA_TARGETS += $$RBLIBS
+PRE_TARGETDEPS += $$RBLIBS
 
 # rule for creating ctags file
 tags.commands = ctags -R --c++-kinds=+p --fields=+iaS --extra=+q $(SOURCES)
@@ -118,7 +121,13 @@
 
 DEPENDPATH = $$INCLUDEPATH
 
-LIBS += -L$$OUT_PWD -L$$MYBUILDDIR -lrbspeex -lmkamsboot -lmktccboot -lmkmpioboot -lucl
+LIBS += -L$$OUT_PWD -L$$MYBUILDDIR
+# append all RBLIBS to LIBS
+for(rblib, RBLIBS) {
+    LIBS += -l$$replace(rblib, lib,)
+}
+
+# on win32 libz is linked implicitly.
 !win32 {
     LIBS += -lz
 }