WPS editor:
 * Simplify Makefile
 * Get rid of buildall.*
 * Change library loading behaviour to work with MODEL_NAME
Screenshot:
 * Simplify Makefile
config-*.h:
 * Add MODEL_NAME


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18407 a1c6a512-1295-4272-9138-f99709370657
diff --git a/firmware/export/config-c100.h b/firmware/export/config-c100.h
index 91e21d0..5bf0fc8 100644
--- a/firmware/export/config-c100.h
+++ b/firmware/export/config-c100.h
@@ -3,6 +3,8 @@
  */
 #define TARGET_TREE /* this target is using the target tree system */
 
+#define MODEL_NAME "Sandisk Sansa c100 series"
+
 /* For Rolo and boot loader */
 #define MODEL_NUMBER 30
 
diff --git a/firmware/export/config-c200.h b/firmware/export/config-c200.h
index d7b8e7e..bb8adae 100644
--- a/firmware/export/config-c200.h
+++ b/firmware/export/config-c200.h
@@ -5,7 +5,7 @@
 
 /* For Rolo and boot loader */
 #define MODEL_NUMBER 20
-#define MODEL_NAME   "Sandisk Sansa c200"
+#define MODEL_NAME   "Sandisk Sansa c200 series"
 
 #define HW_SAMPR_CAPS       (SAMPR_CAP_44)
 
diff --git a/firmware/export/config-cowond2.h b/firmware/export/config-cowond2.h
index 841390b..1bcb406 100644
--- a/firmware/export/config-cowond2.h
+++ b/firmware/export/config-cowond2.h
@@ -6,6 +6,8 @@
 /* For Rolo and boot loader */
 #define MODEL_NUMBER 24
 
+#define MODEL_NAME   "Cowon iAudio D2"
+
 /* Produce a dual-boot bootloader.bin for mktccboot */
 #define TCCBOOT
 
diff --git a/firmware/export/config-creativezv.h b/firmware/export/config-creativezv.h
index bf7b45b..7805501 100644
--- a/firmware/export/config-creativezv.h
+++ b/firmware/export/config-creativezv.h
@@ -28,6 +28,8 @@
 
 #define CREATIVE_ZV 1
 
+#define MODEL_NAME   "Creative Zen Vision"
+
 /* This makes it part of the Creative Zen Vision family :) */
 #define CREATIVE_ZVx 1
 
diff --git a/firmware/export/config-creativezvm.h b/firmware/export/config-creativezvm.h
index 647e8e9..c2abcda 100644
--- a/firmware/export/config-creativezvm.h
+++ b/firmware/export/config-creativezvm.h
@@ -28,6 +28,8 @@
 
 #define CREATIVE_ZVM 1
 
+#define MODEL_NAME   "Creative Zen Vision: M"
+
 /* This makes it part of the Creative Zen Vision family :) */
 #define CREATIVE_ZVx 1
 
@@ -160,7 +162,7 @@
 #define BOOTFILE "rockbox." BOOTFILE_EXT
 #define BOOTDIR "/.rockbox"
 
-#define CONFIG_USBOTG	USBOTG_ISP1583
+#define CONFIG_USBOTG USBOTG_ISP1583
 #define HAVE_USBSTACK
 #define USB_VENDOR_ID 0x041e 
 #define USB_PRODUCT_ID 0x4133
diff --git a/firmware/export/config-creativezvm60gb.h b/firmware/export/config-creativezvm60gb.h
index e9ad101..93fb2e5 100644
--- a/firmware/export/config-creativezvm60gb.h
+++ b/firmware/export/config-creativezvm60gb.h
@@ -28,6 +28,8 @@
 
 #define CREATIVE_ZVM60GB 1
 
+#define MODEL_NAME   "Creative Zen Vision:M 60GB"
+
 /* This makes it part of the Creative Zen Vision family :) */
 #define CREATIVE_ZVx 1
 
diff --git a/firmware/export/config-e200.h b/firmware/export/config-e200.h
index 3a4ab69..f187c97 100644
--- a/firmware/export/config-e200.h
+++ b/firmware/export/config-e200.h
@@ -5,7 +5,7 @@
 
 /* For Rolo and boot loader */
 #define MODEL_NUMBER 16
-#define MODEL_NAME   "Sandisk Sansa e200"
+#define MODEL_NAME   "Sandisk Sansa e200 series"
 
 #define HW_SAMPR_CAPS       (SAMPR_CAP_44)
 
diff --git a/firmware/export/config-fmrecorder.h b/firmware/export/config-fmrecorder.h
index c3c894e..fd85e51 100644
--- a/firmware/export/config-fmrecorder.h
+++ b/firmware/export/config-fmrecorder.h
@@ -1,6 +1,8 @@
 /* define this if you use an ATA controller */
 #define HAVE_ATA
 
+#define MODEL_NAME "Archos FM Recorder"
+
 /* define this if you have recording possibility */
 #define HAVE_RECORDING
 
diff --git a/firmware/export/config-gigabeat-s.h b/firmware/export/config-gigabeat-s.h
index cafb202..1f40339 100644
--- a/firmware/export/config-gigabeat-s.h
+++ b/firmware/export/config-gigabeat-s.h
@@ -7,6 +7,8 @@
 
 #define TOSHIBA_GIGABEAT_S 1
 
+#define MODEL_NAME "Toshiba Gigabeat S"
+
 /* For Rolo and boot loader */
 #define MODEL_NUMBER 21
 
diff --git a/firmware/export/config-gigabeat.h b/firmware/export/config-gigabeat.h
index cf64baa..27bd51e 100644
--- a/firmware/export/config-gigabeat.h
+++ b/firmware/export/config-gigabeat.h
@@ -5,6 +5,8 @@
 
 #define TOSHIBA_GIGABEAT_F 1
 
+#define MODEL_NAME "Toshiba Gigabeat F"
+
 /* For Rolo and boot loader */
 #define MODEL_NUMBER 18
 
diff --git a/firmware/export/config-h100.h b/firmware/export/config-h100.h
index 987f9a6..f250c5f 100644
--- a/firmware/export/config-h100.h
+++ b/firmware/export/config-h100.h
@@ -9,6 +9,8 @@
  */
 #define IRIVER_H100_SERIES 1
 
+#define MODEL_NAME "iriver iHP-100 series"
+
 /* For Rolo and boot loader */
 #define MODEL_NUMBER 1
 
diff --git a/firmware/export/config-h120.h b/firmware/export/config-h120.h
index afb8488..9cea95e 100644
--- a/firmware/export/config-h120.h
+++ b/firmware/export/config-h120.h
@@ -4,6 +4,8 @@
  */
 #define IRIVER_H100_SERIES 1
 
+#define MODEL_NAME "iriver H120/H140"
+
 /* For Rolo and boot loader */
 #define MODEL_NUMBER 0
 
diff --git a/firmware/export/config-h300.h b/firmware/export/config-h300.h
index c9b473a..4aae255 100644
--- a/firmware/export/config-h300.h
+++ b/firmware/export/config-h300.h
@@ -4,6 +4,8 @@
  */
 #define IRIVER_H300_SERIES 1
 
+#define MODEL_NAME "iriver H300 series"
+
 /* For Rolo and boot loader */
 #define MODEL_NUMBER 2
 
diff --git a/firmware/export/config-hdd1630.h b/firmware/export/config-hdd1630.h
index 19ca190..5b89bde 100755
--- a/firmware/export/config-hdd1630.h
+++ b/firmware/export/config-hdd1630.h
@@ -1,5 +1,5 @@
 /*
- * This config file is for the iriver H10 20Gb
+ * This config file is for the Philips GoGear HDD1630
  */
 
 #define TARGET_TREE /* this target is using the target tree system */
diff --git a/firmware/export/config-iaudiom3.h b/firmware/export/config-iaudiom3.h
index 1541f7c..b8dc52c 100644
--- a/firmware/export/config-iaudiom3.h
+++ b/firmware/export/config-iaudiom3.h
@@ -6,6 +6,8 @@
 /* For Rolo and boot loader */
 #define MODEL_NUMBER 25
 
+#define MODEL_NAME   "iAudio M3"
+
 /* define this if you use an ATA controller */
 #define HAVE_ATA
 
diff --git a/firmware/export/config-iaudiom5.h b/firmware/export/config-iaudiom5.h
index e54fb15..a5b0f3d 100644
--- a/firmware/export/config-iaudiom5.h
+++ b/firmware/export/config-iaudiom5.h
@@ -6,6 +6,8 @@
 /* For Rolo and boot loader */
 #define MODEL_NUMBER 17
 
+#define MODEL_NAME   "iAudio M5"
+
 /* define this if you use an ATA controller */
 #define HAVE_ATA
 
diff --git a/firmware/export/config-iaudiox5.h b/firmware/export/config-iaudiox5.h
index 0d6e500..c29d424 100644
--- a/firmware/export/config-iaudiox5.h
+++ b/firmware/export/config-iaudiox5.h
@@ -6,6 +6,8 @@
 /* For Rolo and boot loader */
 #define MODEL_NUMBER 10
 
+#define MODEL_NAME   "iAudio X5"
+
 /* define this if you use an ATA controller */
 #define HAVE_ATA
 
diff --git a/firmware/export/config-ifp7xx.h b/firmware/export/config-ifp7xx.h
index 41193e2..bea4374 100644
--- a/firmware/export/config-ifp7xx.h
+++ b/firmware/export/config-ifp7xx.h
@@ -5,6 +5,8 @@
 
 #define IRIVER_IFP7XX_SERIES 1
 
+#define MODEL_NAME   "iriver iFP-799"
+
 /* For Rolo and boot loader */
 #define MODEL_NUMBER 6
 
diff --git a/firmware/export/config-ipod1g2g.h b/firmware/export/config-ipod1g2g.h
index 6781fe60..cbb5267 100644
--- a/firmware/export/config-ipod1g2g.h
+++ b/firmware/export/config-ipod1g2g.h
@@ -5,6 +5,8 @@
 
 #define IPOD_ARCH 1
 
+#define MODEL_NAME   "Apple iPod 1g/2g"
+
 /* For Rolo and boot loader */
 #define MODEL_NUMBER 19
 
diff --git a/firmware/export/config-ipod3g.h b/firmware/export/config-ipod3g.h
index d5f403c..6c78f40 100644
--- a/firmware/export/config-ipod3g.h
+++ b/firmware/export/config-ipod3g.h
@@ -6,6 +6,8 @@
 
 #define IPOD_ARCH 1
 
+#define MODEL_NAME   "Apple iPod 3g"
+
 /* For Rolo and boot loader */
 #define MODEL_NUMBER 7
 
diff --git a/firmware/export/config-ipod4g.h b/firmware/export/config-ipod4g.h
index ad03f41..c5c592d 100644
--- a/firmware/export/config-ipod4g.h
+++ b/firmware/export/config-ipod4g.h
@@ -5,6 +5,8 @@
 
 #define IPOD_ARCH 1
 
+#define MODEL_NAME   "Apple iPod 4g Grayscale"
+
 /* For Rolo and boot loader */
 #define MODEL_NUMBER 8
 
diff --git a/firmware/export/config-ipodcolor.h b/firmware/export/config-ipodcolor.h
index 9a7c055..cda0857 100644
--- a/firmware/export/config-ipodcolor.h
+++ b/firmware/export/config-ipodcolor.h
@@ -5,6 +5,8 @@
 
 #define IPOD_ARCH 1
 
+#define MODEL_NAME   "Apple iPod Color/Photo"
+
 /* For Rolo and boot loader */
 #define MODEL_NUMBER 3
 
diff --git a/firmware/export/config-ipodmini.h b/firmware/export/config-ipodmini.h
index 15aa95b..b5c566f 100644
--- a/firmware/export/config-ipodmini.h
+++ b/firmware/export/config-ipodmini.h
@@ -5,6 +5,8 @@
 
 #define IPOD_ARCH 1
 
+#define MODEL_NAME   "Apple iPod Mini 1g"
+
 /* For Rolo and boot loader */
 #define MODEL_NUMBER 9
 
diff --git a/firmware/export/config-ipodmini2g.h b/firmware/export/config-ipodmini2g.h
index c861f5a..6a6ab7b 100644
--- a/firmware/export/config-ipodmini2g.h
+++ b/firmware/export/config-ipodmini2g.h
@@ -5,6 +5,8 @@
 
 #define IPOD_ARCH 1
 
+#define MODEL_NAME   "Apple iPod Mini 2g"
+
 /* For Rolo and boot loader */
 #define MODEL_NUMBER 11
 
diff --git a/firmware/export/config-ipodnano.h b/firmware/export/config-ipodnano.h
index ced2c47..bfdf7fd 100644
--- a/firmware/export/config-ipodnano.h
+++ b/firmware/export/config-ipodnano.h
@@ -5,6 +5,8 @@
 
 #define IPOD_ARCH 1
 
+#define MODEL_NAME   "Apple iPod Nano 1g"
+
 /* For Rolo and boot loader */
 #define MODEL_NUMBER 4
 
diff --git a/firmware/export/config-ipodvideo.h b/firmware/export/config-ipodvideo.h
index d15494c..4c56d74 100644
--- a/firmware/export/config-ipodvideo.h
+++ b/firmware/export/config-ipodvideo.h
@@ -5,6 +5,8 @@
 
 #define IPOD_ARCH 1
 
+#define MODEL_NAME   "Apple iPod Video"
+
 /* For Rolo and boot loader */
 #define MODEL_NUMBER 5
 
diff --git a/firmware/export/config-logikdax.h b/firmware/export/config-logikdax.h
index 175bf7c..c66a2ab 100644
--- a/firmware/export/config-logikdax.h
+++ b/firmware/export/config-logikdax.h
@@ -6,6 +6,8 @@
 /* For Rolo and boot loader */
 #define MODEL_NUMBER 27
 
+#define MODEL_NAME   "Logik DAX MP3/DAB"
+
 /* define this if you have recording possibility */
 //#define HAVE_RECORDING
 
diff --git a/firmware/export/config-m200.h b/firmware/export/config-m200.h
index 875debd..f7ab78d 100644
--- a/firmware/export/config-m200.h
+++ b/firmware/export/config-m200.h
@@ -6,6 +6,8 @@
 /* For Rolo and boot loader */
 #define MODEL_NUMBER 29
 
+#define MODEL_NAME   "Sandisk Sansa m200 series"
+
 /* Enable FAT16 support */
 #define HAVE_FAT16SUPPORT
 
diff --git a/firmware/export/config-meizu-m6sl.h b/firmware/export/config-meizu-m6sl.h
index 96c163c..f10f548 100644
--- a/firmware/export/config-meizu-m6sl.h
+++ b/firmware/export/config-meizu-m6sl.h
@@ -1,11 +1,13 @@
 /*
- * This config file is for iAudio X5
+ * This config file is for Meizu M6SL
  */
 #define TARGET_TREE /* this target is using the target tree system */
 
 /* For Rolo and boot loader */
 #define MODEL_NUMBER 1
 
+#define MODEL_NAME   "Meizu M6SL"
+
 /* define this if you have recording possibility */
 //#define HAVE_RECORDING
 
diff --git a/firmware/export/config-mrobe500.h b/firmware/export/config-mrobe500.h
index 285a53a..b9b8ee6 100644
--- a/firmware/export/config-mrobe500.h
+++ b/firmware/export/config-mrobe500.h
@@ -27,6 +27,7 @@
 #define CONFIG_SDRAM_START 0x00900000
 
 #define OLYMPUS_MROBE_500 1
+#define MODEL_NAME   "Olympus M:Robe 500i"
 
 /* For Rolo and boot loader */
 #define MODEL_NUMBER 22
diff --git a/firmware/export/config-ondavx747.h b/firmware/export/config-ondavx747.h
index 9f5c800..66570d4 100644
--- a/firmware/export/config-ondavx747.h
+++ b/firmware/export/config-ondavx747.h
@@ -28,6 +28,8 @@
 
 #define ONDA_VX747 1
 
+#define MODEL_NAME  "Onda VX747"
+
 /* For Rolo and boot loader */
 #define MODEL_NUMBER 30
 
diff --git a/firmware/export/config-ondiofm.h b/firmware/export/config-ondiofm.h
index d750b2d..8d3b040 100644
--- a/firmware/export/config-ondiofm.h
+++ b/firmware/export/config-ondiofm.h
@@ -1,6 +1,8 @@
 /* define this if you have recording possibility */
 #define HAVE_RECORDING
 
+#define MODEL_NAME   "Ondio FM"
+
 /* Define bitmask of input sources - recordable bitmask can be defined
    explicitly if different */
 #define INPUT_SRC_CAPS (SRC_CAP_MIC | SRC_CAP_LINEIN)
diff --git a/firmware/export/config-ondiosp.h b/firmware/export/config-ondiosp.h
index 43dbaaf..fc99bf4 100644
--- a/firmware/export/config-ondiosp.h
+++ b/firmware/export/config-ondiosp.h
@@ -1,6 +1,8 @@
 /* define this if you have a bitmap LCD display */
 #define HAVE_LCD_BITMAP
 
+#define MODEL_NAME   "Ondio SP"
+
 /* define this if you can flip your LCD */
 #define HAVE_LCD_FLIP
 
diff --git a/firmware/export/config-player.h b/firmware/export/config-player.h
index 2fefcbd..186bd5a 100644
--- a/firmware/export/config-player.h
+++ b/firmware/export/config-player.h
@@ -1,6 +1,8 @@
 /* define this if you use an ATA controller */
 #define HAVE_ATA
 
+#define MODEL_NAME   "Archos Player/Studio"
+
 /* define this if you have a charcell LCD display */
 #define HAVE_LCD_CHARCELLS
 
diff --git a/firmware/export/config-recorder.h b/firmware/export/config-recorder.h
index bd9bd07..b86e316 100644
--- a/firmware/export/config-recorder.h
+++ b/firmware/export/config-recorder.h
@@ -1,6 +1,8 @@
 /* define this if you use an ATA controller */
 #define HAVE_ATA
 
+#define MODEL_NAME  "Archos Recorder"
+
 /* define this if you have recording possibility */
 #define HAVE_RECORDING
 
diff --git a/firmware/export/config-recorderv2.h b/firmware/export/config-recorderv2.h
index 5006691..fd00b78 100644
--- a/firmware/export/config-recorderv2.h
+++ b/firmware/export/config-recorderv2.h
@@ -1,6 +1,8 @@
 /* define this if you use an ATA controller */
 #define HAVE_ATA
 
+#define MODEL_NAME   "Archos Recorder v2"
+
 /* define this if you have recording possibility */
 #define HAVE_RECORDING
 
diff --git a/firmware/export/config-tpj1022.h b/firmware/export/config-tpj1022.h
index 5a633ec..ea235ed 100644
--- a/firmware/export/config-tpj1022.h
+++ b/firmware/export/config-tpj1022.h
@@ -4,6 +4,8 @@
 
 #define TARGET_TREE /* this target is using the target tree system */
 
+#define MODEL_NAME "Tatung Elio TPJ-1022"
+
 /* For Rolo and boot loader */
 #define MODEL_NUMBER 15
 
diff --git a/utils/wpseditor/buildall.bat b/utils/wpseditor/buildall.bat
deleted file mode 100644
index b813a38..0000000
--- a/utils/wpseditor/buildall.bat
+++ /dev/null
@@ -1,9 +0,0 @@
-@echo off
-echo qmake...
-qmake 
-echo Building gui...
-mingw32-make 1>nul
-echo Building libs...
-cd libwps
-call buildall.bat 2>nul
-cd ..
diff --git a/utils/wpseditor/buildall.sh b/utils/wpseditor/buildall.sh
deleted file mode 100755
index c891900..0000000
--- a/utils/wpseditor/buildall.sh
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/bin/sh
-qmake && make
-cd libwps
-./buildall.sh 2> /dev/null
diff --git a/utils/wpseditor/gui/src/qwpsdrawer.cpp b/utils/wpseditor/gui/src/qwpsdrawer.cpp
index a506d5c..096d835 100644
--- a/utils/wpseditor/gui/src/qwpsdrawer.cpp
+++ b/utils/wpseditor/gui/src/qwpsdrawer.cpp
@@ -17,14 +17,14 @@
 proxy_api QWpsDrawer::api;
 
 QWpsDrawer::QWpsDrawer( QWpsState *ws,QTrackState *ms, QWidget *parent )
-        : QWidget(parent),wpsState(ws),trackState(ms),showGrid(false),mCurTarget("h10_5gb") {
+        : QWidget(parent),wpsState(ws),trackState(ms),showGrid(false),mCurTarget(qApp->applicationDirPath()+"/libwps_IRIVER_H10_5GB") {
 
     tryResolve();
     newTempWps();
 }
 
 bool QWpsDrawer::tryResolve() {
-    QLibrary lib(qApp->applicationDirPath()+"/libwps_"+mCurTarget);
+    QLibrary lib(mCurTarget);
     lib_wps_init = (pfwps_init)lib.resolve("wps_init");
     lib_wps_display = (pfwps_display)lib.resolve("wps_display");
     lib_wps_refresh = (pfwps_refresh)lib.resolve("wps_refresh");
@@ -47,7 +47,7 @@
         api.load_wps_backdrop =         &QWpsDrawer::load_wps_backdrop;
         api.read_bmp_file =             &QWpsDrawer::read_bmp_file;
         api.debugf =                    &qlogger;
-        qDebug()<<(qApp->applicationDirPath()+"/libwps_"+mCurTarget+" resolved");
+        qDebug()<<(mCurTarget+" resolved");
     }
     return mResolved;
 }
@@ -222,7 +222,7 @@
 QList<QString> QWpsDrawer::getTargets() {
     QList<QString> list ;
     QDir d = QDir(qApp->applicationDirPath());
-    QFileInfoList libs = d.entryInfoList(QStringList("libwps*"));
+    QFileInfoList libs = d.entryInfoList(QStringList("libwps_*"));
     qDebug() << libs.size()<<"libs found";
     for (int i = 0; i < libs.size(); i++) {
         QString modelName = getModelName(libs[i].absoluteFilePath());
@@ -230,15 +230,24 @@
         if (modelName == "unknown")
             continue;
         list.append(modelName);
+        libs_array[i].target_name = modelName;
+        libs_array[i].lib = libs[i].absoluteFilePath();
     }
     return list;
 }
 bool QWpsDrawer::setTarget(QString target) {
-    QLibrary lib(qApp->applicationDirPath()+"/libwps_"+mCurTarget);
-    //lib.unload();
-    if (getModelName("libwps_"+target)!="unknown") {
-        mCurTarget = target;
-        return tryResolve();
+    foreach(lib_t cur_lib, libs_array)
+    {
+        if(cur_lib.target_name == target)
+        {
+            QLibrary lib(cur_lib.lib);
+            //lib.unload();
+            if (getModelName(cur_lib.lib) != "unknown")
+            {
+                mCurTarget = cur_lib.lib;
+                return tryResolve();
+            }
+        }
     }
     return false;
 }
diff --git a/utils/wpseditor/gui/src/qwpsdrawer.h b/utils/wpseditor/gui/src/qwpsdrawer.h
index 65e9872..eec4300 100644
--- a/utils/wpseditor/gui/src/qwpsdrawer.h
+++ b/utils/wpseditor/gui/src/qwpsdrawer.h
@@ -5,6 +5,7 @@
 #include <QPixmap>
 #include <QPointer>
 #include <QTemporaryFile>
+#include <QMap>
 
 #include "wpsstate.h"
 
@@ -37,6 +38,13 @@
     QString           mWpsString;
     QString           mCurTarget;
     static QString    mTmpWpsString;
+    
+    struct lib_t
+    {
+        QString target_name;
+        QString lib;
+    };
+    QMap<int, lib_t> libs_array;
 
 
 protected:
diff --git a/utils/wpseditor/libwps/Makefile b/utils/wpseditor/libwps/Makefile
index c5d0a39..879cc8e 100644
--- a/utils/wpseditor/libwps/Makefile
+++ b/utils/wpseditor/libwps/Makefile
@@ -8,15 +8,13 @@
 #
 ROOT=../../..
 
-OS = w32
-CC = gcc
-MKDIR = mkdir -p
-
-ifeq ($(findstring MINGW,$(shell uname)),MINGW)
+ifneq ($or($(findstring MINGW,$(shell uname)),$(findstring Windows_NT,$(OS))),)
   OS = w32
   CC = mingw32-gcc
   COPY = copy
-  RM = rm
+  RM = del
+  EXT = .dll
+  LDFLAGS = -DBUILD_DLL
 endif
 
 ifeq ($(findstring Linux,$(shell uname)),Linux)
@@ -24,39 +22,48 @@
   CC = gcc
   COPY = cp
   RM = rm -f
+  EXT = .so
+  LDFLAGS = -fPIC
 endif
 
-
+TARGETS=IRIVER_H10 \
+        IRIVER_H10_5GB \
+        IPOD_COLOR \
+        IPOD_NANO \
+        IPOD_VIDEO \
+        GIGABEAT_F \
+        GIGABEAT_S \
+        SANSA_E200 \
+        SANSA_C200
 
 SOURCES= \
-	   src/api.c \
-	   src/dummies.c \
-	   src/lcd.c \
-	   src/proxy.c \
-	   $(ROOT)/apps/gui/scrollbar.c \
-	   $(ROOT)/apps/gui/gwps-common.c \
-	   $(ROOT)/apps/gui/wps_parser.c \
-	   $(ROOT)/apps/gui/wps_debug.c \
-	   $(ROOT)/apps/recorder/peakmeter.c \
-	   $(ROOT)/apps/recorder/icons.c \
-	   $(ROOT)/apps/misc.c \
-	   $(ROOT)/apps/status.c \
-	   $(ROOT)/firmware/common/ctype.c \
-	   $(ROOT)/firmware/common/timefuncs.c \
-	   $(ROOT)/firmware/common/unicode.c \
-	   $(ROOT)/firmware/font.c \
-	   $(ROOT)/firmware/font_cache.c \
-	   $(ROOT)/firmware/id3.c \
-	   $(ROOT)/firmware/lru.c \
-	   $(ROOT)/firmware/mp3data.c \
-	   $(ROOT)/firmware/replaygain.c 
-
-#	   $(ROOT)/apps/recorder/bmp.c
-#	   $(ROOT)/apps/abrepeat.c \
-#	   $(ROOT)/apps/action.c \
-#   	   $(ROOT)/apps/cuesheet.c \
-#	   $(ROOT)/apps/gui/statusbar.c \
-#	   $(ROOT)/apps/gui/gwps.c \
+        src/api.c \
+        src/dummies.c \
+        src/lcd.c \
+        src/proxy.c \
+        $(ROOT)/apps/gui/scrollbar.c \
+        $(ROOT)/apps/gui/gwps-common.c \
+        $(ROOT)/apps/gui/wps_parser.c \
+        $(ROOT)/apps/gui/wps_debug.c \
+        $(ROOT)/apps/recorder/peakmeter.c \
+        $(ROOT)/apps/recorder/icons.c \
+        $(ROOT)/apps/misc.c \
+        $(ROOT)/apps/status.c \
+        $(ROOT)/firmware/common/ctype.c \
+        $(ROOT)/firmware/common/timefuncs.c \
+        $(ROOT)/firmware/common/unicode.c \
+        $(ROOT)/firmware/font.c \
+        $(ROOT)/firmware/font_cache.c \
+        $(ROOT)/firmware/id3.c \
+        $(ROOT)/firmware/lru.c \
+        $(ROOT)/firmware/mp3data.c \
+        $(ROOT)/firmware/replaygain.c 
+#        $(ROOT)/apps/recorder/bmp.c
+#        $(ROOT)/apps/abrepeat.c \
+#        $(ROOT)/apps/action.c \
+#        $(ROOT)/apps/cuesheet.c \
+#        $(ROOT)/apps/gui/statusbar.c \
+#        $(ROOT)/apps/gui/gwps.c \
 
 INCLUDE=-I src/include \
         -I $(ROOT)/apps/gui \
@@ -68,34 +75,14 @@
 
 CFLAGS = -g -Wall -D__PCTOOL__ -DWPSEDITOR -DDEBUG -DROCKBOX_DIR_LEN=1 -DBUTTON_REMOTE
 
-all:
-	@echo To build, run the buildall.sh script
+RESULTS := $(patsubst %,libwps_%$(EXT),$(TARGETS))
 
-build: build-$(OS)
+all: $(RESULTS)
+	@$(COPY) $(RESULTS) ../gui/bin/
 
-build-w32: $(SOURCES)
-	@echo CC [$(TARGET)]
-	@$(CC) $(INCLUDE) $(CFLAGS) -D$(TARGET) -DTARGET_MODEL=\"$(MODEL)\" -DBUILD_DLL $(SOURCES) -shared -o libwps_$(MODEL).dll
+libwps_%$(EXT): $(SOURCES)
+	@echo CC [$(subst libwps_,,$(subst $(EXT),,$@))]
+	@$(CC) $(INCLUDE) $(CFLAGS) -D$(subst libwps_,,$(subst $(EXT),,$@)) $(LDFLAGS) -shared -o $@ $+
 
-build-linux: $(SOURCES)
-	@echo CC [$(TARGET)]
-	@$(CC) $(INCLUDE) $(CFLAGS) -D$(TARGET) -DTARGET_MODEL=\"$(MODEL)\" -shared -Wl,-soname,libwps_$(MODEL).so,-olibwps_$(MODEL).so -fPIC $(SOURCES)
-
-clean: clean-$(OS)
-
-clean-w32:
-	$(RM) "libwps_$(MODEL).dll"
-
-clean-linux:
-	$(RM) "libwps_$(MODEL).so"
-
-shared: shared-$(OS)
-
-shared-w32: $(SOURCES)
-	@echo CC [IRIVER_H10_5GB]
-	@$(CC) $(INCLUDE) $(CFLAGS) -DIRIVER_H10_5GB -DTARGET_MODEL=\"h10_5gb\" -DBUILD_DLL -shared $(SOURCES) -o ../gui/bin/libwps_h10_5gb.dll
-
-shared-linux: $(SOURCES)
-	@echo CC [IRIVER_H10_5GB]
-	@$(CC) $(INCLUDE) $(CFLAGS) -DIRIVER_H10_5GB -DTARGET_MODEL=\"h10_5gb\" -shared -Wl,-soname,libwps_h10_5gb.so,-olibwps_h10_5gb.so -fPIC $(SOURCES)
-	@$(COPY) libwps_h10_5gb.so ../gui/bin/libwps_h10_5gb.so
+clean:
+	$(RM) $(RESULTS)
diff --git a/utils/wpseditor/libwps/buildall.bat b/utils/wpseditor/libwps/buildall.bat
deleted file mode 100644
index fb66b41..0000000
--- a/utils/wpseditor/libwps/buildall.bat
+++ /dev/null
@@ -1,4 +0,0 @@
-@echo off
-FOR /F "tokens=1,2* delims=, " %%i in (targets.txt) do @mingw32-make MODEL=%%j TARGET=%%i build 2>nul
-echo Copying files...
-xcopy /I /Y *.dll ..\gui\bin
diff --git a/utils/wpseditor/libwps/buildall.sh b/utils/wpseditor/libwps/buildall.sh
deleted file mode 100755
index 0f32bb9..0000000
--- a/utils/wpseditor/libwps/buildall.sh
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/sh
-cat targets.txt | (
-    while read target model
-    do
-        make MODEL=$model TARGET=$target build
-    done
-    cp *.dll ../gui/bin
-    cp *.so ../gui/bin
-)
diff --git a/utils/wpseditor/libwps/cleanall.sh b/utils/wpseditor/libwps/cleanall.sh
deleted file mode 100644
index 15b733a..0000000
--- a/utils/wpseditor/libwps/cleanall.sh
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/bin/sh
-cat targets.txt | (
-    while read target model
-    do
-        make MODEL=$model TARGET=$target clean
-    done
-)
diff --git a/utils/wpseditor/libwps/src/proxy.c b/utils/wpseditor/libwps/src/proxy.c
index 8f9218e..1e4804c 100644
--- a/utils/wpseditor/libwps/src/proxy.c
+++ b/utils/wpseditor/libwps/src/proxy.c
@@ -23,8 +23,8 @@
 static char pluginbuf[PLUGIN_BUFFER_SIZE];
 
 const char* get_model_name(){
-#ifdef TARGET_MODEL
-    return TARGET_MODEL;
+#ifdef MODEL_NAME
+    return MODEL_NAME;
 #else
     return "unknown";
 #endif
diff --git a/utils/wpseditor/libwps/targets.txt b/utils/wpseditor/libwps/targets.txt
deleted file mode 100644
index 547a2ba..0000000
--- a/utils/wpseditor/libwps/targets.txt
+++ /dev/null
@@ -1,9 +0,0 @@
-IRIVER_H10 h10
-IRIVER_H10_5GB h10_5gb
-IPOD_COLOR ipodcolor
-IPOD_NANO ipodnano
-IPOD_VIDEO ipodvideo
-GIGABEAT_F gigabeatf
-GIGABEAT_S gigabeats
-SANSA_E200 e200
-SANSA_C200 c200
diff --git a/utils/wpseditor/screenshot/Makefile b/utils/wpseditor/screenshot/Makefile
index 18a6de3..f9309f5 100644
--- a/utils/wpseditor/screenshot/Makefile
+++ b/utils/wpseditor/screenshot/Makefile
@@ -8,31 +8,17 @@
 #
 ROOT=../../..
 
-OS = w32
-CC = gcc
-
-ifeq ($(findstring MINGW,$(shell uname)),MINGW)
-OS = w32
-CC = mingw32-gcc
-RM = rm
-endif
-
-ifeq ($(findstring Linux,$(shell uname)),Linux)
-OS = linux
 CC = gcc
 RM = rm -f
-endif
 
+COMMON = main.c gd_bmp.c
 
-
-COMMON= main.c gd_bmp.c
-
-INCLUDE=-I ../libwps/src \
-	    -I $(ROOT)/apps/gui \
-        -I $(ROOT)/firmware/export \
-		-I $(ROOT)/apps/recorder \
-        -I $(ROOT)/apps \
-		-I .
+INCLUDE = -I ../libwps/src \
+          -I $(ROOT)/apps/gui \
+          -I $(ROOT)/firmware/export \
+          -I $(ROOT)/apps/recorder \
+          -I $(ROOT)/apps \
+          -I .
 
 CFLAGS = -g -Wall
 
diff --git a/utils/wpseditor/wpseditor.pro b/utils/wpseditor/wpseditor.pro
index 0e9ecbb..df954ed 100644
--- a/utils/wpseditor/wpseditor.pro
+++ b/utils/wpseditor/wpseditor.pro
@@ -1,2 +1,4 @@
-SUBDIRS =gui/src/QPropertyEditor gui 
 TEMPLATE = subdirs
+SUBDIRS = gui/src/QPropertyEditor gui libwps
+libwps.commands = @$(MAKE) -C libwps
+QMAKE_EXTRA_TARGETS += libwps