diff --git a/acinclude.m4 b/acinclude.m4
index 244d975..82a0b2f 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -157,6 +157,39 @@ else
 	AC_MSG_RESULT(no)
 fi
 
+AC_MSG_CHECKING(whether to build the default header guard plugin)
+header_guard_default="no"
+AC_ARG_ENABLE(header-guard, [AC_HELP_STRING([--enable-header-guard], [build the default header guard plugin (default NO)])],,
+                       enable_header_guard=$header_guard_default)
+AM_CONDITIONAL([BUILD_HEADERGUARD], [test "x$enable_header_guard" = "xyes"])
+if test "x$enable_header_guard" = "xyes"; then
+	AC_MSG_RESULT(yes)
+else
+	AC_MSG_RESULT(no)
+fi
+
+AC_MSG_CHECKING(whether to build the default log hacker plugin)
+log_hacker_default="no"
+AC_ARG_ENABLE(log-hacker, [AC_HELP_STRING([--enable-log-hacker], [build the default log hacker plugin (default NO)])],,
+                       enable_log_hacker=$log_hacker_default)
+AM_CONDITIONAL([BUILD_LOGHACKER], [test "x$enable_log_hacker" = "xyes"])
+if test "x$enable_log_hacker" = "xyes"; then
+	AC_MSG_RESULT(yes)
+else
+	AC_MSG_RESULT(no)
+fi
+
+AC_MSG_CHECKING(whether to build the default ModPoller plugin)
+modpoller_default="no"
+AC_ARG_ENABLE(modpoller, [AC_HELP_STRING([--enable-modpoller], [build the default ModPoller plugin (default NO)])],,
+                       enable_modpoller=$modpoller_default)
+AM_CONDITIONAL([BUILD_MODPOLLER], [test "x$enable_modpoller" = "xyes"])
+if test "x$enable_modpoller" = "xyes"; then
+	AC_MSG_RESULT(yes)
+else
+	AC_MSG_RESULT(no)
+fi
+
 AC_MSG_CHECKING(whether to build the open files list plugin)
 openfiles_default="yes"
 AC_ARG_ENABLE(open-files-list, [AC_HELP_STRING([--enable-open-files-list], [build the open files list plugin (default YES)])],,
@@ -190,6 +223,17 @@ else
 	AC_MSG_RESULT(no)
 fi
 
+AC_MSG_CHECKING(whether to build the default Tidycmt plugin)
+tidycmt_default="no"
+AC_ARG_ENABLE(tidycmt, [AC_HELP_STRING([--enable-tidycmt], [build the default Tidycmt plugin (default NO)])],,
+                       enable_tidycmt=$tidycmt_default)
+AM_CONDITIONAL([BUILD_TIDYCMT], [test "x$enable_tidycmt" = "xyes"])
+if test "x$enable_tidycmt" = "xyes"; then
+	AC_MSG_RESULT(yes)
+else
+	AC_MSG_RESULT(no)
+fi
+
 AC_MSG_CHECKING(whether to build the to-do plugin)
 todo_default="yes"
 AC_ARG_ENABLE(todo, [AC_HELP_STRING([--enable-todo], [build the to-do plugin (default YES)])],,
@@ -263,6 +307,7 @@ AC_DEFUN([BUILD_CONTRIB_NONE], [
 	AM_CONDITIONAL([BUILD_COPYSTRINGS], [false])
 	AM_CONDITIONAL([BUILD_CSCOPE], [false])
 	AM_CONDITIONAL([BUILD_DOXYBLOCKS], [false])
+	AM_CONDITIONAL([BUILD_DEVPAKUPDATER], [false])
 	AM_CONDITIONAL([BUILD_DRAGSCROLL], [false])
 	AM_CONDITIONAL([BUILD_EDITORCONFIG], [false])
 	AM_CONDITIONAL([BUILD_EDITORTWEAKS], [false])
@@ -304,6 +349,7 @@ AC_DEFUN([BUILD_CONTRIB_ALL], [
 	AM_CONDITIONAL([BUILD_COPYSTRINGS], [true])
 	AM_CONDITIONAL([BUILD_CSCOPE], [true])
 	AM_CONDITIONAL([BUILD_DOXYBLOCKS], [true])
+	AM_CONDITIONAL([BUILD_DEVPAKUPDATER], [true])
 	AM_CONDITIONAL([BUILD_DRAGSCROLL], [true])
 	AM_CONDITIONAL([BUILD_EDITORCONFIG], [true])
 	AM_CONDITIONAL([BUILD_EDITORTWEAKS], [true])
@@ -346,7 +392,7 @@ AC_ARG_WITH(contrib-plugins,
   [                        "all,-help" compiles all contrib plugins except the help plugin ]
   [                        By default, no contrib plugins are compiled ]
   [                        Plugin names are: AutoVersioning, BrowseTracker,byogames,Cccc,CppCheck,cbkoders,codesnippets, ]
-  [                        		     codestat, copystrings, Cscope, DoxyBlocks, dragscroll, EditorConfig, EditorTweaks, envvars, ]
+  [                        		     codestat, copystrings, Cscope, DoxyBlocks, devpakupdater, dragscroll, EditorConfig, EditorTweaks, envvars, ]
   [                        		     FileManager, headerfixup, help, hexeditor, incsearch, keybinder, libfinder, MouseSap, ]
   [                        		     NassiShneiderman, profiler, regex, ReopenEditor, exporter, smartindent, spellchecker, symtab, ]
   [                        		     ThreadSearch, ToolsPlus, Valgrind, wxcontrib, wxsmith, wxsmithcontrib, wxsmithaui ],
@@ -386,6 +432,9 @@ do
 	DoxyBlocks)
 		AM_CONDITIONAL([BUILD_DOXYBLOCKS], [true])
 		;;
+	devpakupdater)
+		AM_CONDITIONAL([BUILD_DEVPAKUPDATER], [true])
+		;;
 	dragscroll)
 		AM_CONDITIONAL([BUILD_DRAGSCROLL], [true])
 		;;
@@ -500,6 +549,9 @@ do
 	-DoxyBlocks)
 		AM_CONDITIONAL([BUILD_DOXYBLOCKS], [false])
 		;;
+	-devpakupdater)
+		AM_CONDITIONAL([BUILD_DEVPAKUPDATER], [false])
+		;;
 	-dragscroll)
 		AM_CONDITIONAL([BUILD_DRAGSCROLL], [false])
 		;;
@@ -606,6 +658,7 @@ AC_SUBST(BUILD_COPYSTRINGS)
 AC_SUBST(BUILD_CPPCHECK)
 AC_SUBST(BUILD_CSCOPE)
 AC_SUBST(BUILD_DOXYBLOCKS)
+AC_SUBST(BUILD_DEVPAKUPDATER)
 AC_SUBST(BUILD_DRAGSCROLL)
 AC_SUBST(BUILD_EDITORCONFIG)
 AC_SUBST(BUILD_EDITORTWEAKS)
diff --git a/configure.in b/configure.in
index d87be4e..3d8a2af 100644
--- a/configure.in
+++ b/configure.in
@@ -38,11 +38,15 @@ AC_C_INLINE
 AC_TYPE_SIZE_T
 AC_HEADER_TIME
 AC_C_VOLATILE
+LT_PROG_RC
+
+AC_CYGWIN
+AC_MINGW32
+AC_EXEEXT
+AC_OBJEXT
 
 dnl Checks for library functions.
 AC_FUNC_CLOSEDIR_VOID
-AC_FUNC_MALLOC
-AC_FUNC_MEMCMP
 AC_FUNC_STAT
 AC_FUNC_VPRINTF
 AC_CHECK_FUNCS([atexit getcwd isascii memchr memmove memset strcasecmp strchr strcspn strdup strrchr strstr])
@@ -199,6 +203,41 @@ case $WX_BASENAME in
     ;;
     *wx_msw*)
         AC_MSG_RESULT(wxMSW)
+		dnl
+		dnl pkg-config no longer needed by debugger plugin
+		dnl but is needed by others
+		dnl
+		dnl only do this if it is really needed
+		dnl AM_CONDITIONAL adds _TRUE and _FALSE to the appropriate variables
+		dnl if the condition is true, the *_TRUE variable is empty (!)
+		if test "x$BUILD_SPELLCHECKER_TRUE" = "x" ; then
+
+			AC_CHECK_PROG(HAVE_PKG_CONFIG, pkg-config, yes, no)
+
+			ifdef([PKG_CHECK_MODULES],[],[
+				define([PKG_CHECK_MODULES],
+				[ echo "You don't have pkg.m4 properly installed" >&2
+					exit 1
+				])
+			])
+
+            dnl acoording to pkg-config's manpage this call is bsolutely needed:
+            dnl
+            dnl "Note that if there is a possibility the first call to
+            dnl PKG_CHECK_MODULES might not happen, you should be sure
+            dnl to include an explicit call to PKG_PROG_PKG_CONFIG"
+			PKG_PROG_PKG_CONFIG
+
+			if test "x$BUILD_SPELLCHECKER_TRUE" = "x" ; then
+				if test "x$HAVE_PKG_CONFIG" = "xyes"; then
+					PKG_CHECK_MODULES([HUNSPELL], [hunspell])
+				fi
+			fi
+
+    	fi
+
+		CB_HUNSPELL_CFLAGS="$HUNSPELL_CFLAGS"
+		CB_HUNSPELL_LIBS="$HUNSPELL_LIBS"
     ;;
     *wx_mac*)
         AC_MSG_RESULT(wxMac)
@@ -280,12 +319,27 @@ CPPFLAGS="$CPPFLAGS -Ulinux -Uunix"
 CXXFLAGS="$CXXFLAGS $PCH_FLAGS $PIC_FLAGS -fexceptions"
 AC_SUBST(codeblocks_PCH_FLAGS, "$PCH_FLAGS")
 
+AC_CHECK_LIB([gdi32],[main],[WIN32_GDI="-lgdi32"],[WIN32_GDI=""])
+AC_CHECK_LIB([shfolder],[main],[WIN32_SHFOLDER="-lshfolder"],[WIN32_SHFOLDER=""])
+WIN32_DLLLDFLAGS=""
+WIN32_DLLEXPSTDCALL=""
+if test x$CYGWIN = xyes -o x$MINGW32 = xyes; then
+   WIN32_DLLLDFLAGS="-Wl,--enable-auto-image-base -Wl,--export-all-symbols -Wl,--enable-auto-import"
+   WIN32_DLLEXPSTDCALL="-Wl,--add-stdcall-alias"
+fi
+AC_SUBST(WIN32_GDI)
+AC_SUBST(WIN32_SHFOLDER)
+AC_SUBST(WIN32_DLLLDFLAGS)
+AC_SUBST(WIN32_DLLEXPSTDCALL)
+
 dnl AM_PATH_GTK(1.2.7, ,
 dnl             AC_MSG_ERROR(Cannot find GTK: Is gtk-config in path?),
 dnl             gthread)
 
 AM_CONDITIONAL([LINUX], [test `uname` = "Linux"])
 AM_CONDITIONAL([DARWIN], [test `uname` = "Darwin"])
+AM_CONDITIONAL([CROSSCOMP], [test x$cross_compiling = xyes])
+AM_CONDITIONAL([WIN32], [test x$CYGWIN = xyes -o x$MINGW32 = xyes])
 
 AC_MSG_NOTICE([Configuring Code::Blocks...])
 AC_MSG_NOTICE(SVN revision SVN_REVISION (SVN_DATE))
@@ -339,6 +393,9 @@ AC_CONFIG_FILES([Makefile
 	src/plugins/debuggergdb/resources/Makefile
 	src/plugins/defaultmimehandler/Makefile
 	src/plugins/defaultmimehandler/resources/Makefile
+	src/plugins/headerguard/Makefile
+	src/plugins/loghacker/Makefile
+	src/plugins/modpoller/Makefile
 	src/plugins/openfileslist/Makefile
 	src/plugins/projectsimporter/Makefile
 	src/plugins/projectsimporter/resources/Makefile
@@ -361,6 +418,7 @@ AC_CONFIG_FILES([Makefile
 	src/plugins/scriptedwizard/resources/h_file/Makefile
 	src/plugins/scriptedwizard/resources/irrlicht/Makefile
 	src/plugins/scriptedwizard/resources/lf/Makefile
+	src/plugins/scriptedwizard/resources/mcs51/Makefile
 	src/plugins/scriptedwizard/resources/matlab_csf/Makefile
 	src/plugins/scriptedwizard/resources/matlab_csf/files/Makefile
 	src/plugins/scriptedwizard/resources/matlab_csf/lccstub/Makefile
@@ -391,6 +449,7 @@ AC_CONFIG_FILES([Makefile
 	src/plugins/scriptedwizard/resources/tricore/Makefile
 	src/plugins/scriptedwizard/resources/win32gui/Makefile
 	src/plugins/scriptedwizard/resources/wxwidgets/Makefile
+	src/plugins/tidycmt/Makefile
 	src/plugins/todo/Makefile
 	src/plugins/todo/resources/Makefile
 	src/plugins/abbreviations/Makefile
diff --git a/src/Makefile.am b/src/Makefile.am
index 776b136..efde3b4 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -4,6 +4,7 @@ dist_pkgdata_DATA = tips.txt
 
 EXTRA_DIST = CodeBlocks.cbp \
 		CodeBlocks-unix.cbp \
+		CodeBlocks-cross.cbp \
 		ContribPlugins.workspace \
 		ContribPlugins-unix.workspace \
 		exchndl.dll \
diff --git a/src/base/tinyxml/Makefile.am b/src/base/tinyxml/Makefile.am
index bc3e89d..3b6ae29 100644
--- a/src/base/tinyxml/Makefile.am
+++ b/src/base/tinyxml/Makefile.am
@@ -1,8 +1,12 @@
-INCLUDES = $(WX_CXXFLAGS) \
-				-I$(top_srcdir)/src/sdk/wxscintilla/include \
+INCLUDES = -I$(top_srcdir)/src/sdk/wxscintilla/include \
 				-I$(top_srcdir)/src/include \
 				-I$(top_srcdir)/src/include/tinyxml
 
+AM_CFLAGS = $(WX_CFLAGS)
+AM_CPPFLAGS = $(WX_CPPFLAGS) -DEXPORT_LIB -DEXPORT_EVENTS -DWXMAKINGDLL_SCI
+AM_CXXFLAGS = $(WX_CXXFLAGS)
+AM_LDFLAGS = $(WX_LIBS)
+
 noinst_LTLIBRARIES = libtinyxml.la
 
 libtinyxml_la_SOURCES = tinystr.cpp tinyxml.cpp tinyxmlerror.cpp tinyxmlparser.cpp tinywxuni.cpp
diff --git a/src/build_tools/autorevision/Makefile.am b/src/build_tools/autorevision/Makefile.am
index db54806..e7ac19a 100644
--- a/src/build_tools/autorevision/Makefile.am
+++ b/src/build_tools/autorevision/Makefile.am
@@ -5,5 +5,12 @@ INCLUDES = -I$(top_srcdir)/src/include
 
 auto_revision_LDADD = ../../base/tinyxml/libtinyxml.la
 
-all-local: auto_revision
-	./auto_revision +int +wx +t $(top_srcdir) $(top_builddir)/src/include/autorevision.h
+if CROSSCOMP
+all-local:
+
+else
+
+all-local: auto_revision$(EXEEXT)
+	./auto_revision$(EXEEXT) +int +wx +t $(top_srcdir) $(top_builddir)/src/include/autorevision.h
+
+endif
diff --git a/src/include/Makefile.am b/src/include/Makefile.am
index c8245a9..f443a4a 100644
--- a/src/include/Makefile.am
+++ b/src/include/Makefile.am
@@ -12,7 +12,7 @@ INCLUDES = $(WX_CXXFLAGS) \
 			-I$(top_srcdir)/src/sdk/wxscintilla/include \
 			-I$(top_srcdir)/src/include/tinyxml \
 			-I$(top_srcdir)/src/include/scripting/include \
- 			-I$(top_srcdir)/src/include/scripting/sqplus \
+			-I$(top_srcdir)/src/include/scripting/sqplus \
 			-I$(top_srcdir)/src/include/mozilla_chardet \
 			-I$(top_srcdir)/src/include/mozilla_chardet/mfbt \
 			-I$(top_srcdir)/src/include/mozilla_chardet/nsprpub/pr/include \
@@ -30,6 +30,7 @@ sdkdir=$(includedir)/codeblocks
 
 ALLHEADERS = annoyingdialog.h \
 				autodetectcompilers.h \
+				autorevision.h \
 				backgroundthread.h \
 				base64.h \
 				blockallocated.h \
@@ -38,6 +39,7 @@ ALLHEADERS = annoyingdialog.h \
 				cbeditor.h \
 				cbeditorprintout.h \
 				cbexception.h \
+				cbexecute.h \
 				cbfunctor.h \
 				cbplugin.h \
 				cbproject.h \
diff --git a/src/plugins/Makefile.am b/src/plugins/Makefile.am
index 53a0291..95d2028 100644
--- a/src/plugins/Makefile.am
+++ b/src/plugins/Makefile.am
@@ -26,6 +26,18 @@ if BUILD_MIMEHANDLER
 MAYBE_MIMEHANDLER=defaultmimehandler
 endif
 
+if BUILD_HEADERGUARD
+MAYBE_HEADERGUARD=headerguard
+endif
+
+if BUILD_LOGHACKER
+MAYBE_LOGHACKER=loghacker
+endif
+
+if BUILD_MODPOLLER
+MAYBE_MODPOLLER=modpoller
+endif
+
 if BUILD_OPENFILESLIST
 MAYBE_OPENFILESLIST=openfileslist
 endif
@@ -38,6 +50,10 @@ if BUILD_SCRIPTEDWIZARD
 MAYBE_SCRIPTEDWIZARD=scriptedwizard
 endif
 
+if BUILD_TIDYCMT
+MAYBE_TIDYCMT=tidycmt
+endif
+
 if BUILD_TODO
 MAYBE_TODO=todo
 endif
@@ -57,9 +73,13 @@ SUBDIRS=$(MAYBE_ASTYLE) \
 		$(MAYBE_COMPILER) \
 		$(MAYBE_DEBUGGER) \
 		$(MAYBE_MIMEHANDLER) \
+		$(MAYBE_HEADERGUARD) \
+		$(MAYBE_LOGHACKER) \
+		$(MAYBE_MODPOLLER) \
 		$(MAYBE_SCRIPTEDWIZARD) \
 		$(MAYBE_PROJECTSIMPORTER) \
 		$(MAYBE_OPENFILESLIST) \
+		$(MAYBE_TIDYCMT) \
 		$(MAYBE_TODO) \
 		$(MAYBE_ABBREVIATIONS) \
 		$(MAYBE_MANIFEST) \
@@ -74,9 +94,13 @@ DIST_SUBDIRS = abbreviations \
 		compilergcc \
 		debuggergdb \
 		defaultmimehandler \
+		headerguard \
+		loghacker \
+		modpoller \
 		openfileslist \
 		projectsimporter \
 		scriptedwizard \
+		tidycmt \
 		todo \
 		xpmanifest \
 		contrib
diff --git a/src/plugins/abbreviations/Makefile.am b/src/plugins/abbreviations/Makefile.am
index 0cc25a0..dab2cef 100644
--- a/src/plugins/abbreviations/Makefile.am
+++ b/src/plugins/abbreviations/Makefile.am
@@ -1,13 +1,17 @@
 SUBDIRS = resources
 
-INCLUDES = $(WX_CXXFLAGS) \
-		-I$(top_srcdir)/src/include \
+INCLUDES = -I$(top_srcdir)/src/include \
 		-I$(top_srcdir)/src/sdk/wxscintilla/include \
 		-I$(top_srcdir)/src/include/scripting/include \
 		-I$(top_srcdir)/src/include/scripting/sqplus \
 		-I$(top_srcdir)/src/include/scripting/bindings
 
 
+AM_CFLAGS = $(WX_CFLAGS)
+AM_CPPFLAGS = $(WX_CPPFLAGS) -DBUILDING_PLUGIN
+AM_CXXFLAGS = $(WX_CXXFLAGS)
+AM_LDFLAGS = $(WX_LIBS) @WIN32_DLLLDFLAGS@ @WIN32_DLLEXPSTDCALL@
+
 pluginlibdir = $(pkglibdir)/plugins
 
 pluginlib_LTLIBRARIES = libabbreviations.la
diff --git a/src/plugins/astyle/Makefile.am b/src/plugins/astyle/Makefile.am
index 08e6ddf..ec2a3d0 100644
--- a/src/plugins/astyle/Makefile.am
+++ b/src/plugins/astyle/Makefile.am
@@ -1,10 +1,14 @@
 SUBDIRS = resources
 
-INCLUDES = $(WX_CXXFLAGS) \
-           -I$(top_srcdir)/src/plugins/astyle/astyle \
+INCLUDES = -I$(top_srcdir)/src/plugins/astyle/astyle \
            -I$(top_srcdir)/src/include \
            -I$(top_srcdir)/src/sdk/wxscintilla/include
 
+AM_CFLAGS = $(WX_CFLAGS)
+AM_CPPFLAGS = $(WX_CPPFLAGS) -DBUILDING_PLUGIN
+AM_CXXFLAGS = $(WX_CXXFLAGS)
+AM_LDFLAGS = $(WX_LIBS) @WIN32_DLLLDFLAGS@ @WIN32_DLLEXPSTDCALL@
+
 pluginlibdir = $(pkglibdir)/plugins
 
 pluginlib_LTLIBRARIES = libastyle.la
diff --git a/src/plugins/autosave/Makefile.am b/src/plugins/autosave/Makefile.am
index 2ee7459..1bd8563 100644
--- a/src/plugins/autosave/Makefile.am
+++ b/src/plugins/autosave/Makefile.am
@@ -1,7 +1,11 @@
-INCLUDES = $(WX_CXXFLAGS) \
-		-I$(top_srcdir)/src/include \
+INCLUDES = -I$(top_srcdir)/src/include \
 		-I$(top_srcdir)/src/sdk/wxscintilla/include
 
+AM_CFLAGS = $(WX_CFLAGS)
+AM_CPPFLAGS = $(WX_CPPFLAGS) -DBUILDING_PLUGIN
+AM_CXXFLAGS = $(WX_CXXFLAGS)
+AM_LDFLAGS = $(WX_LIBS) @WIN32_DLLLDFLAGS@ @WIN32_DLLEXPSTDCALL@
+
 pluginlibdir = $(pkglibdir)/plugins
 
 pluginlib_LTLIBRARIES = libautosave.la
diff --git a/src/plugins/classwizard/Makefile.am b/src/plugins/classwizard/Makefile.am
index 4e9db93..57e8255 100644
--- a/src/plugins/classwizard/Makefile.am
+++ b/src/plugins/classwizard/Makefile.am
@@ -1,9 +1,13 @@
 SUBDIRS = resources
 
-INCLUDES = $(WX_CXXFLAGS) \
-		-I$(top_srcdir)/src/include \
+INCLUDES = -I$(top_srcdir)/src/include \
 		-I$(top_srcdir)/src/sdk/wxscintilla/include
 
+AM_CFLAGS = $(WX_CFLAGS)
+AM_CPPFLAGS = $(WX_CPPFLAGS) -DBUILDING_PLUGIN
+AM_CXXFLAGS = $(WX_CXXFLAGS)
+AM_LDFLAGS = $(WX_LIBS) @WIN32_DLLLDFLAGS@ @WIN32_DLLEXPSTDCALL@
+
 pluginlibdir = $(pkglibdir)/plugins
 
 pluginlib_LTLIBRARIES = libclasswizard.la
diff --git a/src/plugins/codecompletion/Makefile.am b/src/plugins/codecompletion/Makefile.am
index d161c7b..cf3a6d5 100644
--- a/src/plugins/codecompletion/Makefile.am
+++ b/src/plugins/codecompletion/Makefile.am
@@ -1,7 +1,6 @@
 SUBDIRS = resources
 
-INCLUDES = $(WX_CXXFLAGS) \
-		-I$(top_srcdir)/src/include \
+INCLUDES = -I$(top_srcdir)/src/include \
 		-I$(top_srcdir)/src/sdk/wxscintilla/include \
 			-I$(top_srcdir)/src/include/mozilla_chardet \
 			-I$(top_srcdir)/src/include/mozilla_chardet/mfbt \
@@ -10,6 +9,11 @@ INCLUDES = $(WX_CXXFLAGS) \
 			-I$(top_srcdir)/src/include/mozilla_chardet/xpcom/base \
 			-I$(top_srcdir)/src/include/mozilla_chardet/xpcom/glue
 
+AM_CFLAGS = $(WX_CFLAGS)
+AM_CPPFLAGS = $(WX_CPPFLAGS) -DBUILDING_PLUGIN
+AM_CXXFLAGS = $(WX_CXXFLAGS)
+AM_LDFLAGS = $(WX_LIBS) @WIN32_DLLLDFLAGS@ @WIN32_DLLEXPSTDCALL@
+
 pluginlibdir = $(pkglibdir)/plugins
 
 pluginlib_LTLIBRARIES = libcodecompletion.la
diff --git a/src/plugins/compilergcc/Makefile.am b/src/plugins/compilergcc/Makefile.am
index 7879221..5c00971 100644
--- a/src/plugins/compilergcc/Makefile.am
+++ b/src/plugins/compilergcc/Makefile.am
@@ -1,13 +1,15 @@
 SUBDIRS = depslib resources
 
-INCLUDES = $(WX_CXXFLAGS) \
-		-I$(top_srcdir)/src/include \
+INCLUDES = -I$(top_srcdir)/src/include \
 		-I$(top_srcdir)/src/sdk/wxscintilla/include \
 		-I$(top_srcdir)/src/include/scripting/include \
 		-I$(top_srcdir)/src/include/scripting/sqplus \
 		-I$(top_srcdir)/src/plugins/compilergcc/depslib/src
 
-AM_CXXFLAGS = -DDEPSLIB_UNIX
+AM_CFLAGS = $(WX_CFLAGS)
+AM_CPPFLAGS = $(WX_CPPFLAGS) -DBUILDING_PLUGIN
+AM_CXXFLAGS = $(WX_CXXFLAGS) -DDEPSLIB_UNIX
+AM_LDFLAGS = $(WX_LIBS) @WIN32_DLLLDFLAGS@ @WIN32_DLLEXPSTDCALL@
 
 pluginlibdir = $(pkglibdir)/plugins
 
diff --git a/src/plugins/compilergcc/depslib/src/Makefile.am b/src/plugins/compilergcc/depslib/src/Makefile.am
index 57f0791..da7d0b8 100644
--- a/src/plugins/compilergcc/depslib/src/Makefile.am
+++ b/src/plugins/compilergcc/depslib/src/Makefile.am
@@ -1,4 +1,8 @@
+if WIN32
+AM_CFLAGS = -Wall -g -DDEPSLIB_WINDOWS -fno-strict-aliasing
+else
 AM_CFLAGS = -Wall -g -DDEPSLIB_UNIX -fno-strict-aliasing
+endif
 
 noinst_LTLIBRARIES = libdepslib.la
 
diff --git a/src/plugins/contrib/AutoVersioning/Makefile.am b/src/plugins/contrib/AutoVersioning/Makefile.am
index 36a8072..7f14c10 100644
--- a/src/plugins/contrib/AutoVersioning/Makefile.am
+++ b/src/plugins/contrib/AutoVersioning/Makefile.am
@@ -1,7 +1,11 @@
-INCLUDES = $(WX_CXXFLAGS) \
-		-I$(top_srcdir)/src/include \
+INCLUDES = -I$(top_srcdir)/src/include \
 		-I$(top_srcdir)/src/sdk/wxscintilla/include
 
+AM_CFLAGS = $(WX_CFLAGS)
+AM_CPPFLAGS = $(WX_CPPFLAGS) -DBUILDING_PLUGIN
+AM_CXXFLAGS = $(WX_CXXFLAGS)
+AM_LDFLAGS = $(WX_LIBS) @WIN32_DLLLDFLAGS@ @WIN32_DLLEXPSTDCALL@
+
 pluginlibdir = $(pkglibdir)/plugins
 
 pluginlib_LTLIBRARIES = libAutoVersioning.la
diff --git a/src/plugins/contrib/BrowseTracker/Makefile.am b/src/plugins/contrib/BrowseTracker/Makefile.am
index eba1b90..9c70a3f 100644
--- a/src/plugins/contrib/BrowseTracker/Makefile.am
+++ b/src/plugins/contrib/BrowseTracker/Makefile.am
@@ -1,7 +1,11 @@
-INCLUDES = $(WX_CXXFLAGS) \
-		-I$(top_srcdir)/src/include \
+INCLUDES = -I$(top_srcdir)/src/include \
 		-I$(top_srcdir)/src/sdk/wxscintilla/include
 
+AM_CFLAGS = $(WX_CFLAGS)
+AM_CPPFLAGS = $(WX_CPPFLAGS) -DBUILDING_PLUGIN
+AM_CXXFLAGS = $(WX_CXXFLAGS)
+AM_LDFLAGS = $(WX_LIBS) @WIN32_DLLLDFLAGS@ @WIN32_DLLEXPSTDCALL@
+
 pluginlibdir = $(pkglibdir)/plugins
 
 pluginlib_LTLIBRARIES = libBrowseTracker.la
diff --git a/src/plugins/contrib/Cccc/Makefile.am b/src/plugins/contrib/Cccc/Makefile.am
index 2b5183c..3dd71c5 100644
--- a/src/plugins/contrib/Cccc/Makefile.am
+++ b/src/plugins/contrib/Cccc/Makefile.am
@@ -1,9 +1,13 @@
 SUBDIRS = resources
 
-INCLUDES = $(WX_CXXFLAGS) \
-		-I$(top_srcdir)/src/include \
+INCLUDES = -I$(top_srcdir)/src/include \
 		-I$(top_srcdir)/src/sdk/wxscintilla/include
 
+AM_CFLAGS = $(WX_CFLAGS)
+AM_CPPFLAGS = $(WX_CPPFLAGS) -DBUILDING_PLUGIN
+AM_CXXFLAGS = $(WX_CXXFLAGS)
+AM_LDFLAGS = $(WX_LIBS) @WIN32_DLLLDFLAGS@ @WIN32_DLLEXPSTDCALL@
+
 pluginlibdir = $(pkglibdir)/plugins
 
 pluginlib_LTLIBRARIES = libCccc.la
diff --git a/src/plugins/contrib/CppCheck/Makefile.am b/src/plugins/contrib/CppCheck/Makefile.am
index 7ffdea8..d063098 100644
--- a/src/plugins/contrib/CppCheck/Makefile.am
+++ b/src/plugins/contrib/CppCheck/Makefile.am
@@ -1,9 +1,13 @@
 SUBDIRS = resources
 
-INCLUDES = $(WX_CXXFLAGS) \
-		-I$(top_srcdir)/src/include \
+INCLUDES = -I$(top_srcdir)/src/include \
 		-I$(top_srcdir)/src/sdk/wxscintilla/include
 
+AM_CFLAGS = $(WX_CFLAGS)
+AM_CPPFLAGS = $(WX_CPPFLAGS) -DBUILDING_PLUGIN
+AM_CXXFLAGS = $(WX_CXXFLAGS)
+AM_LDFLAGS = $(WX_LIBS) @WIN32_DLLLDFLAGS@ @WIN32_DLLEXPSTDCALL@
+
 pluginlibdir = $(pkglibdir)/plugins
 
 pluginlib_LTLIBRARIES = libCppCheck.la
diff --git a/src/plugins/contrib/Cscope/Makefile.am b/src/plugins/contrib/Cscope/Makefile.am
index b087baf..288ae08 100644
--- a/src/plugins/contrib/Cscope/Makefile.am
+++ b/src/plugins/contrib/Cscope/Makefile.am
@@ -1,7 +1,11 @@
-INCLUDES = $(WX_CXXFLAGS) \
-		-I$(top_srcdir)/src/include \
+INCLUDES = -I$(top_srcdir)/src/include \
 		-I$(top_srcdir)/src/sdk/wxscintilla/include
 
+AM_CFLAGS = $(WX_CFLAGS)
+AM_CPPFLAGS = $(WX_CPPFLAGS) -DBUILDING_PLUGIN
+AM_CXXFLAGS = $(WX_CXXFLAGS)
+AM_LDFLAGS = $(WX_LIBS) @WIN32_DLLLDFLAGS@ @WIN32_DLLEXPSTDCALL@
+
 pluginlibdir = $(pkglibdir)/plugins
 
 pluginlib_LTLIBRARIES = libCscope.la
diff --git a/src/plugins/contrib/DoxyBlocks/Makefile.am b/src/plugins/contrib/DoxyBlocks/Makefile.am
index f6f024b..8124194 100644
--- a/src/plugins/contrib/DoxyBlocks/Makefile.am
+++ b/src/plugins/contrib/DoxyBlocks/Makefile.am
@@ -1,9 +1,13 @@
 SUBDIRS = images
 
-INCLUDES = $(WX_CXXFLAGS) \
-		-I$(top_srcdir)/src/include \
+INCLUDES = -I$(top_srcdir)/src/include \
 		-I$(top_srcdir)/src/sdk/wxscintilla/include
 
+AM_CFLAGS = $(WX_CFLAGS)
+AM_CPPFLAGS = $(WX_CPPFLAGS) -DBUILDING_PLUGIN
+AM_CXXFLAGS = $(WX_CXXFLAGS)
+AM_LDFLAGS = $(WX_LIBS) @WIN32_DLLLDFLAGS@ @WIN32_DLLEXPSTDCALL@
+
 pluginlibdir = $(pkglibdir)/plugins
 
 pluginlib_LTLIBRARIES = libDoxyBlocks.la
diff --git a/src/plugins/contrib/EditorConfig/Makefile.am b/src/plugins/contrib/EditorConfig/Makefile.am
index 352466e..beab41f 100644
--- a/src/plugins/contrib/EditorConfig/Makefile.am
+++ b/src/plugins/contrib/EditorConfig/Makefile.am
@@ -1,7 +1,11 @@
-INCLUDES = $(WX_CXXFLAGS) \
-		-I$(top_srcdir)/src/include \
+INCLUDES = -I$(top_srcdir)/src/include \
 		-I$(top_srcdir)/src/sdk/wxscintilla/include
 
+AM_CFLAGS = $(WX_CFLAGS)
+AM_CPPFLAGS = $(WX_CPPFLAGS) -DBUILDING_PLUGIN
+AM_CXXFLAGS = $(WX_CXXFLAGS)
+AM_LDFLAGS = $(WX_LIBS) @WIN32_DLLLDFLAGS@ @WIN32_DLLEXPSTDCALL@
+
 pluginlibdir = $(pkglibdir)/plugins
 
 pluginlib_LTLIBRARIES = libEditorConfig.la
diff --git a/src/plugins/contrib/EditorTweaks/Makefile.am b/src/plugins/contrib/EditorTweaks/Makefile.am
index 5dc0e92..af491ea 100644
--- a/src/plugins/contrib/EditorTweaks/Makefile.am
+++ b/src/plugins/contrib/EditorTweaks/Makefile.am
@@ -1,7 +1,11 @@
-INCLUDES = $(WX_CXXFLAGS) \
-		-I$(top_srcdir)/src/include \
+INCLUDES = -I$(top_srcdir)/src/include \
 		-I$(top_srcdir)/src/sdk/wxscintilla/include
 
+AM_CFLAGS = $(WX_CFLAGS)
+AM_CPPFLAGS = $(WX_CPPFLAGS) -DBUILDING_PLUGIN
+AM_CXXFLAGS = $(WX_CXXFLAGS)
+AM_LDFLAGS = $(WX_LIBS) @WIN32_DLLLDFLAGS@ @WIN32_DLLEXPSTDCALL@
+
 pluginlibdir = $(pkglibdir)/plugins
 
 pluginlib_LTLIBRARIES = libEditorTweaks.la
diff --git a/src/plugins/contrib/FileManager/Makefile.am b/src/plugins/contrib/FileManager/Makefile.am
index 07923e3..44e0c5b 100644
--- a/src/plugins/contrib/FileManager/Makefile.am
+++ b/src/plugins/contrib/FileManager/Makefile.am
@@ -1,5 +1,4 @@
-INCLUDES = $(WX_CXXFLAGS) \
-		$(CB_GAMIN_CFLAGS) \
+INCLUDES = $(CB_GAMIN_CFLAGS) \
 		-I$(top_srcdir)/src/include \
 		-I$(top_srcdir)/src/sdk/wxscintilla/include \
 		-I$(top_srcdir)/src/include/mozilla_chardet \
@@ -9,7 +8,10 @@ INCLUDES = $(WX_CXXFLAGS) \
 		-I$(top_srcdir)/src/include/mozilla_chardet/xpcom/base \
 		-I$(top_srcdir)/src/include/mozilla_chardet/xpcom/glue
 
-CXXFLAGS = @CXXFLAGS@ -D__FAM__
+AM_CFLAGS = $(WX_CFLAGS) -D__FAM__
+AM_CPPFLAGS = $(WX_CPPFLAGS) -DBUILDING_PLUGIN
+AM_CXXFLAGS = $(WX_CXXFLAGS) -D__FAM__
+AM_LDFLAGS = $(WX_LIBS) @WIN32_DLLLDFLAGS@ @WIN32_DLLEXPSTDCALL@
 
 pluginlibdir = $(pkglibdir)/plugins
 
diff --git a/src/plugins/contrib/HexEditor/Makefile.am b/src/plugins/contrib/HexEditor/Makefile.am
index 1d30d9b..c0583db 100644
--- a/src/plugins/contrib/HexEditor/Makefile.am
+++ b/src/plugins/contrib/HexEditor/Makefile.am
@@ -1,7 +1,11 @@
-INCLUDES = $(WX_CXXFLAGS) \
-		-I$(top_srcdir)/src/include \
+INCLUDES = -I$(top_srcdir)/src/include \
 		-I$(top_srcdir)/src/sdk/wxscintilla/include
 
+AM_CFLAGS = $(WX_CFLAGS)
+AM_CPPFLAGS = $(WX_CPPFLAGS) -DBUILDING_PLUGIN
+AM_CXXFLAGS = $(WX_CXXFLAGS)
+AM_LDFLAGS = $(WX_LIBS) @WIN32_DLLLDFLAGS@ @WIN32_DLLEXPSTDCALL@
+
 pluginlibdir = $(pkglibdir)/plugins
 
 pluginlib_LTLIBRARIES = libHexEditor.la
diff --git a/src/plugins/contrib/IncrementalSearch/Makefile.am b/src/plugins/contrib/IncrementalSearch/Makefile.am
index 7bcf62a..098d5d1 100644
--- a/src/plugins/contrib/IncrementalSearch/Makefile.am
+++ b/src/plugins/contrib/IncrementalSearch/Makefile.am
@@ -1,7 +1,11 @@
-INCLUDES = $(WX_CXXFLAGS) \
-		-I$(top_srcdir)/src/include \
+INCLUDES = -I$(top_srcdir)/src/include \
 		-I$(top_srcdir)/src/sdk/wxscintilla/include
 
+AM_CFLAGS = $(WX_CFLAGS)
+AM_CPPFLAGS = $(WX_CPPFLAGS) -DBUILDING_PLUGIN
+AM_CXXFLAGS = $(WX_CXXFLAGS)
+AM_LDFLAGS = $(WX_LIBS) @WIN32_DLLLDFLAGS@ @WIN32_DLLEXPSTDCALL@
+
 pluginlibdir = $(pkglibdir)/plugins
 
 pluginlib_LTLIBRARIES = libIncrementalSearch.la
diff --git a/src/plugins/contrib/Makefile.am b/src/plugins/contrib/Makefile.am
index e04ce04..84fd596 100644
--- a/src/plugins/contrib/Makefile.am
+++ b/src/plugins/contrib/Makefile.am
@@ -34,6 +34,10 @@ if BUILD_DOXYBLOCKS
 MAYBE_DOXYBLOCKS=DoxyBlocks
 endif
 
+if BUILD_DEVPAKUPDATER
+MAYBE_DEVPAKUPDATER=devpak_plugin
+endif
+
 if BUILD_DRAGSCROLL
 MAYBE_DRAGSCROLL=dragscroll
 endif
@@ -161,6 +165,7 @@ SUBDIRS = $(MAYBE_AUTOVERSIONING) \
 		$(MAYBE_CPPCHECK) \
 		$(MAYBE_CSCOPE) \
 		$(MAYBE_DOXYBLOCKS) \
+		$(MAYBE_DEVPAKUPDATER) \
 		$(MAYBE_DRAGSCROLL) \
 		$(MAYBE_EDITORCONFIG) \
 		$(MAYBE_EDITORTWEAKS) \
@@ -201,6 +206,7 @@ DIST_SUBDIRS = AutoVersioning \
 		Cscope \
 		devpak_plugin \
 		DoxyBlocks \
+		devpak_plugin \
 		dragscroll \
 		EditorConfig \
 		EditorTweaks \
diff --git a/src/plugins/contrib/MouseSap/Makefile.am b/src/plugins/contrib/MouseSap/Makefile.am
index 2c38f84..1d3a2d1 100644
--- a/src/plugins/contrib/MouseSap/Makefile.am
+++ b/src/plugins/contrib/MouseSap/Makefile.am
@@ -1,8 +1,12 @@
-INCLUDES = $(WX_CXXFLAGS) \
-		$(WX_GTK2_CFLAGS) \
+INCLUDES = $(WX_GTK2_CFLAGS) \
 		-I$(top_srcdir)/src/include \
 		-I$(top_srcdir)/src/sdk/wxscintilla/include
 
+AM_CFLAGS = $(WX_CFLAGS)
+AM_CPPFLAGS = $(WX_CPPFLAGS) -DBUILDING_PLUGIN
+AM_CXXFLAGS = $(WX_CXXFLAGS)
+AM_LDFLAGS = $(WX_LIBS) @WIN32_DLLLDFLAGS@ @WIN32_DLLEXPSTDCALL@
+
 pluginlibdir = $(pkglibdir)/plugins
 
 pluginlib_LTLIBRARIES = libMouseSap.la
diff --git a/src/plugins/contrib/NassiShneiderman/Makefile.am b/src/plugins/contrib/NassiShneiderman/Makefile.am
index afa6395..6c5a165 100644
--- a/src/plugins/contrib/NassiShneiderman/Makefile.am
+++ b/src/plugins/contrib/NassiShneiderman/Makefile.am
@@ -1,7 +1,11 @@
-INCLUDES = $(WX_CXXFLAGS) \
-		-I$(top_srcdir)/src/include \
+INCLUDES = -I$(top_srcdir)/src/include \
 		-I$(top_srcdir)/src/sdk/wxscintilla/include
 
+AM_CFLAGS = $(WX_CFLAGS)
+AM_CPPFLAGS = $(WX_CPPFLAGS) -DBUILDING_PLUGIN
+AM_CXXFLAGS = $(WX_CXXFLAGS)
+AM_LDFLAGS = $(WX_LIBS) @WIN32_DLLLDFLAGS@ @WIN32_DLLEXPSTDCALL@
+
 pluginlibdir = $(pkglibdir)/plugins
 
 pluginlib_LTLIBRARIES = libNassiShneiderman.la
diff --git a/src/plugins/contrib/ReopenEditor/Makefile.am b/src/plugins/contrib/ReopenEditor/Makefile.am
index 665dafa..8fcd340 100644
--- a/src/plugins/contrib/ReopenEditor/Makefile.am
+++ b/src/plugins/contrib/ReopenEditor/Makefile.am
@@ -1,7 +1,11 @@
-INCLUDES = $(WX_CXXFLAGS) \
-		-I$(top_srcdir)/src/include \
+INCLUDES = -I$(top_srcdir)/src/include \
 		-I$(top_srcdir)/src/sdk/wxscintilla/include
 
+AM_CFLAGS = $(WX_CFLAGS)
+AM_CPPFLAGS = $(WX_CPPFLAGS) -DBUILDING_PLUGIN
+AM_CXXFLAGS = $(WX_CXXFLAGS)
+AM_LDFLAGS = $(WX_LIBS) @WIN32_DLLLDFLAGS@ @WIN32_DLLEXPSTDCALL@
+
 pluginlibdir = $(pkglibdir)/plugins
 
 pluginlib_LTLIBRARIES = libReopenEditor.la
diff --git a/src/plugins/contrib/SmartIndent/Makefile.am b/src/plugins/contrib/SmartIndent/Makefile.am
index 9082826..f416c6c 100644
--- a/src/plugins/contrib/SmartIndent/Makefile.am
+++ b/src/plugins/contrib/SmartIndent/Makefile.am
@@ -2,6 +2,11 @@ INCLUDES = $(WX_CXXFLAGS) \
 		-I$(top_srcdir)/src/include \
 		-I$(top_srcdir)/src/sdk/wxscintilla/include
 
+AM_CFLAGS = $(WX_CFLAGS)
+AM_CPPFLAGS = $(WX_CPPFLAGS) -DBUILDING_PLUGIN
+AM_CXXFLAGS = $(WX_CXXFLAGS)
+AM_LDFLAGS = $(WX_LIBS) @WIN32_DLLLDFLAGS@ @WIN32_DLLEXPSTDCALL@
+
 pluginlibdir = $(pkglibdir)/plugins
 
 pluginlib_LTLIBRARIES = libSmartIndentHDL.la \
diff --git a/src/plugins/contrib/SpellChecker/Makefile.am b/src/plugins/contrib/SpellChecker/Makefile.am
index 6ee255f..087701e 100644
--- a/src/plugins/contrib/SpellChecker/Makefile.am
+++ b/src/plugins/contrib/SpellChecker/Makefile.am
@@ -1,21 +1,25 @@
 SUBDIRS = wxspellchecker
 
-INCLUDES = $(WX_CXXFLAGS) \
-		$(CB_HUNSPELL_CFLAGS) \
+INCLUDES = $(CB_HUNSPELL_CFLAGS) \
 		-I$(srcdir)/wxspellchecker/include \
 		-I$(top_srcdir)/src/include \
 		-I$(top_srcdir)/src/sdk/wxscintilla/include
 
+AM_CFLAGS = $(WX_CFLAGS)
+AM_CPPFLAGS = $(WX_CPPFLAGS) -DBUILDING_PLUGIN -DWXMAKINGDLL_SPELLCHECKER -DWXUSINGDLL
+AM_CXXFLAGS = $(WX_CXXFLAGS)
+AM_LDFLAGS = $(WX_LIBS) @WIN32_DLLLDFLAGS@ @WIN32_DLLEXPSTDCALL@
+
 pluginlibdir = $(pkglibdir)/plugins
 
 pluginlib_LTLIBRARIES = libSpellChecker.la
 
-libSpellChecker_la_LDFLAGS = -module -version-info 0:1:0 -shared -no-undefined -avoid-version
+libSpellChecker_la_LDFLAGS = -module -version-info 0:1:0 -shared -no-undefined -avoid-version @WIN32_DLLLDFLAGS@ @WIN32_DLLEXPSTDCALL@
 
 libSpellChecker_la_LIBADD = $(PLUGIN_WX_LIBS) \
                             $(CB_HUNSPELL_LIBS) \
                             wxspellchecker/libwxSpellChecker.la \
-							../../../sdk/libcodeblocks.la
+                            ../../../sdk/libcodeblocks.la
 
 libSpellChecker_la_SOURCES = DictionariesNeededDialog.cpp \
                             MySpellingDialog.cpp \
diff --git a/src/plugins/contrib/SpellChecker/wxspellchecker/Makefile.am b/src/plugins/contrib/SpellChecker/wxspellchecker/Makefile.am
index 86867cc..f793425 100644
--- a/src/plugins/contrib/SpellChecker/wxspellchecker/Makefile.am
+++ b/src/plugins/contrib/SpellChecker/wxspellchecker/Makefile.am
@@ -1,13 +1,19 @@
-INCLUDES = $(WX_CXXFLAGS) \
-		$(CB_HUNSPELL_CFLAGS) \
+INCLUDES = $(CB_HUNSPELL_CFLAGS) \
 		-I$(srcdir)/include \
 		-I$(srcdir)/.. \
 		-I$(top_srcdir)/src/sdk/wxscintilla/include
 
-CXXFLAGS = @CXXFLAGS@ -DHUNSPELL_STATIC
+AM_CFLAGS = $(WX_CFLAGS)
+AM_CPPFLAGS = $(WX_CPPFLAGS) -DBUILDING_PLUGIN -DWXMAKINGDLL_SPELLCHECK -DwxPDF_USE_WXMODULE=0
+AM_CXXFLAGS = $(WX_CXXFLAGS)
+AM_LDFLAGS = $(WX_LIBS) @WIN32_DLLLDFLAGS@ @WIN32_DLLEXPSTDCALL@
+
+pluginlibdir = $(pkglibdir)/plugins
 
 noinst_LTLIBRARIES = libwxSpellChecker.la
 
+libwxSpellChecker_la_LDFLAGS = -version-info 0:1:0 -static -no-undefined -avoid-version $(WX_LIBS) @WIN32_DLLLDFLAGS@ @WIN32_DLLEXPSTDCALL@ @WIN32_GDI@
+
 libwxSpellChecker_la_LIBADD = $(PLUGIN_WX_LIBS) \
                             $(CB_HUNSPELL_LIBS)
 
diff --git a/src/plugins/contrib/ThreadSearch/Makefile.am b/src/plugins/contrib/ThreadSearch/Makefile.am
index 92cbbdb..f0c2afc 100644
--- a/src/plugins/contrib/ThreadSearch/Makefile.am
+++ b/src/plugins/contrib/ThreadSearch/Makefile.am
@@ -1,7 +1,6 @@
 SUBDIRS = resources
 
-INCLUDES = $(WX_CXXFLAGS) \
-		-I$(top_srcdir)/src/include \
+INCLUDES = -I$(top_srcdir)/src/include \
 		-I$(top_srcdir)/src/sdk/wxscintilla/include \
 		-I$(top_srcdir)/src/include/mozilla_chardet \
 		-I$(top_srcdir)/src/include/mozilla_chardet/mfbt \
@@ -11,6 +10,11 @@ INCLUDES = $(WX_CXXFLAGS) \
 		-I$(top_srcdir)/src/include/mozilla_chardet/xpcom/glue \
 		-I$(srcdir)/../wxContribItems/wxthings/include
 
+AM_CFLAGS = $(WX_CFLAGS)
+AM_CPPFLAGS = $(WX_CPPFLAGS) -DBUILDING_PLUGIN
+AM_CXXFLAGS = $(WX_CXXFLAGS)
+AM_LDFLAGS = $(WX_LIBS) @WIN32_DLLLDFLAGS@ @WIN32_DLLEXPSTDCALL@
+
 pluginlibdir = $(pkglibdir)/plugins
 
 pluginlib_LTLIBRARIES = libThreadSearch.la
diff --git a/src/plugins/contrib/ToolsPlus/Makefile.am b/src/plugins/contrib/ToolsPlus/Makefile.am
index b8e5577..fa9f873 100644
--- a/src/plugins/contrib/ToolsPlus/Makefile.am
+++ b/src/plugins/contrib/ToolsPlus/Makefile.am
@@ -1,7 +1,6 @@
 SUBDIRS = Resources
 
-INCLUDES = $(WX_CXXFLAGS) \
-		-I$(top_srcdir)/src/include \
+INCLUDES = -I$(top_srcdir)/src/include \
 		-I$(top_srcdir)/src/sdk/wxscintilla/include \
 		-I$(top_srcdir)/src/include/mozilla_chardet \
 		-I$(top_srcdir)/src/include/mozilla_chardet/mfbt \
@@ -10,6 +9,11 @@ INCLUDES = $(WX_CXXFLAGS) \
 		-I$(top_srcdir)/src/include/mozilla_chardet/xpcom/base \
 		-I$(top_srcdir)/src/include/mozilla_chardet/xpcom/glue
 
+AM_CFLAGS = $(WX_CFLAGS)
+AM_CPPFLAGS = $(WX_CPPFLAGS) -DBUILDING_PLUGIN
+AM_CXXFLAGS = $(WX_CXXFLAGS)
+AM_LDFLAGS = $(WX_LIBS) @WIN32_DLLLDFLAGS@ @WIN32_DLLEXPSTDCALL@
+
 pluginlibdir = $(pkglibdir)/plugins
 
 pluginlib_LTLIBRARIES = libToolsPlus.la
diff --git a/src/plugins/contrib/Valgrind/Makefile.am b/src/plugins/contrib/Valgrind/Makefile.am
index df34a62..fd68a40 100644
--- a/src/plugins/contrib/Valgrind/Makefile.am
+++ b/src/plugins/contrib/Valgrind/Makefile.am
@@ -1,9 +1,13 @@
 SUBDIRS = resources
 
-INCLUDES = $(WX_CXXFLAGS) \
-		-I$(top_srcdir)/src/include \
+INCLUDES = -I$(top_srcdir)/src/include \
 		-I$(top_srcdir)/src/sdk/wxscintilla/include
 
+AM_CFLAGS = $(WX_CFLAGS)
+AM_CPPFLAGS = $(WX_CPPFLAGS) -DBUILDING_PLUGIN
+AM_CXXFLAGS = $(WX_CXXFLAGS)
+AM_LDFLAGS = $(WX_LIBS) @WIN32_DLLLDFLAGS@ @WIN32_DLLEXPSTDCALL@
+
 pluginlibdir = $(pkglibdir)/plugins
 
 pluginlib_LTLIBRARIES = libValgrind.la
diff --git a/src/plugins/contrib/byogames/Makefile.am b/src/plugins/contrib/byogames/Makefile.am
index d66aa15..dd3740c 100644
--- a/src/plugins/contrib/byogames/Makefile.am
+++ b/src/plugins/contrib/byogames/Makefile.am
@@ -1,7 +1,11 @@
-INCLUDES = $(WX_CXXFLAGS) \
-		-I$(top_srcdir)/src/include \
+INCLUDES = -I$(top_srcdir)/src/include \
 		-I$(top_srcdir)/src/sdk/wxscintilla/include
 
+AM_CFLAGS = $(WX_CFLAGS)
+AM_CPPFLAGS = $(WX_CPPFLAGS) -DBUILDING_PLUGIN
+AM_CXXFLAGS = $(WX_CXXFLAGS)
+AM_LDFLAGS = $(WX_LIBS) @WIN32_DLLLDFLAGS@ @WIN32_DLLEXPSTDCALL@
+
 pluginlibdir = $(pkglibdir)/plugins
 
 pluginlib_LTLIBRARIES = libbyogames.la
diff --git a/src/plugins/contrib/cb_koders/Makefile.am b/src/plugins/contrib/cb_koders/Makefile.am
index a163a03..ecb7e4f 100644
--- a/src/plugins/contrib/cb_koders/Makefile.am
+++ b/src/plugins/contrib/cb_koders/Makefile.am
@@ -1,7 +1,11 @@
-INCLUDES = $(WX_CXXFLAGS) \
-		-I$(top_srcdir)/src/include \
+INCLUDES = -I$(top_srcdir)/src/include \
 		-I$(top_srcdir)/src/sdk/wxscintilla/include
 
+AM_CFLAGS = $(WX_CFLAGS)
+AM_CPPFLAGS = $(WX_CPPFLAGS) -DBUILDING_PLUGIN
+AM_CXXFLAGS = $(WX_CXXFLAGS)
+AM_LDFLAGS = $(WX_LIBS) @WIN32_DLLLDFLAGS@ @WIN32_DLLEXPSTDCALL@
+
 pluginlibdir = $(pkglibdir)/plugins
 
 pluginlib_LTLIBRARIES = libcb_koders.la
diff --git a/src/plugins/contrib/codesnippets/Makefile.am b/src/plugins/contrib/codesnippets/Makefile.am
index acd511a..987c18d 100644
--- a/src/plugins/contrib/codesnippets/Makefile.am
+++ b/src/plugins/contrib/codesnippets/Makefile.am
@@ -1,13 +1,12 @@
 SUBDIRS = resources
 
-INCLUDES = $(WX_CXXFLAGS) \
-		$(WX_GTK2_CFLAGS) \
+INCLUDES = $(WX_GTK2_CFLAGS) \
 		$(WX_X11_CFLAGS) \
 		-I$(top_srcdir)/src/include \
 		-I$(top_srcdir)/src/sdk/wxscintilla/include \
 		-I$(top_srcdir)/src/plugins/contrib/codesnippets \
 		-I$(top_srcdir)/src/plugins/contrib/codesnippets/Search \
- 		-I$(top_srcdir)/src/plugins/contrib/codesnippets/editor \
+		-I$(top_srcdir)/src/plugins/contrib/codesnippets/editor \
 		-I$(top_srcdir)/src/include/mozilla_chardet \
 		-I$(top_srcdir)/src/include/mozilla_chardet/mfbt \
 		-I$(top_srcdir)/src/include/mozilla_chardet/nsprpub/pr/include \
@@ -15,6 +14,11 @@ INCLUDES = $(WX_CXXFLAGS) \
 		-I$(top_srcdir)/src/include/mozilla_chardet/xpcom/base \
 		-I$(top_srcdir)/src/include/mozilla_chardet/xpcom/glue
 
+AM_CFLAGS = $(WX_CFLAGS)
+AM_CPPFLAGS = $(WX_CPPFLAGS) -DBUILDING_PLUGIN
+AM_CXXFLAGS = $(WX_CXXFLAGS)
+AM_LDFLAGS = $(WX_LIBS) @WIN32_DLLLDFLAGS@ @WIN32_DLLEXPSTDCALL@
+
 pluginlibdir = $(pkglibdir)/plugins
 
 pluginlib_LTLIBRARIES = libcodesnippets.la
diff --git a/src/plugins/contrib/codesnippets/resources/Makefile.am b/src/plugins/contrib/codesnippets/resources/Makefile.am
index 2a2f1ea..78477a3 100644
--- a/src/plugins/contrib/codesnippets/resources/Makefile.am
+++ b/src/plugins/contrib/codesnippets/resources/Makefile.am
@@ -1,11 +1,10 @@
-INCLUDES = $(WX_CXXFLAGS) \
-		$(WX_GTK2_CFLAGS) \
+INCLUDES = $(WX_GTK2_CFLAGS) \
 		$(WX_X11_CFLAGS) \
 		-I$(top_srcdir)/src/include \
 		-I$(top_srcdir)/src/sdk/wxscintilla/include \
 		-I$(top_srcdir)/src/plugins/contrib/codesnippets \
 		-I$(top_srcdir)/src/plugins/contrib/codesnippets/Search \
- 		-I$(top_srcdir)/src/plugins/contrib/codesnippets/editor \
+		-I$(top_srcdir)/src/plugins/contrib/codesnippets/editor \
 		-I$(top_srcdir)/src/include/mozilla_chardet \
 		-I$(top_srcdir)/src/include/mozilla_chardet/mfbt \
 		-I$(top_srcdir)/src/include/mozilla_chardet/nsprpub/pr/include \
@@ -13,6 +12,11 @@ INCLUDES = $(WX_CXXFLAGS) \
 		-I$(top_srcdir)/src/include/mozilla_chardet/xpcom/base \
 		-I$(top_srcdir)/src/include/mozilla_chardet/xpcom/glue
 
+AM_CFLAGS = $(WX_CFLAGS)
+AM_CPPFLAGS = $(WX_CPPFLAGS) -DBUILDING_PLUGIN
+AM_CXXFLAGS = $(WX_CXXFLAGS)
+AM_LDFLAGS = $(WX_LIBS) @WIN32_DLLLDFLAGS@ @WIN32_DLLEXPSTDCALL@
+
 pluginlibdir = $(pkglibdir)/plugins
 
 ##pluginlib_LTLIBRARIES = codesnippets
diff --git a/src/plugins/contrib/codestat/Makefile.am b/src/plugins/contrib/codestat/Makefile.am
index 5957578..1e8aeb2 100644
--- a/src/plugins/contrib/codestat/Makefile.am
+++ b/src/plugins/contrib/codestat/Makefile.am
@@ -1,9 +1,13 @@
 SUBDIRS = resources
 
-INCLUDES = $(WX_CXXFLAGS) \
-		-I$(top_srcdir)/src/include \
+INCLUDES = -I$(top_srcdir)/src/include \
 		-I$(top_srcdir)/src/sdk/wxscintilla/include
 
+AM_CFLAGS = $(WX_CFLAGS)
+AM_CPPFLAGS = $(WX_CPPFLAGS) -DBUILDING_PLUGIN
+AM_CXXFLAGS = $(WX_CXXFLAGS)
+AM_LDFLAGS = $(WX_LIBS) @WIN32_DLLLDFLAGS@ @WIN32_DLLEXPSTDCALL@
+
 pluginlibdir = $(pkglibdir)/plugins
 
 pluginlib_LTLIBRARIES = libcodestat.la
diff --git a/src/plugins/contrib/copystrings/Makefile.am b/src/plugins/contrib/copystrings/Makefile.am
index 339d897..a8acc5c 100644
--- a/src/plugins/contrib/copystrings/Makefile.am
+++ b/src/plugins/contrib/copystrings/Makefile.am
@@ -1,7 +1,11 @@
-INCLUDES = $(WX_CXXFLAGS) \
-		-I$(top_srcdir)/src/include \
+INCLUDES = -I$(top_srcdir)/src/include \
 		-I$(top_srcdir)/src/sdk/wxscintilla/include
 
+AM_CFLAGS = $(WX_CFLAGS)
+AM_CPPFLAGS = $(WX_CPPFLAGS) -DBUILDING_PLUGIN
+AM_CXXFLAGS = $(WX_CXXFLAGS)
+AM_LDFLAGS = $(WX_LIBS) @WIN32_DLLLDFLAGS@ @WIN32_DLLEXPSTDCALL@
+
 pluginlibdir = $(pkglibdir)/plugins
 
 pluginlib_LTLIBRARIES = libcopystrings.la
diff --git a/src/plugins/contrib/devpak_plugin/Makefile.am b/src/plugins/contrib/devpak_plugin/Makefile.am
index 782fad4..99d8290 100644
--- a/src/plugins/contrib/devpak_plugin/Makefile.am
+++ b/src/plugins/contrib/devpak_plugin/Makefile.am
@@ -1,6 +1,22 @@
 SUBDIRS = 	bzip2
 
-EXTRA_DIST = 	cbiniparser.cpp \
+INCLUDES = -I$(top_srcdir)/src/include \
+		-I$(top_srcdir)/src/sdk/wxscintilla/include
+
+AM_CFLAGS = $(WX_CFLAGS)
+AM_CPPFLAGS = $(WX_CPPFLAGS) -DBUILDING_PLUGIN
+AM_CXXFLAGS = $(WX_CXXFLAGS)
+AM_LDFLAGS = $(WX_LIBS) @WIN32_DLLLDFLAGS@ @WIN32_DLLEXPSTDCALL@
+
+pluginlibdir = $(pkglibdir)/plugins
+
+pluginlib_LTLIBRARIES = libdevpakupdater.la
+
+libdevpakupdater_la_LDFLAGS = -module -version-info 0:1:0 -shared -no-undefined -avoid-version
+
+libdevpakupdater_la_LIBADD =  $(PLUGIN_WX_LIBS) ../../../sdk/libcodeblocks.la -lbz2
+
+libdevpakupdater_la_SOURCES = cbiniparser.cpp \
 		cbnetwork.cpp \
 		conf.cpp \
 		crc32.cpp \
@@ -8,14 +24,18 @@ EXTRA_DIST = 	cbiniparser.cpp \
 		devpakupdater.cpp \
 		mytar.cpp \
 		updatedlg.cpp \
-		cbiniparser.h \
+		DevPakPlugin.cbp
+noinst_HEADERS = cbiniparser.h \
 		cbnetwork.h \
 		conf.h \
 		crc32.h \
 		devpakinstaller.h \
 		devpakupdater.h \
 		mytar.h \
-		updatedlg.h \
-		DevPakPlugin.cbp \
-		manifest.xml \
-		update.xrc
+		updatedlg.h
+EXTRA_DIST = update.xrc manifest.xml
+pkgdata_DATA = devpakupdater.zip
+CLEANFILES = $(pkgdata_DATA)
+
+devpakupdater.zip: $(EXTRA_DIST)
+	PWD=`pwd` cd $(srcdir) && zip $(PWD)/devpakupdater.zip manifest.xml *.xrc > /dev/null
diff --git a/src/plugins/contrib/devpak_plugin/mytar.cpp b/src/plugins/contrib/devpak_plugin/mytar.cpp
index b6a5f70..0c9d4f7 100644
--- a/src/plugins/contrib/devpak_plugin/mytar.cpp
+++ b/src/plugins/contrib/devpak_plugin/mytar.cpp
@@ -8,7 +8,11 @@
  */
 
 #include "mytar.h"
+#if defined _WIN32
 #include <io.h>
+#else
+#include <stdio.h>
+#endif
 #include <globals.h>
 #include <wx/intl.h>
 #include <wx/arrimpl.cpp>
diff --git a/src/plugins/contrib/dragscroll/Makefile.am b/src/plugins/contrib/dragscroll/Makefile.am
index a6520fb..62422ca 100644
--- a/src/plugins/contrib/dragscroll/Makefile.am
+++ b/src/plugins/contrib/dragscroll/Makefile.am
@@ -1,8 +1,12 @@
-INCLUDES = $(WX_CXXFLAGS) \
-		-I$(top_srcdir)/src/include \
+INCLUDES = -I$(top_srcdir)/src/include \
 		-I$(top_srcdir)/src/src \
 		-I$(top_srcdir)/src/sdk/wxscintilla/include
 
+AM_CFLAGS = $(WX_CFLAGS)
+AM_CPPFLAGS = $(WX_CPPFLAGS) -DBUILDING_PLUGIN
+AM_CXXFLAGS = $(WX_CXXFLAGS)
+AM_LDFLAGS = $(WX_LIBS) @WIN32_DLLLDFLAGS@ @WIN32_DLLEXPSTDCALL@
+
 pluginlibdir = $(pkglibdir)/plugins
 
 pluginlib_LTLIBRARIES = libdragscroll.la
diff --git a/src/plugins/contrib/envvars/Makefile.am b/src/plugins/contrib/envvars/Makefile.am
index dc87160..377a4cb 100644
--- a/src/plugins/contrib/envvars/Makefile.am
+++ b/src/plugins/contrib/envvars/Makefile.am
@@ -1,10 +1,14 @@
-INCLUDES = $(WX_CXXFLAGS) \
-		-I$(top_srcdir)/src/include \
+INCLUDES = -I$(top_srcdir)/src/include \
 		-I$(top_srcdir)/src/include/scripting/include \
 		-I$(top_srcdir)/src/include/scripting/sqplus \
 		-I$(top_srcdir)/src/include/scripting/bindings \
 		-I$(top_srcdir)/src/sdk/wxscintilla/include
 
+AM_CFLAGS = $(WX_CFLAGS)
+AM_CPPFLAGS = $(WX_CPPFLAGS) -DBUILDING_PLUGIN
+AM_CXXFLAGS = $(WX_CXXFLAGS)
+AM_LDFLAGS = $(WX_LIBS) @WIN32_DLLLDFLAGS@ @WIN32_DLLEXPSTDCALL@
+
 pluginlibdir = $(pkglibdir)/plugins
 pkgdata_DATA = envvars.zip
 
diff --git a/src/plugins/contrib/headerfixup/Makefile.am b/src/plugins/contrib/headerfixup/Makefile.am
index a4e9aab..e445845 100644
--- a/src/plugins/contrib/headerfixup/Makefile.am
+++ b/src/plugins/contrib/headerfixup/Makefile.am
@@ -1,8 +1,9 @@
-INCLUDES = $(WX_CXXFLAGS) \
-           -I$(top_srcdir)/src/include \
-           -I$(top_srcdir)/src/sdk/wxscintilla/include
-
-CXXFLAGS = @CXXFLAGS@  -O0
+INCLUDES = -I$(top_srcdir)/src/include \
+		-I$(top_srcdir)/src/sdk/wxscintilla/include
+AM_CFLAGS = $(WX_CFLAGS)
+AM_CPPFLAGS = $(WX_CPPFLAGS) -DBUILDING_PLUGIN
+AM_CXXFLAGS = $(WX_CXXFLAGS) -O0
+AM_LDFLAGS = $(WX_LIBS) @WIN32_DLLLDFLAGS@ @WIN32_DLLEXPSTDCALL@
 
 pluginlibdir = $(pkglibdir)/plugins
 
diff --git a/src/plugins/contrib/help_plugin/Makefile.am b/src/plugins/contrib/help_plugin/Makefile.am
index f38d145..8df35e6 100644
--- a/src/plugins/contrib/help_plugin/Makefile.am
+++ b/src/plugins/contrib/help_plugin/Makefile.am
@@ -7,13 +7,17 @@ if ! HAVE_ZLIB
 SUBDIRS += zlib
 endif
 
-INCLUDES = $(WX_CXXFLAGS) \
-		-I$(top_srcdir)/src/include \
+INCLUDES = -I$(top_srcdir)/src/include \
 		-I$(top_srcdir)/src/sdk/wxscintilla/include \
 		-I$(top_srcdir)/src/include/scripting/include \
 		-I$(top_srcdir)/src/include/scripting/bindings \
 		-I$(top_srcdir)/src/include/scripting/sqplus
 
+AM_CFLAGS = $(WX_CFLAGS)
+AM_CPPFLAGS = $(WX_CPPFLAGS) -DBUILDING_PLUGIN
+AM_CXXFLAGS = $(WX_CXXFLAGS)
+AM_LDFLAGS = $(WX_LIBS) @WIN32_DLLLDFLAGS@ @WIN32_DLLEXPSTDCALL@
+
 pluginlibdir = $(pkglibdir)/plugins
 
 pluginlib_LTLIBRARIES = libhelp_plugin.la
diff --git a/src/plugins/contrib/keybinder/Makefile.am b/src/plugins/contrib/keybinder/Makefile.am
index d9116af..ea47a72 100644
--- a/src/plugins/contrib/keybinder/Makefile.am
+++ b/src/plugins/contrib/keybinder/Makefile.am
@@ -1,7 +1,11 @@
-INCLUDES = $(WX_CXXFLAGS) \
-		-I$(top_srcdir)/src/include \
+INCLUDES = -I$(top_srcdir)/src/include \
 		-I$(top_srcdir)/src/sdk/wxscintilla/include
 
+AM_CFLAGS = $(WX_CFLAGS)
+AM_CPPFLAGS = $(WX_CPPFLAGS) -DBUILDING_PLUGIN
+AM_CXXFLAGS = $(WX_CXXFLAGS)
+AM_LDFLAGS = $(WX_LIBS) @WIN32_DLLLDFLAGS@ @WIN32_DLLEXPSTDCALL@
+
 pluginlibdir = $(pkglibdir)/plugins
 
 pluginlib_LTLIBRARIES = libkeybinder.la
diff --git a/src/plugins/contrib/lib_finder/Makefile.am b/src/plugins/contrib/lib_finder/Makefile.am
index 4791dec..2675f9a 100644
--- a/src/plugins/contrib/lib_finder/Makefile.am
+++ b/src/plugins/contrib/lib_finder/Makefile.am
@@ -1,7 +1,6 @@
 SUBDIRS = lib_finder
 
-INCLUDES = $(WX_CXXFLAGS) \
-		-I$(top_srcdir)/src/include \
+INCLUDES = -I$(top_srcdir)/src/include \
 		-I$(top_srcdir)/src/sdk/wxscintilla/include \
 		-I$(srcdir)/../wxContribItems/wxFlatNotebook/include \
 		-I$(top_srcdir)/src/include/scripting/include \
@@ -15,6 +14,11 @@ INCLUDES = $(WX_CXXFLAGS) \
 		-I$(top_srcdir)/src/include/mozilla_chardet/xpcom/base \
 		-I$(top_srcdir)/src/include/mozilla_chardet/xpcom/glue
 
+AM_CFLAGS = $(WX_CFLAGS)
+AM_CPPFLAGS = $(WX_CPPFLAGS) -DBUILDING_PLUGIN
+AM_CXXFLAGS = $(WX_CXXFLAGS)
+AM_LDFLAGS = $(WX_LIBS) @WIN32_DLLLDFLAGS@ @WIN32_DLLEXPSTDCALL@
+
 pluginlibdir = $(pkglibdir)/plugins
 
 pluginlib_LTLIBRARIES = liblib_finder.la
diff --git a/src/plugins/contrib/profiler/Makefile.am b/src/plugins/contrib/profiler/Makefile.am
index e21804c..2bfc282 100644
--- a/src/plugins/contrib/profiler/Makefile.am
+++ b/src/plugins/contrib/profiler/Makefile.am
@@ -1,9 +1,13 @@
 SUBDIRS = resources
 
-INCLUDES = $(WX_CXXFLAGS) \
-		-I$(top_srcdir)/src/include \
+INCLUDES = -I$(top_srcdir)/src/include \
 		-I$(top_srcdir)/src/sdk/wxscintilla/include
 
+AM_CFLAGS = $(WX_CFLAGS)
+AM_CPPFLAGS = $(WX_CPPFLAGS) -DBUILDING_PLUGIN
+AM_CXXFLAGS = $(WX_CXXFLAGS)
+AM_LDFLAGS = $(WX_LIBS) @WIN32_DLLLDFLAGS@ @WIN32_DLLEXPSTDCALL@
+
 pluginlibdir = $(pkglibdir)/plugins
 
 pluginlib_LTLIBRARIES = libProfiler.la
diff --git a/src/plugins/contrib/regex_testbed/Makefile.am b/src/plugins/contrib/regex_testbed/Makefile.am
index c0dd117..09addd4 100644
--- a/src/plugins/contrib/regex_testbed/Makefile.am
+++ b/src/plugins/contrib/regex_testbed/Makefile.am
@@ -1,7 +1,11 @@
-INCLUDES = $(WX_CXXFLAGS) \
-		-I$(top_srcdir)/src/include \
+INCLUDES = -I$(top_srcdir)/src/include \
 		-I$(top_srcdir)/src/sdk/wxscintilla/include
 
+AM_CFLAGS = $(WX_CFLAGS)
+AM_CPPFLAGS = $(WX_CPPFLAGS) -DBUILDING_PLUGIN
+AM_CXXFLAGS = $(WX_CXXFLAGS)
+AM_LDFLAGS = $(WX_LIBS) @WIN32_DLLLDFLAGS@ @WIN32_DLLEXPSTDCALL@
+
 pluginlibdir = $(pkglibdir)/plugins
 pkgdata_DATA = RegExTestbed.zip
 
diff --git a/src/plugins/contrib/source_exporter/Makefile.am b/src/plugins/contrib/source_exporter/Makefile.am
index f401aac..4fc18c7 100644
--- a/src/plugins/contrib/source_exporter/Makefile.am
+++ b/src/plugins/contrib/source_exporter/Makefile.am
@@ -1,18 +1,22 @@
 SUBDIRS = wxPdfDocument
 
-INCLUDES = $(WX_CXXFLAGS) \
-		-I$(top_srcdir)/src/include \
+INCLUDES = -I$(top_srcdir)/src/include \
 		-I$(top_srcdir)/src/sdk/wxscintilla/include \
 		-I$(top_srcdir)/src/plugins/contrib/source_exporter/wxPdfDocument/include \
 		-include "sdk.h"
 
+AM_CFLAGS = $(WX_CFLAGS)
+AM_CPPFLAGS = $(WX_CPPFLAGS) -DBUILDING_PLUGIN
+AM_CXXFLAGS = $(WX_CXXFLAGS)
+AM_LDFLAGS = $(WX_LIBS) @WIN32_DLLLDFLAGS@ @WIN32_DLLEXPSTDCALL@
+
 pluginlibdir = $(pkglibdir)/plugins
 
 pluginlib_LTLIBRARIES = libexporter.la
 
 libexporter_la_CPPFLAGS = -DwxPDF_USE_WXMODULE=0
 
-libexporter_la_LDFLAGS = -module -version-info 0:1:0 -shared -no-undefined -avoid-version
+libexporter_la_LDFLAGS = -module -version-info 0:1:0 -shared -no-undefined -avoid-version @WIN32_DLLLDFLAGS@ @WIN32_DLLEXPSTDCALL@
 
 libexporter_la_LIBADD = $(PLUGIN_WX_LIBS) ../../../sdk/libcodeblocks.la \
 				wxPdfDocument/libwxPdfDocument.la
diff --git a/src/plugins/contrib/source_exporter/wxPdfDocument/Makefile.am b/src/plugins/contrib/source_exporter/wxPdfDocument/Makefile.am
index 1b4db69..62f4036 100644
--- a/src/plugins/contrib/source_exporter/wxPdfDocument/Makefile.am
+++ b/src/plugins/contrib/source_exporter/wxPdfDocument/Makefile.am
@@ -1,11 +1,15 @@
-INCLUDES = $(WX_CXXFLAGS) \
-		-I$(top_srcdir)/src/plugins/contrib/source_exporter/wxPdfDocument/include
+INCLUDES = -I$(top_srcdir)/src/plugins/contrib/source_exporter/wxPdfDocument/include
 
-noinst_LTLIBRARIES = libwxPdfDocument.la
+AM_CFLAGS = $(WX_CFLAGS)
+AM_CPPFLAGS = $(WX_CPPFLAGS) -DBUILDING_PLUGIN -DWXMAKINGDLL_WXPDFDOC -DWXMAKINGDLL_PDFDOC -DwxPDF_USE_WXMODULE=0
+AM_CXXFLAGS = $(WX_CXXFLAGS)
+AM_LDFLAGS = $(WX_LIBS) @WIN32_DLLLDFLAGS@ @WIN32_DLLEXPSTDCALL@ @WIN32_GDI@
 
-libwxPdfDocument_la_CPPFLAGS = -DwxPDF_USE_WXMODULE=0
+pluginlibdir = $(pkglibdir)/plugins
 
-libwxPdfDocument_la_LDFLAGS = -module -version-info 0:1:0 -shared -no-undefined -avoid-version
+pluginlib_LTLIBRARIES = libwxPdfDocument.la
+
+libwxPdfDocument_la_LDFLAGS = -version-info 0:1:0 -shared -no-undefined -avoid-version $(WX_LIBS) @WIN32_DLLLDFLAGS@ @WIN32_DLLEXPSTDCALL@ @WIN32_GDI@
 
 libwxPdfDocument_la_SOURCES = src/pdfannotation.cpp \
 				src/pdfbarcode.cpp \
diff --git a/src/plugins/contrib/symtab/Makefile.am b/src/plugins/contrib/symtab/Makefile.am
index 1f911a4..42cae9a 100644
--- a/src/plugins/contrib/symtab/Makefile.am
+++ b/src/plugins/contrib/symtab/Makefile.am
@@ -1,9 +1,13 @@
 SUBDIRS = resources
 
-INCLUDES = $(WX_CXXFLAGS) \
-		-I$(top_srcdir)/src/include \
+INCLUDES = -I$(top_srcdir)/src/include \
 		-I$(top_srcdir)/src/sdk/wxscintilla/include
 
+AM_CFLAGS = $(WX_CFLAGS)
+AM_CPPFLAGS = $(WX_CPPFLAGS) -DBUILDING_PLUGIN
+AM_CXXFLAGS = $(WX_CXXFLAGS)
+AM_LDFLAGS = $(WX_LIBS) @WIN32_DLLLDFLAGS@ @WIN32_DLLEXPSTDCALL@
+
 pluginlibdir = $(pkglibdir)/plugins
 
 pluginlib_LTLIBRARIES = libSymTab.la
diff --git a/src/plugins/contrib/wxContribItems/KWIC/Makefile.am b/src/plugins/contrib/wxContribItems/KWIC/Makefile.am
index 21dc43f..5a21531 100644
--- a/src/plugins/contrib/wxContribItems/KWIC/Makefile.am
+++ b/src/plugins/contrib/wxContribItems/KWIC/Makefile.am
@@ -1,13 +1,17 @@
 SUBDIRS = include/wx/KWIC include/wx/xrc
 
-INCLUDES = $(WX_CXXFLAGS) \
-		-I$(srcdir)/include
+INCLUDES = -I$(srcdir)/include
+
+AM_CFLAGS = $(WX_CFLAGS)
+AM_CPPFLAGS = $(WX_CPPFLAGS) -DBUILDING_PLUGIN
+AM_CXXFLAGS = $(WX_CXXFLAGS)
+AM_LDFLAGS = $(WX_LIBS) @WIN32_DLLLDFLAGS@ @WIN32_DLLEXPSTDCALL@
 
 wxcontribitemsdir=$(libdir)/codeblocks/wxContribItems
 
 wxcontribitems_LTLIBRARIES = libwxkwic.la
 
-libwxkwic_la_LDFLAGS = -version-info 0:1:0
+libwxkwic_la_LDFLAGS = -version-info 0:1:0 -shared -no-undefined
 
 libwxkwic_la_LIBADD = $(WX_LIBS)
 
diff --git a/src/plugins/contrib/wxContribItems/Makefile.am b/src/plugins/contrib/wxContribItems/Makefile.am
index 91b24e8..d44fd70 100644
--- a/src/plugins/contrib/wxContribItems/Makefile.am
+++ b/src/plugins/contrib/wxContribItems/Makefile.am
@@ -1,4 +1,4 @@
-SUBDIRS = wxchart wxFlatNotebook wxthings wxImagePanel wxSpeedButton KWIC wxTreeList wxled .
+SUBDIRS = wxchart wxFlatNotebook wxthings wxImagePanel wxSpeedButton KWIC wxTreeList wxled
 
 EXTRA_DIST = $(srcdir)/*.cbp
 
diff --git a/src/plugins/contrib/wxContribItems/wxFlatNotebook/Makefile.am b/src/plugins/contrib/wxContribItems/wxFlatNotebook/Makefile.am
index cc0ba30..4c67dea 100644
--- a/src/plugins/contrib/wxContribItems/wxFlatNotebook/Makefile.am
+++ b/src/plugins/contrib/wxContribItems/wxFlatNotebook/Makefile.am
@@ -1,11 +1,15 @@
-INCLUDES = $(WX_CXXFLAGS) \
-		-I$(srcdir)/include
+INCLUDES = -I$(srcdir)/include
+
+AM_CFLAGS = $(WX_CFLAGS)
+AM_CPPFLAGS = $(WX_CPPFLAGS) -DBUILDING_PLUGIN -DWXMAKINGDLL_FNB
+AM_CXXFLAGS = $(WX_CXXFLAGS)
+AM_LDFLAGS = $(WX_LIBS) @WIN32_DLLLDFLAGS@ @WIN32_DLLEXPSTDCALL@
 
 wxcontribitemsdir=$(libdir)/codeblocks/wxContribItems
 
 wxcontribitems_LTLIBRARIES = libwxflatnotebook.la
 
-libwxflatnotebook_la_LDFLAGS = -version-info 0:1:0
+libwxflatnotebook_la_LDFLAGS = -version-info 0:1:0 -shared -no-undefined
 
 libwxflatnotebook_la_LIBADD = $(WX_LIBS)
 
diff --git a/src/plugins/contrib/wxContribItems/wxImagePanel/Makefile.am b/src/plugins/contrib/wxContribItems/wxImagePanel/Makefile.am
index b5d3c95..9160ff7 100644
--- a/src/plugins/contrib/wxContribItems/wxImagePanel/Makefile.am
+++ b/src/plugins/contrib/wxContribItems/wxImagePanel/Makefile.am
@@ -1,11 +1,15 @@
-INCLUDES = $(WX_CXXFLAGS) \
-		-I$(srcdir)/include
+INCLUDES = -I$(srcdir)/include
+
+AM_CFLAGS = $(WX_CFLAGS)
+AM_CPPFLAGS = $(WX_CPPFLAGS) -DBUILDING_PLUGIN
+AM_CXXFLAGS = $(WX_CXXFLAGS)
+AM_LDFLAGS = $(WX_LIBS) @WIN32_DLLLDFLAGS@ @WIN32_DLLEXPSTDCALL@
 
 wxcontribitemsdir=$(libdir)/codeblocks/wxContribItems
 
 wxcontribitems_LTLIBRARIES = libwximagepanel.la
 
-libwximagepanel_la_LDFLAGS = -version-info 0:1:0
+libwximagepanel_la_LDFLAGS = -version-info 0:1:0 -shared -no-undefined
 
 libwximagepanel_la_LIBADD = $(WX_LIBS)
 
diff --git a/src/plugins/contrib/wxContribItems/wxSpeedButton/Makefile.am b/src/plugins/contrib/wxContribItems/wxSpeedButton/Makefile.am
index 94e572e..5c891fc 100644
--- a/src/plugins/contrib/wxContribItems/wxSpeedButton/Makefile.am
+++ b/src/plugins/contrib/wxContribItems/wxSpeedButton/Makefile.am
@@ -1,11 +1,15 @@
-INCLUDES = $(WX_CXXFLAGS) \
-		-I$(srcdir)/include
+INCLUDES = -I$(srcdir)/include
+
+AM_CFLAGS = $(WX_CFLAGS)
+AM_CPPFLAGS = $(WX_CPPFLAGS) -DBUILDING_PLUGIN
+AM_CXXFLAGS = $(WX_CXXFLAGS)
+AM_LDFLAGS = $(WX_LIBS) @WIN32_DLLLDFLAGS@ @WIN32_DLLEXPSTDCALL@
 
 wxcontribitemsdir=$(libdir)/codeblocks/wxContribItems
 
 wxcontribitems_LTLIBRARIES = libwxspeedbutton.la
 
-libwxspeedbutton_la_LDFLAGS = -version-info 0:1:0
+libwxspeedbutton_la_LDFLAGS = -version-info 0:1:0 -shared -no-undefined
 
 libwxspeedbutton_la_LIBADD = $(WX_LIBS)
 
diff --git a/src/plugins/contrib/wxContribItems/wxTreeList/Makefile.am b/src/plugins/contrib/wxContribItems/wxTreeList/Makefile.am
index 94c7982..1a6b158 100644
--- a/src/plugins/contrib/wxContribItems/wxTreeList/Makefile.am
+++ b/src/plugins/contrib/wxContribItems/wxTreeList/Makefile.am
@@ -1,11 +1,15 @@
-INCLUDES = $(WX_CXXFLAGS) \
-		-I$(srcdir)/include
+INCLUDES = -I$(srcdir)/include
+
+AM_CFLAGS = $(WX_CFLAGS)
+AM_CPPFLAGS = $(WX_CPPFLAGS) -DBUILDING_PLUGIN -DWXMAKINGDLL
+AM_CXXFLAGS = $(WX_CXXFLAGS)
+AM_LDFLAGS = $(WX_LIBS) @WIN32_DLLLDFLAGS@ @WIN32_DLLEXPSTDCALL@
 
 wxcontribitemsdir=$(libdir)/codeblocks/wxContribItems
 
 wxcontribitems_LTLIBRARIES = libwxtreelist.la
 
-libwxtreelist_la_LDFLAGS = -version-info 0:1:0
+libwxtreelist_la_LDFLAGS = -version-info 0:1:0 -shared -no-undefined
 
 libwxtreelist_la_LIBADD = $(WX_LIBS)
 
diff --git a/src/plugins/contrib/wxContribItems/wxchart/Makefile.am b/src/plugins/contrib/wxContribItems/wxchart/Makefile.am
index 1ee88d9..b0d0280 100644
--- a/src/plugins/contrib/wxContribItems/wxchart/Makefile.am
+++ b/src/plugins/contrib/wxContribItems/wxchart/Makefile.am
@@ -1,12 +1,15 @@
-INCLUDES = $(WX_CXXFLAGS) \
-		-I$(srcdir)/include
+INCLUDES = -I$(srcdir)/include
 
+AM_CFLAGS = $(WX_CFLAGS)
+AM_CPPFLAGS = $(WX_CPPFLAGS) -DBUILDING_PLUGIN -DWXMAKINGDLL_CHART
+AM_CXXFLAGS = $(WX_CXXFLAGS)
+AM_LDFLAGS = $(WX_LIBS) @WIN32_DLLLDFLAGS@ @WIN32_DLLEXPSTDCALL@
 
 wxcontribitemsdir=$(libdir)/codeblocks/wxContribItems
 
 wxcontribitems_LTLIBRARIES = libwxchartctrl.la
 
-libwxchartctrl_la_LDFLAGS = -version-info 0:1:0
+libwxchartctrl_la_LDFLAGS = -version-info 0:1:0 -shared -no-undefined
 
 libwxchartctrl_la_LIBADD = $(WX_LIBS)
 
diff --git a/src/plugins/contrib/wxContribItems/wxled/Makefile.am b/src/plugins/contrib/wxContribItems/wxled/Makefile.am
index 0c7e440..f926e5a 100644
--- a/src/plugins/contrib/wxContribItems/wxled/Makefile.am
+++ b/src/plugins/contrib/wxContribItems/wxled/Makefile.am
@@ -1,16 +1,20 @@
 SUBDIRS = gizmosled/include/wx/gizmos lcdWindow/include/wx led/include/wx ledpanel/include/wx
 
 INCLUDES = -I$(srcdir)/gizmosled/include \
- $(WX_CXXFLAGS) \
--I$(srcdir)/ledpanel/include \
--I$(srcdir)/lcdWindow/include \
--I$(srcdir)/led/include
+	-I$(srcdir)/ledpanel/include \
+	-I$(srcdir)/lcdWindow/include \
+	-I$(srcdir)/led/include
+
+AM_CFLAGS = $(WX_CFLAGS)
+AM_CPPFLAGS = $(WX_CPPFLAGS) -DBUILDING_PLUGIN -DWXMAKINGDLL -DWXMAKINGDLL_GIZMOS -DWXMAKINGDLL_GIZMOS_XRC
+AM_CXXFLAGS = $(WX_CXXFLAGS)
+AM_LDFLAGS = $(WX_LIBS) @WIN32_DLLLDFLAGS@ @WIN32_DLLEXPSTDCALL@
 
 wxcontribitemsdir=$(libdir)/codeblocks/wxContribItems
 
 wxcontribitems_LTLIBRARIES = libwxled.la
 
-libwxled_la_LDFLAGS = -version-info 0:1:0
+libwxled_la_LDFLAGS = -version-info 0:1:0 -shared -no-undefined
 
 libwxled_la_LIBADD = $(WX_LIBS)
 
diff --git a/src/plugins/contrib/wxContribItems/wxled/lcdWindow/include/wx/lcdwindow.h b/src/plugins/contrib/wxContribItems/wxled/lcdWindow/include/wx/lcdwindow.h
index 6c4a0fd..b263b2d 100644
--- a/src/plugins/contrib/wxContribItems/wxled/lcdWindow/include/wx/lcdwindow.h
+++ b/src/plugins/contrib/wxContribItems/wxled/lcdWindow/include/wx/lcdwindow.h
@@ -11,7 +11,7 @@ struct wxDigitData
 };
 
 
-class wxLCDWindow : public wxWindow
+class WXDLLEXPORT wxLCDWindow : public wxWindow
 {
 protected:
 	int mSegmentLen;
diff --git a/src/plugins/contrib/wxContribItems/wxled/led/include/wx/led.h b/src/plugins/contrib/wxContribItems/wxled/led/include/wx/led.h
index 440dbf6..05d2254 100644
--- a/src/plugins/contrib/wxContribItems/wxled/led/include/wx/led.h
+++ b/src/plugins/contrib/wxContribItems/wxled/led/include/wx/led.h
@@ -18,7 +18,7 @@
 #include <wx/thread.h>
 
 /// Class to display a Led on the used dialogs page
-class wxLed : public wxWindow
+class WXDLLEXPORT wxLed : public wxWindow
 {
 	public :
         /** Constructor
diff --git a/src/plugins/contrib/wxContribItems/wxled/ledpanel/include/wx/wxledpanel.h b/src/plugins/contrib/wxContribItems/wxled/ledpanel/include/wx/wxledpanel.h
index 9245dec..1f90bc5 100644
--- a/src/plugins/contrib/wxContribItems/wxled/ledpanel/include/wx/wxledpanel.h
+++ b/src/plugins/contrib/wxContribItems/wxled/ledpanel/include/wx/wxledpanel.h
@@ -26,7 +26,7 @@ enum wxLEDColour
 	wxLED_COLOUR_GREY = 7
 };
 
-class wxLEDPanel : public wxControl
+class WXDLLEXPORT wxLEDPanel : public wxControl
 {
 	public:
 		// Ctor
diff --git a/src/plugins/contrib/wxContribItems/wxthings/Makefile.am b/src/plugins/contrib/wxContribItems/wxthings/Makefile.am
index 1aed8da..4822017 100644
--- a/src/plugins/contrib/wxContribItems/wxthings/Makefile.am
+++ b/src/plugins/contrib/wxContribItems/wxthings/Makefile.am
@@ -1,11 +1,15 @@
-INCLUDES = $(WX_CXXFLAGS) \
-		-I$(srcdir)/include
+INCLUDES = -I$(srcdir)/include
+
+AM_CFLAGS = $(WX_CFLAGS)
+AM_CPPFLAGS = $(WX_CPPFLAGS) -DBUILDING_PLUGIN -DWXMAKINGDLL_THINGS
+AM_CXXFLAGS = $(WX_CXXFLAGS)
+AM_LDFLAGS = $(WX_LIBS) @WIN32_DLLLDFLAGS@ @WIN32_DLLEXPSTDCALL@
 
 wxcontribitemsdir=$(libdir)/codeblocks/wxContribItems
 
 wxcontribitems_LTLIBRARIES = libwxcustombutton.la
 
-libwxcustombutton_la_LDFLAGS = -version-info 0:1:0
+libwxcustombutton_la_LDFLAGS = -version-info 0:1:0 -shared -no-undefined
 
 libwxcustombutton_la_LIBADD = $(WX_LIBS)
 
diff --git a/src/plugins/contrib/wxSmith/Makefile.am b/src/plugins/contrib/wxSmith/Makefile.am
index 366ead2..59e375a 100644
--- a/src/plugins/contrib/wxSmith/Makefile.am
+++ b/src/plugins/contrib/wxSmith/Makefile.am
@@ -1,7 +1,6 @@
 SUBDIRS = properties wxwidgets . plugin
 
-INCLUDES = $(WX_CXXFLAGS) \
-		-I$(top_srcdir)/src/include \
+INCLUDES = -I$(top_srcdir)/src/include \
 		-I$(top_srcdir)/src/sdk/wxscintilla/include \
 		$(WXPROPGRID_INCLUDE) \
 		-I$(top_srcdir)/src/include/scripting/include \
@@ -15,9 +14,14 @@ INCLUDES = $(WX_CXXFLAGS) \
 		-I$(top_srcdir)/src/include/mozilla_chardet/xpcom/base \
 		-I$(top_srcdir)/src/include/mozilla_chardet/xpcom/glue
 
+AM_CFLAGS = $(WX_CFLAGS)
+AM_CPPFLAGS = $(WX_CPPFLAGS) -DBUILDING_PLUGIN -DWXMAKINGDLL_PROPGRID -DwxPG_USE_WXMODULE=0
+AM_CXXFLAGS = $(WX_CXXFLAGS)
+AM_LDFLAGS = $(WX_LIBS) @WIN32_DLLLDFLAGS@ @WIN32_DLLEXPSTDCALL@
+
 lib_LTLIBRARIES = libwxsmithlib.la
 
-libwxsmithlib_la_LDFLAGS = -version-info 0:1:0 -shared
+libwxsmithlib_la_LDFLAGS = -no-undefined -version-info 0:1:0 -shared @WIN32_DLLLDFLAGS@ @WIN32_DLLEXPSTDCALL@
 
 libwxsmithlib_la_LIBADD = $(PLUGIN_WX_LIBS) \
 				../../../sdk/libcodeblocks.la \
@@ -77,7 +81,7 @@ EXTRA_DIST = \
 $(srcdir)/*.cbp \
 $(srcdir)/*.bat \
 $(srcdir)/update \
-$(srcdir)/wxsmith \
+$(srcdir)/wxsmith/* \
 manifest.xml
 
 pkgdata_DATA = wxsmith.zip
diff --git a/src/plugins/contrib/wxSmith/plugin/Makefile.am b/src/plugins/contrib/wxSmith/plugin/Makefile.am
index 72ea186..7dbfbaf 100644
--- a/src/plugins/contrib/wxSmith/plugin/Makefile.am
+++ b/src/plugins/contrib/wxSmith/plugin/Makefile.am
@@ -1,13 +1,17 @@
-INCLUDES = $(WX_CXXFLAGS) \
-		-I$(top_srcdir)/src/include \
+INCLUDES = -I$(top_srcdir)/src/include \
 		-I$(top_srcdir)/src/sdk/wxscintilla/include \
 		$(WXPROPGRID_INCLUDE)
 
+AM_CFLAGS = $(WX_CFLAGS)
+AM_CPPFLAGS = $(WX_CPPFLAGS) -DBUILDING_PLUGIN -DWXMAKINGDLL_PROPGRID -DwxPG_USE_WXMODULE=0
+AM_CXXFLAGS = $(WX_CXXFLAGS)
+AM_LDFLAGS = $(WX_LIBS) @WIN32_DLLLDFLAGS@ @WIN32_DLLEXPSTDCALL@
+
 pluginlib_LTLIBRARIES = libwxsmith.la
 
 pluginlibdir = $(pkglibdir)/plugins
 
-libwxsmith_la_LDFLAGS = -module -version-info 0:1:0 -shared -no-undefined -avoid-version
+libwxsmith_la_LDFLAGS = -module -version-info 0:1:0 -shared -no-undefined -avoid-version @WIN32_DLLLDFLAGS@ @WIN32_DLLEXPSTDCALL@
 
 libwxsmith_la_LIBADD = $(PLUGIN_WX_LIBS) ../../../../sdk/libcodeblocks.la ../libwxsmithlib.la
 
diff --git a/src/plugins/contrib/wxSmith/properties/Makefile.am b/src/plugins/contrib/wxSmith/properties/Makefile.am
index 9d0a744..dd858ab 100644
--- a/src/plugins/contrib/wxSmith/properties/Makefile.am
+++ b/src/plugins/contrib/wxSmith/properties/Makefile.am
@@ -1,8 +1,12 @@
-INCLUDES = $(WX_CXXFLAGS) \
-		-I$(top_srcdir)/src/include \
+INCLUDES = -I$(top_srcdir)/src/include \
 		-I$(top_srcdir)/src/sdk/wxscintilla/include \
 		$(WXPROPGRID_INCLUDE)
 
+AM_CFLAGS = $(WX_CFLAGS)
+AM_CPPFLAGS = $(WX_CPPFLAGS) -DBUILDING_PLUGIN -DwxPG_USE_WXMODULE=0
+AM_CXXFLAGS = $(WX_CXXFLAGS)
+AM_LDFLAGS = $(WX_LIBS) @WIN32_DLLLDFLAGS@ @WIN32_DLLEXPSTDCALL@
+
 noinst_LTLIBRARIES = libwxsmith_properties.la
 
 libwxsmith_properties_la_LDFLAGS = -module -version-info 0:1:0 -shared -no-undefined -avoid-version
diff --git a/src/plugins/contrib/wxSmith/wxwidgets/Makefile.am b/src/plugins/contrib/wxSmith/wxwidgets/Makefile.am
index ef95776..01a7a3e 100644
--- a/src/plugins/contrib/wxSmith/wxwidgets/Makefile.am
+++ b/src/plugins/contrib/wxSmith/wxwidgets/Makefile.am
@@ -1,7 +1,6 @@
 SUBDIRS = defitems icons properties
 
-INCLUDES = $(WX_CXXFLAGS) \
-		-I$(top_srcdir)/src/include \
+INCLUDES = -I$(top_srcdir)/src/include \
 		-I$(top_srcdir)/src/sdk/wxscintilla/include \
 		$(WXPROPGRID_INCLUDE) \
 		-I$(top_srcdir)/src/include/scripting/include \
@@ -9,6 +8,11 @@ INCLUDES = $(WX_CXXFLAGS) \
 		-I$(top_srcdir)/src/include/scripting/sqplus \
 		-I$(top_srcdir)/src/include/scripting/bindings
 
+AM_CFLAGS = $(WX_CFLAGS)
+AM_CPPFLAGS = $(WX_CPPFLAGS) -DWXMAKINGDLL_PROPGRID -DwxPG_USE_WXMODULE=0
+AM_CXXFLAGS = $(WX_CXXFLAGS)
+AM_LDFLAGS = $(WX_LIBS) @WIN32_DLLLDFLAGS@ @WIN32_DLLEXPSTDCALL@
+
 noinst_LTLIBRARIES = libwxsmith_wxwidgets.la
 
 libwxsmith_wxwidgets_la_LDFLAGS = -module -version-info 0:1:0 -shared -no-undefined -avoid-version
diff --git a/src/plugins/contrib/wxSmith/wxwidgets/defitems/Makefile.am b/src/plugins/contrib/wxSmith/wxwidgets/defitems/Makefile.am
index 5577946..3a638f8 100644
--- a/src/plugins/contrib/wxSmith/wxwidgets/defitems/Makefile.am
+++ b/src/plugins/contrib/wxSmith/wxwidgets/defitems/Makefile.am
@@ -1,8 +1,12 @@
-INCLUDES = $(WX_CXXFLAGS) \
-		-I$(top_srcdir)/src/include \
+INCLUDES = -I$(top_srcdir)/src/include \
 		-I$(top_srcdir)/src/sdk/wxscintilla/include \
 		$(WXPROPGRID_INCLUDE)
 
+AM_CFLAGS = $(WX_CFLAGS)
+AM_CPPFLAGS = $(WX_CPPFLAGS) -DWXMAKINGDLL_PROPGRID -DwxPG_USE_WXMODULE=0
+AM_CXXFLAGS = $(WX_CXXFLAGS)
+AM_LDFLAGS = $(WX_LIBS) @WIN32_DLLLDFLAGS@ @WIN32_DLLEXPSTDCALL@
+
 noinst_LTLIBRARIES = libwxsmith_wxwidgets_defitems.la
 
 libwxsmith_wxwidgets_defitems_la_LDFLAGS = -module -version-info 0:1:0 -shared -no-undefined -avoid-version
diff --git a/src/plugins/contrib/wxSmith/wxwidgets/properties/Makefile.am b/src/plugins/contrib/wxSmith/wxwidgets/properties/Makefile.am
index 1e0a57f..a41bba8 100644
--- a/src/plugins/contrib/wxSmith/wxwidgets/properties/Makefile.am
+++ b/src/plugins/contrib/wxSmith/wxwidgets/properties/Makefile.am
@@ -1,8 +1,12 @@
-INCLUDES = $(WX_CXXFLAGS) \
-		-I$(top_srcdir)/src/include \
+INCLUDES = -I$(top_srcdir)/src/include \
 		-I$(top_srcdir)/src/sdk/wxscintilla/include \
 		$(WXPROPGRID_INCLUDE)
 
+AM_CFLAGS = $(WX_CFLAGS)
+AM_CPPFLAGS = $(WX_CPPFLAGS) -DBUILDING_PLUGIN -DWXMAKINGDLL_PROPGRID -DwxPG_USE_WXMODULE=0
+AM_CXXFLAGS = $(WX_CXXFLAGS)
+AM_LDFLAGS = $(WX_LIBS) @WIN32_DLLLDFLAGS@ @WIN32_DLLEXPSTDCALL@
+
 noinst_LTLIBRARIES = libwxsmith_wxwidgets_properties.la
 
 libwxsmith_wxwidgets_properties_la_LDFLAGS = -module -version-info 0:1:0 -shared -no-undefined -avoid-version
diff --git a/src/plugins/contrib/wxSmithAui/Makefile.am b/src/plugins/contrib/wxSmithAui/Makefile.am
index 74b08d7..ddc8262 100644
--- a/src/plugins/contrib/wxSmithAui/Makefile.am
+++ b/src/plugins/contrib/wxSmithAui/Makefile.am
@@ -1,5 +1,4 @@
-INCLUDES = $(WX_CXXFLAGS) \
-		-I$(top_srcdir)/src/include \
+INCLUDES = -I$(top_srcdir)/src/include \
 		-I$(top_srcdir)/src/sdk/wxscintilla/include \
 		$(WXPROPGRID_INCLUDE) \
 		-I$(top_srcdir)/src/plugins/contrib/wxSmith \
@@ -7,6 +6,11 @@ INCLUDES = $(WX_CXXFLAGS) \
 		-I$(srcdir)/wxAuiNotebook \
 		-I$(srcdir)/wxAuiToolBar
 
+AM_CFLAGS = $(WX_CFLAGS)
+AM_CPPFLAGS = $(WX_CPPFLAGS) -DWXMAKINGDLL_PROPGRID -DwxPG_USE_WXMODULE=0
+AM_CXXFLAGS = $(WX_CXXFLAGS)
+AM_LDFLAGS = $(WX_LIBS) @WIN32_DLLLDFLAGS@ @WIN32_DLLEXPSTDCALL@
+
 pluginlibdir = $(pkglibdir)/plugins
 
 pluginlib_LTLIBRARIES = libwxSmithAui.la
diff --git a/src/plugins/contrib/wxSmithContribItems/Makefile.am b/src/plugins/contrib/wxSmithContribItems/Makefile.am
index 9d83bff..81f84b4 100644
--- a/src/plugins/contrib/wxSmithContribItems/Makefile.am
+++ b/src/plugins/contrib/wxSmithContribItems/Makefile.am
@@ -1,5 +1,4 @@
-INCLUDES = $(WX_CXXFLAGS) \
-		-I$(top_srcdir)/src/include \
+INCLUDES = -I$(top_srcdir)/src/include \
 		-I$(top_srcdir)/src/sdk/wxscintilla/include \
 		$(WXPROPGRID_INCLUDE) \
 		-I$(top_srcdir)/src/plugins/contrib/wxSmith \
@@ -18,6 +17,10 @@ INCLUDES = $(WX_CXXFLAGS) \
 		-I$(srcdir)/../wxContribItems/wxled/led/include \
 		-I$(srcdir)/../wxContribItems/wxled/ledpanel/include
 
+AM_CFLAGS = $(WX_CFLAGS)
+AM_CPPFLAGS = $(WX_CPPFLAGS) -DBUILDING_PLUGIN -DWXMAKINGDLL_PROPGRID -DwxPG_USE_WXMODULE=0
+AM_CXXFLAGS = $(WX_CXXFLAGS)
+AM_LDFLAGS = $(WX_LIBS) @WIN32_DLLLDFLAGS@ @WIN32_DLLEXPSTDCALL@
 
 pluginlibdir = $(pkglibdir)/plugins
 
diff --git a/src/plugins/debuggergdb/Makefile.am b/src/plugins/debuggergdb/Makefile.am
index e0517f2..3dceed0 100644
--- a/src/plugins/debuggergdb/Makefile.am
+++ b/src/plugins/debuggergdb/Makefile.am
@@ -1,10 +1,14 @@
 SUBDIRS = resources
 
-INCLUDES = $(WX_CXXFLAGS) \
-		-I$(top_srcdir)/src/include \
+INCLUDES = -I$(top_srcdir)/src/include \
 		-I$(top_srcdir)/src/sdk/wxscintilla/include \
 		-I$(top_srcdir)/src/include/scripting/include \
-    	-I$(top_srcdir)/src/include/scripting/sqplus
+		-I$(top_srcdir)/src/include/scripting/sqplus
+
+AM_CFLAGS = $(WX_CFLAGS)
+AM_CPPFLAGS = $(WX_CPPFLAGS) -DBUILDING_PLUGIN
+AM_CXXFLAGS = $(WX_CXXFLAGS)
+AM_LDFLAGS = $(WX_LIBS) @WIN32_DLLLDFLAGS@ @WIN32_DLLEXPSTDCALL@
 
 pluginlibdir = $(pkglibdir)/plugins
 
diff --git a/src/plugins/debuggergdb/debuggergdb.cpp b/src/plugins/debuggergdb/debuggergdb.cpp
index 300e8f3..c814cfa 100644
--- a/src/plugins/debuggergdb/debuggergdb.cpp
+++ b/src/plugins/debuggergdb/debuggergdb.cpp
@@ -58,7 +58,7 @@
 
 // function pointer to DebugBreakProcess under windows (XP+)
 #if (_WIN32_WINNT >= 0x0501)
-#include "Tlhelp32.h"
+#include "tlhelp32.h"
 typedef BOOL WINAPI   (*DebugBreakProcessApiCall)       (HANDLE);
 typedef HANDLE WINAPI (*CreateToolhelp32SnapshotApiCall)(DWORD  dwFlags,   DWORD             th32ProcessID);
 typedef BOOL WINAPI   (*Process32FirstApiCall)          (HANDLE hSnapshot, LPPROCESSENTRY32W lppe);
diff --git a/src/plugins/defaultmimehandler/Makefile.am b/src/plugins/defaultmimehandler/Makefile.am
index 7a31495..6810cd9 100644
--- a/src/plugins/defaultmimehandler/Makefile.am
+++ b/src/plugins/defaultmimehandler/Makefile.am
@@ -1,9 +1,13 @@
 SUBDIRS = resources
 
-INCLUDES = $(WX_CXXFLAGS) \
-		-I$(top_srcdir)/src/include \
+INCLUDES = -I$(top_srcdir)/src/include \
 		-I$(top_srcdir)/src/sdk/wxscintilla/include
 
+AM_CFLAGS = $(WX_CFLAGS)
+AM_CPPFLAGS = $(WX_CPPFLAGS) -DBUILDING_PLUGIN
+AM_CXXFLAGS = $(WX_CXXFLAGS)
+AM_LDFLAGS = $(WX_LIBS) @WIN32_DLLLDFLAGS@ @WIN32_DLLEXPSTDCALL@
+
 pluginlibdir = $(pkglibdir)/plugins
 
 pluginlib_LTLIBRARIES = libdefaultmimehandler.la
diff --git a/src/plugins/headerguard/Makefile.am b/src/plugins/headerguard/Makefile.am
new file mode 100644
index 0000000..c21af93
--- /dev/null
+++ b/src/plugins/headerguard/Makefile.am
@@ -0,0 +1,24 @@
+INCLUDES = -I$(top_srcdir)/src/include \
+		-I$(top_srcdir)/src/sdk/wxscintilla/include
+
+AM_CFLAGS = $(WX_CFLAGS)
+AM_CPPFLAGS = $(WX_CPPFLAGS) -DBUILDING_PLUGIN
+AM_CXXFLAGS = $(WX_CXXFLAGS)
+AM_LDFLAGS = $(WX_LIBS) @WIN32_DLLLDFLAGS@ @WIN32_DLLEXPSTDCALL@
+
+pluginlibdir = $(pkglibdir)/plugins
+
+pluginlib_LTLIBRARIES = libheaderguard.la
+
+libheaderguard_la_LDFLAGS = -module -version-info 0:1:0 -shared -no-undefined -avoid-version
+
+libheaderguard_la_LIBADD =  $(PLUGIN_WX_LIBS) ../../sdk/libcodeblocks.la
+
+libheaderguard_la_SOURCES = headerguard.cpp
+noinst_HEADERS = headerguard.h
+EXTRA_DIST = manifest.xml
+pkgdata_DATA = headerguard.zip
+CLEANFILES = $(pkgdata_DATA)
+
+headerguard.zip: $(EXTRA_DIST)
+	PWD=`pwd` cd $(srcdir) && zip $(PWD)/headerguard.zip manifest.xml > /dev/null
diff --git a/src/plugins/loghacker/Makefile.am b/src/plugins/loghacker/Makefile.am
new file mode 100644
index 0000000..44c3786
--- /dev/null
+++ b/src/plugins/loghacker/Makefile.am
@@ -0,0 +1,24 @@
+INCLUDES = -I$(top_srcdir)/src/include \
+		-I$(top_srcdir)/src/sdk/wxscintilla/include
+
+AM_CFLAGS = $(WX_CFLAGS)
+AM_CPPFLAGS = $(WX_CPPFLAGS) -DBUILDING_PLUGIN
+AM_CXXFLAGS = $(WX_CXXFLAGS)
+AM_LDFLAGS = $(WX_LIBS) @WIN32_DLLLDFLAGS@ @WIN32_DLLEXPSTDCALL@
+
+pluginlibdir = $(pkglibdir)/plugins
+
+pluginlib_LTLIBRARIES = libloghacker.la
+
+libloghacker_la_LDFLAGS = -module -version-info 0:1:0 -shared -no-undefined -avoid-version
+
+libloghacker_la_LIBADD =  $(PLUGIN_WX_LIBS) ../../sdk/libcodeblocks.la
+
+libloghacker_la_SOURCES = loghacker.cpp
+noinst_HEADERS = loghacker.h
+EXTRA_DIST = manifest.xml
+pkgdata_DATA = loghacker.zip
+CLEANFILES = $(pkgdata_DATA)
+
+loghacker.zip: $(EXTRA_DIST)
+	PWD=`pwd` cd $(srcdir) && zip $(PWD)/loghacker.zip manifest.xml > /dev/null
diff --git a/src/plugins/modpoller/Makefile.am b/src/plugins/modpoller/Makefile.am
new file mode 100644
index 0000000..2e7a8ee
--- /dev/null
+++ b/src/plugins/modpoller/Makefile.am
@@ -0,0 +1,24 @@
+INCLUDES = -I$(top_srcdir)/src/include \
+		-I$(top_srcdir)/src/sdk/wxscintilla/include
+
+AM_CFLAGS = $(WX_CFLAGS)
+AM_CPPFLAGS = $(WX_CPPFLAGS) -DBUILDING_PLUGIN
+AM_CXXFLAGS = $(WX_CXXFLAGS)
+AM_LDFLAGS = $(WX_LIBS) @WIN32_DLLLDFLAGS@ @WIN32_DLLEXPSTDCALL@
+
+pluginlibdir = $(pkglibdir)/plugins
+
+pluginlib_LTLIBRARIES = libModPoller.la
+
+libModPoller_la_LDFLAGS = -module -version-info 0:1:0 -shared -no-undefined -avoid-version
+
+libModPoller_la_LIBADD =  $(PLUGIN_WX_LIBS) ../../sdk/libcodeblocks.la
+
+libModPoller_la_SOURCES = ModPoller.cpp
+noinst_HEADERS = ModPoller.h
+EXTRA_DIST = manifest.xml
+pkgdata_DATA = ModPoller.zip
+CLEANFILES = $(pkgdata_DATA)
+
+ModPoller.zip: $(EXTRA_DIST)
+	PWD=`pwd` cd $(srcdir) && zip $(PWD)/ModPoller.zip manifest.xml > /dev/null
diff --git a/src/plugins/openfileslist/Makefile.am b/src/plugins/openfileslist/Makefile.am
index 1b9f299..ecac12a 100644
--- a/src/plugins/openfileslist/Makefile.am
+++ b/src/plugins/openfileslist/Makefile.am
@@ -1,7 +1,11 @@
-INCLUDES = $(WX_CXXFLAGS) \
-		-I$(top_srcdir)/src/include \
+INCLUDES = -I$(top_srcdir)/src/include \
 		-I$(top_srcdir)/src/sdk/wxscintilla/include
 
+AM_CFLAGS = $(WX_CFLAGS)
+AM_CPPFLAGS = $(WX_CPPFLAGS) -DBUILDING_PLUGIN
+AM_CXXFLAGS = $(WX_CXXFLAGS)
+AM_LDFLAGS = $(WX_LIBS) @WIN32_DLLLDFLAGS@ @WIN32_DLLEXPSTDCALL@
+
 pluginlibdir = $(pkglibdir)/plugins
 
 pluginlib_LTLIBRARIES = libopenfileslist.la
diff --git a/src/plugins/projectsimporter/Makefile.am b/src/plugins/projectsimporter/Makefile.am
index 94aeeaf..a833025 100644
--- a/src/plugins/projectsimporter/Makefile.am
+++ b/src/plugins/projectsimporter/Makefile.am
@@ -1,7 +1,6 @@
 SUBDIRS = resources
 
-INCLUDES = $(WX_CXXFLAGS) \
-		-I$(top_srcdir)/src/include \
+INCLUDES = -I$(top_srcdir)/src/include \
 		-I$(top_srcdir)/src/sdk/wxscintilla/include \
 		-I$(top_srcdir)/src/include/mozilla_chardet \
 		-I$(top_srcdir)/src/include/mozilla_chardet/mfbt \
@@ -10,6 +9,10 @@ INCLUDES = $(WX_CXXFLAGS) \
 		-I$(top_srcdir)/src/include/mozilla_chardet/xpcom/base \
 		-I$(top_srcdir)/src/include/mozilla_chardet/xpcom/glue
 
+AM_CFLAGS = $(WX_CFLAGS)
+AM_CPPFLAGS = $(WX_CPPFLAGS) -DBUILDING_PLUGIN -DWXMAKINGDLL_PROPGRID -DwxPG_USE_WXMODULE=0
+AM_CXXFLAGS = $(WX_CXXFLAGS)
+AM_LDFLAGS = $(WX_LIBS) @WIN32_DLLLDFLAGS@ @WIN32_DLLEXPSTDCALL@
 
 pluginlibdir = $(pkglibdir)/plugins
 
diff --git a/src/plugins/scriptedwizard/Makefile.am b/src/plugins/scriptedwizard/Makefile.am
index eabbcd9..eaf5f00 100644
--- a/src/plugins/scriptedwizard/Makefile.am
+++ b/src/plugins/scriptedwizard/Makefile.am
@@ -1,11 +1,15 @@
 SUBDIRS = resources
 
-INCLUDES = $(WX_CXXFLAGS) \
-		-I$(top_srcdir)/src/include \
+INCLUDES = -I$(top_srcdir)/src/include \
 		-I$(top_srcdir)/src/sdk/wxscintilla/include \
 		-I$(top_srcdir)/src/include/scripting/include \
 		-I$(top_srcdir)/src/include/scripting/sqplus
 
+AM_CFLAGS = $(WX_CFLAGS)
+AM_CPPFLAGS = $(WX_CPPFLAGS) -DBUILDING_PLUGIN
+AM_CXXFLAGS = $(WX_CXXFLAGS)
+AM_LDFLAGS = $(WX_LIBS) @WIN32_DLLLDFLAGS@ @WIN32_DLLEXPSTDCALL@
+
 pluginlibdir = $(pkglibdir)/plugins
 
 pluginlib_LTLIBRARIES = libscriptedwizard.la
@@ -15,9 +19,9 @@ libscriptedwizard_la_LDFLAGS = -module -version-info 0:1:0 -shared -no-undefined
 libscriptedwizard_la_LIBADD = $(PLUGIN_WX_LIBS) ../../sdk/libcodeblocks.la
 
 libscriptedwizard_la_SOURCES = buildtargetpanel.cpp \
-                                compilerpanel.cpp \
-                                filepathpanel.cpp \
-                                genericselectpath.cpp \
+								compilerpanel.cpp \
+								filepathpanel.cpp \
+								genericselectpath.cpp \
 								infopanel.cpp \
 								genericsinglechoicelist.cpp \
 								projectpathpanel.cpp \
@@ -25,9 +29,9 @@ libscriptedwizard_la_SOURCES = buildtargetpanel.cpp \
 								wizpage.cpp
 
 noinst_HEADERS = buildtargetpanel.h \
-                    compilerpanel.h \
-                    filepathpanel.h \
-                    genericselectpath.h \
+					compilerpanel.h \
+					filepathpanel.h \
+					genericselectpath.h \
 					infopanel.h \
 					genericsinglechoicelist.h \
 					projectpathpanel.h \
diff --git a/src/plugins/tidycmt/Makefile.am b/src/plugins/tidycmt/Makefile.am
new file mode 100644
index 0000000..8488941
--- /dev/null
+++ b/src/plugins/tidycmt/Makefile.am
@@ -0,0 +1,24 @@
+INCLUDES = -I$(top_srcdir)/src/include \
+		-I$(top_srcdir)/src/sdk/wxscintilla/include
+
+AM_CFLAGS = $(WX_CFLAGS)
+AM_CPPFLAGS = $(WX_CPPFLAGS) -DBUILDING_PLUGIN
+AM_CXXFLAGS = $(WX_CXXFLAGS)
+AM_LDFLAGS = $(WX_LIBS) @WIN32_DLLLDFLAGS@ @WIN32_DLLEXPSTDCALL@
+
+pluginlibdir = $(pkglibdir)/plugins
+
+pluginlib_LTLIBRARIES = libtidycmt.la
+
+libtidycmt_la_LDFLAGS = -module -version-info 0:1:0 -shared -no-undefined -avoid-version
+
+libtidycmt_la_LIBADD =  $(PLUGIN_WX_LIBS) ../../sdk/libcodeblocks.la
+
+libtidycmt_la_SOURCES = tidycmt.cpp
+noinst_HEADERS = tidycmt.h
+EXTRA_DIST = manifest.xml
+pkgdata_DATA = tidycmt.zip
+CLEANFILES = $(pkgdata_DATA)
+
+tidycmt.zip: $(EXTRA_DIST)
+	PWD=`pwd` cd $(srcdir) && zip $(PWD)/tidycmt.zip manifest.xml > /dev/null
diff --git a/src/plugins/todo/Makefile.am b/src/plugins/todo/Makefile.am
index ad09a8f..4902dd7 100644
--- a/src/plugins/todo/Makefile.am
+++ b/src/plugins/todo/Makefile.am
@@ -1,7 +1,6 @@
 SUBDIRS = resources
 
-INCLUDES = $(WX_CXXFLAGS) \
-		-I$(top_srcdir)/src/include \
+INCLUDES = -I$(top_srcdir)/src/include \
 		-I$(top_srcdir)/src/sdk/wxscintilla/include \
 		-I$(top_srcdir)/src/include/mozilla_chardet \
 		-I$(top_srcdir)/src/include/mozilla_chardet/mfbt \
@@ -11,6 +10,11 @@ INCLUDES = $(WX_CXXFLAGS) \
 		-I$(top_srcdir)/src/include/mozilla_chardet/xpcom/glue
 
 
+AM_CFLAGS = $(WX_CFLAGS)
+AM_CPPFLAGS = $(WX_CPPFLAGS) -DBUILDING_PLUGIN
+AM_CXXFLAGS = $(WX_CXXFLAGS)
+AM_LDFLAGS = $(WX_LIBS) @WIN32_DLLLDFLAGS@ @WIN32_DLLEXPSTDCALL@
+
 pluginlibdir = $(pkglibdir)/plugins
 
 pluginlib_LTLIBRARIES = libtodo.la
diff --git a/src/plugins/xpmanifest/Makefile.am b/src/plugins/xpmanifest/Makefile.am
index 0af2aa1..d26c189 100644
--- a/src/plugins/xpmanifest/Makefile.am
+++ b/src/plugins/xpmanifest/Makefile.am
@@ -1,7 +1,11 @@
-INCLUDES = $(WX_CXXFLAGS) \
-		-I$(top_srcdir)/src/include \
+INCLUDES = -I$(top_srcdir)/src/include \
 		-I$(top_srcdir)/src/sdk/wxscintilla/include
 
+AM_CFLAGS = $(WX_CFLAGS)
+AM_CPPFLAGS = $(WX_CPPFLAGS) -DBUILDING_PLUGIN
+AM_CXXFLAGS = $(WX_CXXFLAGS)
+AM_LDFLAGS = $(WX_LIBS) @WIN32_DLLLDFLAGS@ @WIN32_DLLEXPSTDCALL@
+
 pluginlibdir = $(pkglibdir)/plugins
 
 pluginlib_LTLIBRARIES = libxpmanifest.la
diff --git a/src/sdk/Makefile.am b/src/sdk/Makefile.am
index 119fdc9..875c7e1 100644
--- a/src/sdk/Makefile.am
+++ b/src/sdk/Makefile.am
@@ -1,13 +1,12 @@
 SUBDIRS = scripting wxscintilla $(WXPROPGRID_DIR) resources
 
-INCLUDES = $(WX_CXXFLAGS) \
-			-I$(top_srcdir)/src/include \
+INCLUDES = -I$(top_srcdir)/src/include \
 			-I$(top_srcdir)/src/sdk/wxscintilla/include \
 			 $(WXPROPGRID_INCLUDE) \
 			-I$(top_srcdir)/src/include/tinyxml \
 			-I$(top_srcdir)/src/include/scripting/include \
 			-I$(top_srcdir)/src/include/scripting/bindings \
- 			-I$(top_srcdir)/src/include/scripting/sqplus \
+			-I$(top_srcdir)/src/include/scripting/sqplus \
  			-I$(top_srcdir)/src/include/mozilla_chardet \
  			-I$(top_srcdir)/src/include/mozilla_chardet/mfbt \
  			-I$(top_srcdir)/src/include/mozilla_chardet/nsprpub/pr/include \
@@ -15,11 +14,16 @@ INCLUDES = $(WX_CXXFLAGS) \
  			-I$(top_srcdir)/src/include/mozilla_chardet/xpcom/base \
  			-I$(top_srcdir)/src/include/mozilla_chardet/xpcom/glue
 
+AM_CFLAGS = $(WX_CFLAGS)
+AM_CPPFLAGS = $(WX_CPPFLAGS) -DEXPORT_LIB -DEXPORT_EVENTS -DWXMAKINGDLL_SCI
+AM_CXXFLAGS = $(WX_CXXFLAGS)
+AM_LDFLAGS = $(WX_LIBS)
+
 lib_LTLIBRARIES = libcodeblocks.la
 
-libcodeblocks_la_LDFLAGS = -version-info @CODEBLOCKS_VERSION_INFO@
+libcodeblocks_la_LDFLAGS = -no-undefined -version-info @CODEBLOCKS_VERSION_INFO@ @WIN32_DLLLDFLAGS@ @WIN32_DLLEXPSTDCALL@ $(WX_LIBS) @WIN32_SHFOLDER@ @WIN32_GDI@
 
-libcodeblocks_la_LIBADD =  $(WX_LIBS) \
+libcodeblocks_la_LIBADD = \
 			scripting/bindings/libsqbindings.la \
 			scripting/sqplus/libsqplus.la \
 			scripting/sqstdlib/libsqstdlib.la \
diff --git a/src/sdk/configmanager.cpp b/src/sdk/configmanager.cpp
index 4eb3e2d..caafe1c 100644
--- a/src/sdk/configmanager.cpp
+++ b/src/sdk/configmanager.cpp
@@ -1455,6 +1455,7 @@ void ConfigManager::InitPaths()
             ConfigManager::plugin_path_global = data_path_global;
         else
         {
+#if !defined(__WXMSW__) && !defined(__WXMAC__)
             // It seems we can not longer rely on wxStandardPathsBase::Get().GetPluginsDir(),
             // because its behaviour has changed on some systems (at least Fedora 14 64-bit).
             // So we create the pathname manually
@@ -1465,6 +1466,7 @@ void ConfigManager::InitPaths()
                 // if standard-path does not exist and we are on 64-bit system, use lib64 instead
                 ConfigManager::plugin_path_global = ((const wxStandardPaths&)wxStandardPaths::Get()).GetInstallPrefix() + _T("/lib64/codeblocks/plugins");
             }
+#endif
         }
     }
 #endif
diff --git a/src/sdk/pluginmanager.cpp b/src/sdk/pluginmanager.cpp
index e64d05d..f7b92b2 100644
--- a/src/sdk/pluginmanager.cpp
+++ b/src/sdk/pluginmanager.cpp
@@ -730,7 +730,11 @@ bool PluginManager::ReadManifestFile(const wxString& pluginFilename,
         wxString actual = fname.GetFullName();
 
         // remove 'lib' prefix from plugin name (if any)
-        if (!platform::windows && actual.StartsWith(_T("lib")))
+	bool remove_lib(actual.StartsWith(_T("lib")));
+#ifndef CB_AUTOCONF
+	remove_lib = remove_lib && !platform::windows;
+#endif
+        if (remove_lib)
             actual.Remove(0, 3);
 
         actual = ConfigManager::LocateDataFile(actual, sdPluginsUser | sdDataUser | sdPluginsGlobal | sdDataGlobal);
@@ -949,7 +953,11 @@ int PluginManager::ScanForPlugins(const wxString& path)
         {
             // defaults
             if      (platform::windows)
+#ifdef CB_AUTOCONF
+                bbplugins.Add(_T("libcompiler.dll"));
+#else
                 bbplugins.Add(_T("compiler.dll"));
+#endif
             else if (platform::darwin || platform::macosx)
                 bbplugins.Add(_T("libcompiler.dylib"));
             else
diff --git a/src/sdk/scripting/bindings/Makefile.am b/src/sdk/scripting/bindings/Makefile.am
index ecf1fc8..c766041 100644
--- a/src/sdk/scripting/bindings/Makefile.am
+++ b/src/sdk/scripting/bindings/Makefile.am
@@ -1,10 +1,14 @@
-INCLUDES = $(WX_CXXFLAGS) \
-			-I$(top_srcdir)/src/include \
+INCLUDES = -I$(top_srcdir)/src/include \
 			-I$(top_srcdir)/src/sdk/wxscintilla/include \
 			-I$(top_srcdir)/src/include/scripting/include \
 			-I$(top_srcdir)/src/include/scripting/bindings \
 			-I$(top_srcdir)/src/include/scripting/sqplus
 
+AM_CFLAGS = $(WX_CFLAGS)
+AM_CPPFLAGS = $(WX_CPPFLAGS) -DEXPORT_LIB -DEXPORT_EVENTS -DWXMAKINGDLL_SCI
+AM_CXXFLAGS = $(WX_CXXFLAGS)
+AM_LDFLAGS = $(WX_LIBS)
+
 noinst_LTLIBRARIES = libsqbindings.la
 
 libsqbindings_la_SOURCES = scriptbindings.cpp \
diff --git a/src/sdk/scripting/sqplus/Makefile.am b/src/sdk/scripting/sqplus/Makefile.am
index deb87f3..1752946 100644
--- a/src/sdk/scripting/sqplus/Makefile.am
+++ b/src/sdk/scripting/sqplus/Makefile.am
@@ -1,13 +1,15 @@
 INCLUDES = -I$(top_srcdir)/src/include/scripting/include \
 					-I$(top_srcdir)/src/include/scripting/sqplus
 
+AM_CPPFLAGS = -DEXPORT_LIB -DEXPORT_EVENTS -DWXMAKINGDLL_SCI
+
 noinst_LTLIBRARIES = libsqplus.la
 
 libsqplus_la_SOURCES = SqPlus.cpp \
                         SquirrelVM.cpp \
                         SquirrelBindingsUtils.cpp \
                         SquirrelObject.cpp
-                        
+
 EXTRA_DIST = sqplus71.vcproj \
             sqplus.cbp \
             sqplus.vcproj \
diff --git a/src/sdk/scripting/sqstdlib/Makefile.am b/src/sdk/scripting/sqstdlib/Makefile.am
index 9132052..c6e7299 100644
--- a/src/sdk/scripting/sqstdlib/Makefile.am
+++ b/src/sdk/scripting/sqstdlib/Makefile.am
@@ -1,6 +1,8 @@
 INCLUDES = -I$(top_srcdir)/src/include/scripting/include \
 					-I$(top_srcdir)/src/include/scripting/sqstdlib
 
+AM_CPPFLAGS = -DEXPORT_LIB -DEXPORT_EVENTS -DWXMAKINGDLL_SCI
+
 noinst_LTLIBRARIES = libsqstdlib.la
 
 libsqstdlib_la_SOURCES = sqstdsystem.cpp \
@@ -11,7 +13,7 @@ libsqstdlib_la_SOURCES = sqstdsystem.cpp \
                         sqstdstring.cpp \
                         sqstdio.cpp \
                         sqstdblob.cpp
-                            
+
 EXTRA_DIST = sqstdlib71.vcproj \
             sqstdlib.cbp \
             sqstdlib.vcproj
diff --git a/src/sdk/scripting/squirrel/Makefile.am b/src/sdk/scripting/squirrel/Makefile.am
index 2a6fd53..58591c4 100644
--- a/src/sdk/scripting/squirrel/Makefile.am
+++ b/src/sdk/scripting/squirrel/Makefile.am
@@ -1,6 +1,8 @@
 INCLUDES = -I$(top_srcdir)/src/include/scripting/include \
 				-I$(top_srcdir)/src/include/scripting/squirrel
 
+AM_CPPFLAGS = -DEXPORT_LIB -DEXPORT_EVENTS -DWXMAKINGDLL_SCI
+
 noinst_LTLIBRARIES = libsquirrel.la
 
 libsquirrel_la_SOURCES = sqfuncstate.cpp \
@@ -15,7 +17,7 @@ libsquirrel_la_SOURCES = sqfuncstate.cpp \
                         sqobject.cpp \
                         sqapi.cpp \
                         sqdebug.cpp
-                            
+
 EXTRA_DIST = squirrel71.vcproj \
             squirrel.cbp \
             squirrellib.cbp \
diff --git a/src/sdk/wxpropgrid/Makefile.am b/src/sdk/wxpropgrid/Makefile.am
index a6342bc..ff62bf6 100644
--- a/src/sdk/wxpropgrid/Makefile.am
+++ b/src/sdk/wxpropgrid/Makefile.am
@@ -1,10 +1,21 @@
-INCLUDES = $(WX_CXXFLAGS) \
-		-I$(top_srcdir)/src/sdk/wxpropgrid/include
+INCLUDES = -I$(top_srcdir)/src/sdk/wxpropgrid/include
 
-AM_CPPFLAGS = -DEXPORT_LIB -DwxPG_SUPPORT_TOOLTIPS
+AM_CFLAGS = $(WX_CFLAGS)
+AM_CPPFLAGS = $(WX_CPPFLAGS) -DWXMAKINGLIB_PROPGRID -DwxPG_USE_WXMODULE=0 -DwxPG_SUPPORT_TOOLTIPS -DEXPORT_LIB
+AM_CXXFLAGS = $(WX_CXXFLAGS)
+AM_LDFLAGS = $(WX_LIBS)
 
+if WIN32
+lib_LTLIBRARIES = libwxpropgrid.la
+win32_dlls_ldflags = -Wl,--export-all-symbols
+else
 noinst_LTLIBRARIES = libwxpropgrid.la
+win32_dlls_ldflags =
+endif
 
+libwxpropgrid_la_LDFLAGS = $(win32_dlls_ldflags) -no-undefined
+
+libwxpropgrid_la_LIBADD = $(WX_LIBS)
 libwxpropgrid_la_SOURCES = ./src/advprops.cpp \
 			./src/editors.cpp \
 			./src/extras.cpp \
diff --git a/src/sdk/wxscintilla/Makefile.am b/src/sdk/wxscintilla/Makefile.am
index 1b0ed61..6da6d31 100644
--- a/src/sdk/wxscintilla/Makefile.am
+++ b/src/sdk/wxscintilla/Makefile.am
@@ -1,13 +1,24 @@
-INCLUDES = $(WX_CXXFLAGS) \
-			-I$(srcdir)/include \
+INCLUDES = -I$(srcdir)/include \
 			-I$(srcdir)/src/scintilla/include \
 			-I$(srcdir)/src/scintilla/lexlib \
 			-I$(srcdir)/src/scintilla/src
 
-AM_CPPFLAGS = -DSCI_LEXER -DLINK_LEXERS -DGTK -D__WX__
 
+if WIN32
+platform_cppflags =
+lib_LTLIBRARIES = libwxscintilla.la
+else
+platform_cppflags = -DGTK
 noinst_LTLIBRARIES = libwxscintilla.la
+endif
 
+AM_CFLAGS = $(WX_CFLAGS)
+AM_CPPFLAGS = $(WX_CPPFLAGS) -D__WX__ -DSCI_LEXER -DLINK_LEXERS -DWXMAKINGDLL_SCI $(platform_cppflags)
+AM_CXXFLAGS = $(WX_CXXFLAGS)
+AM_LDFLAGS = $(WX_LIBS) @WIN32_DLLLDFLAGS@ @WIN32_DLLEXPSTDCALL@
+
+libwxscintilla_la_LDFLAGS = -no-undefined @WIN32_DLLLDFLAGS@
+libwxscintilla_la_LIBADD = $(WX_LIBS) @WIN32_GDI@
 libwxscintilla_la_SOURCES = src/PlatWX.cpp \
 			src/ScintillaWX.cpp \
 			src/wxscintilla.cpp \
diff --git a/src/src/Makefile.am b/src/src/Makefile.am
index aa2ba7a..d6e38f0 100644
--- a/src/src/Makefile.am
+++ b/src/src/Makefile.am
@@ -1,7 +1,6 @@
 SUBDIRS = resources
 
-INCLUDES = $(WX_CXXFLAGS) \
-			-I$(top_srcdir)/src/sdk/wxscintilla/include \
+INCLUDES = -I$(top_srcdir)/src/sdk/wxscintilla/include \
 			$(WXPROPGRID_INCLUDE) \
 			-I$(top_srcdir)/src/include \
 			-I$(top_srcdir)/src/include/scripting/include \
@@ -18,9 +17,27 @@ GTK_NOTEBOOK_FLAGS = -DUSE_GTK_NOTEBOOK
 endif
 
 if CODEBLOCKS_LINUX
-AM_CPPFLAGS = -DENABLE_BINRELOC -DAPP_PREFIX="\"@prefix@\"" $(WX_GTK2_CFLAGS) $(GTK_NOTEBOOK_FLAGS)
+linux_cppflags = -DENABLE_BINRELOC -DAPP_PREFIX="\"@prefix@\"" $(WX_GTK2_CFLAGS) $(GTK_NOTEBOOK_FLAGS)
+else
+linux_cppflags =
 endif
 
+if WIN32
+win32_sources = associations.cpp ipc.cpp resources/resources.rc
+win32_ldflags = -Wl,--enable-auto-import -lshfolder -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwinspool -lwinmm -lcomctl32 -lodbc32 -lole32 -loleaut32 -luuid -lrpcrt4 -ladvapi32 -lwsock32
+
+.rc.o:
+	$(RC) -O coff -I$(top_srcdir)/src $(AM_CPPFLAGS) $(CPPFLAGS) $< $@
+else
+win32_sources = 
+win32_ldflags =
+endif
+
+AM_CFLAGS = $(WX_CFLAGS)
+AM_CPPFLAGS = $(WX_CPPFLAGS) -DBUILDING_PLUGIN $(linux_cppflags)
+AM_CXXFLAGS = $(WX_CXXFLAGS)
+AM_LDFLAGS = $(WX_LIBS) $(win32_ldflags)
+
 bin_PROGRAMS = codeblocks
 
 # wxMac resource fork/unbundled app
@@ -64,7 +81,8 @@ codeblocks_SOURCES = app.cpp \
 			startherepage.cpp \
 			switcherdlg.cpp \
 			threadsdlg.cpp \
-			watchesdlg.cpp
+			watchesdlg.cpp \
+			$(win32_sources)
 
 noinst_HEADERS = app.h \
 			appglobals.h \
diff --git a/src/tools/ConsoleRunner/Makefile.am b/src/tools/ConsoleRunner/Makefile.am
index 7e43b24..f506566 100644
--- a/src/tools/ConsoleRunner/Makefile.am
+++ b/src/tools/ConsoleRunner/Makefile.am
@@ -1,3 +1,8 @@
+AM_CFLAGS = $(WX_CFLAGS)
+AM_CPPFLAGS = $(WX_CPPFLAGS)
+AM_CXXFLAGS = $(WX_CXXFLAGS)
+AM_LDFLAGS = $(WX_LIBS)
+
 bin_PROGRAMS = cb_console_runner
 cb_console_runner_SOURCES = main.cpp
 
