Fix building with MSYS and MinGW(-w64); Improve Makefile.lite build system

This is a patch to allow building of the project using MSYS, MinGW, and MinGW-w64 with the following invocation:

make -f Makefile.lite libFLAC libFLAC++ flac metaflac test_libs_common test_libFLAC test_libFLAC++ test_grabbag test_seeking test_streams utils examples

This patch addresses eight points:
1. `uname -p` in MSYS returns "unknown" so we must use `gcc -dumpmachine` to gain information about the target, 32-bit or 64-bit.
2. MinGW-w64 does not ship with a working iconv.h, so we must disable it under this specific compiler.
3. The code requires <inttypes.h> in a handful of C files, but config.mk did not contain -DHAVE_INTTYPES_H, which under the full build process (I assume) is added by autoconf.
4. The compiler complained when lround() in lpc.c was static, so it is no longer static.
5. Additional scattered linking directives (and reordering) (particularly FLAC, grabbag, and replaygain_analysis) were necessary to build some of the components.
6. The Makefile.lite build system benefited from some cleanup, particularly by rigorously defining all entries, factoring redundancy, and establishing dependencies. (Some typos were fixed too.)
7. Shared objects on Windows use .dll, not .so. (Added *.dll, *.dylib, and *.exe to .gitignore.)
8. To allow more freedom using Makefile.lite without configure, I added the variables USE_OGG and USE_ICONV which can toggle these two components in the build process.
ex: make -f Makefile.lite examples USE_OGG=0 USE_ICONV=0

These improvements make use of some use-time Makefile variable expansion.

Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
diff --git a/Makefile.lite b/Makefile.lite
index 2ddaa01..23743f6 100644
--- a/Makefile.lite
+++ b/Makefile.lite
@@ -30,7 +30,7 @@
 
 topdir = .
 
-.PHONY: all doc src examples libFLAC libFLAC++ share plugin_common plugin_xmms flac metaflac test_grabbag test_libFLAC test_libFLAC++ test_seeking test_streams
+.PHONY: all doc src examples libFLAC libFLAC++ share plugin_common plugin_xmms flac metaflac test_grabbag test_libFLAC test_libFLAC++ test_seeking test_streams utils flacdiff flactimer
 all: doc src examples
 
 DEFAULT_CONFIG = release
@@ -48,47 +48,14 @@
 doc:
 	(cd $@ && $(MAKE) -f Makefile.lite)
 
-src:
+src examples:
 	(cd $@ && $(MAKE) -f Makefile.lite $(CONFIG))
 
-examples: src
-	(cd $@ && $(MAKE) -f Makefile.lite $(CONFIG))
-
-libFLAC:
+libFLAC libFLAC++ share flac metaflac plugin_common plugin_xmms test_libs_common test_seeking test_streams test_grabbag test_libFLAC test_libFLAC++:
 	(cd src/$@ && $(MAKE) -f Makefile.lite $(CONFIG))
 
-libFLAC++: libFLAC
-	(cd src/$@ && $(MAKE) -f Makefile.lite $(CONFIG))
-
-share: libFLAC
-	(cd src/$@ && $(MAKE) -f Makefile.lite $(CONFIG))
-
-flac: libFLAC share
-	(cd src/$@ && $(MAKE) -f Makefile.lite $(CONFIG))
-
-metaflac: libFLAC share
-	(cd src/$@ && $(MAKE) -f Makefile.lite $(CONFIG))
-
-plugin_common: libFLAC
-	(cd src/$@ && $(MAKE) -f Makefile.lite $(CONFIG))
-
-plugin_xmms: libFLAC plugin_common
-	(cd src/$@ && $(MAKE) -f Makefile.lite $(CONFIG))
-
-test_seeking: libFLAC
-	(cd src/$@ && $(MAKE) -f Makefile.lite $(CONFIG))
-
-test_streams: libFLAC
-	(cd src/$@ && $(MAKE) -f Makefile.lite $(CONFIG))
-
-test_grabbag: share
-	(cd src/$@ && $(MAKE) -f Makefile.lite $(CONFIG))
-
-test_libFLAC: libFLAC
-	(cd src/$@ && $(MAKE) -f Makefile.lite $(CONFIG))
-
-test_libFLAC++: libFLAC libFLAC++
-	(cd src/$@ && $(MAKE) -f Makefile.lite $(CONFIG))
+flacdiff flactimer:
+	(cd src/utils/$@ && $(MAKE) -f Makefile.lite $(CONFIG))
 
 test: debug
 	(cd test && $(MAKE) -f Makefile.lite debug)
@@ -104,3 +71,6 @@
 	-(cd src && $(MAKE) -f Makefile.lite clean)
 	-(cd examples && $(MAKE) -f Makefile.lite clean)
 	-(cd test && $(MAKE) -f Makefile.lite clean)
+
+examples: libFLAC libFLAC++ share
+include $(topdir)/Makefile.deps