Hello,

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.

---
  .gitignore                              |  3 ++
  Makefile.deps                           | 32 ++++++++++++++++++
  Makefile.lite                           | 46 +++++--------------------
  build/config.mk                         | 59 
++++++++++++++++++++++++++++++---
  build/exe.mk                            |  8 ++---
  build/lib.mk                            | 23 +++++++------
  examples/c/decode/file/Makefile.lite    |  4 +--
  examples/c/encode/file/Makefile.lite    |  4 +--
  examples/cpp/decode/file/Makefile.lite  |  4 +--
  examples/cpp/encode/file/Makefile.lite  |  4 +--
  src/Makefile.lite                       | 29 ++++++++--------
  src/flac/Makefile.am                    |  2 +-
  src/flac/Makefile.lite                  |  6 ++--
  src/flac/Makefile.lite.iffscan          |  8 ++---
  src/libFLAC++/Makefile.lite             |  7 ++++
  src/libFLAC/Makefile.lite               | 29 ++++++++++------
  src/libFLAC/lpc.c                       |  2 +-
  src/metaflac/Makefile.am                |  2 +-
  src/metaflac/Makefile.lite              |  6 ++--
  src/plugin_xmms/Makefile.lite           |  5 +--
  src/share/Makefile.lite                 |  6 ++--
  src/share/grabbag/Makefile.lite         |  8 +++++
  src/share/utf8/Makefile.lite            |  8 +++++
  src/test_grabbag/cuesheet/Makefile.lite |  4 +--
  src/test_grabbag/picture/Makefile.lite  |  4 +--
  src/test_libFLAC++/Makefile.lite        |  4 +--
  src/test_libFLAC/Makefile.lite          |  4 +--
  src/test_libs_common/Makefile.lite      |  6 ++++
  src/test_seeking/Makefile.lite          |  4 +--
  src/utils/flacdiff/Makefile.lite        |  4 +--
  src/utils/flactimer/Makefile.lite       | 42 +++++++++++++++++++++++
  31 files changed, 256 insertions(+), 121 deletions(-)
  create mode 100644 Makefile.deps
  create mode 100644 src/utils/flactimer/Makefile.lite

diff --git a/.gitignore b/.gitignore
index ba4fb7c..03557e5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,6 +2,9 @@
  *.la
  *.lo
  *.so
+*.dll
+*.dylib
+*.exe
  .deps
  .libs
  Makefile
diff --git a/Makefile.deps b/Makefile.deps
new file mode 100644
index 0000000..f3cad59
--- /dev/null
+++ b/Makefile.deps
@@ -0,0 +1,32 @@
+#  FLAC - Free Lossless Audio Codec
+#  Copyright (C) 2001,2002,2003,2004,2005,2006,2007,2008,2009  Josh Coalson
+#
+#  This file is part the FLAC project.  FLAC is comprised of several
+#  components distributed under difference licenses.  The codec libraries
+#  are distributed under Xiph.Org's BSD-like license (see the file
+#  COPYING.Xiph in this distribution).  All other programs, libraries, and
+#  plugins are distributed under the GPL (see COPYING.GPL).  The 
documentation
+#  is distributed under the Gnu FDL (see COPYING.FDL).  Each file in the
+#  FLAC distribution contains at the top the terms under which it may be
+#  distributed.
+#
+#  Since this particular file is relevant to all components of FLAC,
+#  it may be distributed under the Xiph.Org license, which is the least
+#  restrictive of those mentioned above.  See the file COPYING.Xiph in this
+#  distribution.
+
+flac: libFLAC share
+libFLAC++: libFLAC
+metaflac: libFLAC share
+plugin_common: libFLAC
+plugin_xmms: libFLAC plugin_common
+share: libFLAC
+test_grabbag: share
+test_libs_common: libFLAC
+test_libFLAC++: libFLAC libFLAC++ test_libs_common
+test_libFLAC: libFLAC test_libs_common
+test_seeking: libFLAC
+test_streams: libFLAC
+flacdiff: libFLAC libFLAC++
+flactimer: libFLAC libFLAC++
+utils: flacdiff flactimer
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 @@ release : all
  doc:
      (cd $@ && $(MAKE) -f Makefile.lite)

-src:
+src examples:
      (cd $@ && $(MAKE) -f Makefile.lite $(CONFIG))

-examples: src
-    (cd $@ && $(MAKE) -f Makefile.lite $(CONFIG))
-
-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
+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))

-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 @@ clean:
      -(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
diff --git a/build/config.mk b/build/config.mk
index 3bd6637..68287ca 100644
--- a/build/config.mk
+++ b/build/config.mk
@@ -16,15 +16,41 @@
  #  distribution.

  #
+# customizable settings from the make invocation
+#
+
+USE_OGG     ?= 1
+USE_ICONV   ?= 1
+
+#
  # debug/release selection
  #

  DEFAULT_BUILD = release

-# returns i386, x86_64, powerpc, etc.
-PROC := $(shell uname -p)
  # returns Linux, Darwin, FreeBSD, etc.
-OS := $(shell uname -s)
+ifdef OS_OVERRIDE
+    OS := $(OS_OVERRIDE)
+else
+    OS := $(shell uname -s)
+endif
+# returns i386, x86_64, powerpc, etc.
+ifdef PROC_OVERRIDE
+    PROC := $(PROC_OVERRIDE)
+else
+    ifeq ($(findstring MINGW,$(OS)),MINGW)
+        PROC := i386 # failsafe
+        # ifeq (mingw32,$(shell gcc -dumpmachine)) # MinGW (mainline): 
mingw32
+        ifeq ($(findstring i686,$(shell gcc -dumpmachine)),i686) # 
MinGW-w64: i686-w64-mingw32
+            USE_ICONV := 0
+        else ifeq ($(findstring x86_64,$(shell gcc 
-dumpmachine)),x86_64) # MinGW-w64: x86_64-w64-mingw32
+            USE_ICONV := 0
+            PROC := x86_64
+        endif
+    else
+        PROC := $(shell uname -p)
+    endif
+endif

  debug    : BUILD = debug
  valgrind : BUILD = debug
@@ -47,10 +73,33 @@ all default: $(DEFAULT_BUILD)

  VERSION=\"1.2.1\"

+CONFIG_CFLAGS=-DHAVE_STDINT_H -DHAVE_INTTYPES_H -DHAVE_CXX_VARARRAYS 
-DHAVE_LANGINFO_CODESET -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
+
  ifeq ($(OS),Darwin)
-CONFIG_CFLAGS=-DHAVE_STDINT_H -DHAVE_ICONV -DHAVE_CXX_VARARRAYS 
-DHAVE_LANGINFO_CODESET -DFLAC__HAS_OGG -D_LARGEFILE_SOURCE 
-D_FILE_OFFSET_BITS=64 -DFLAC__SYS_DARWIN -DWORDS_BIGENDIAN
+    CONFIG_CFLAGS += -DFLAC__SYS_DARWIN -DWORDS_BIGENDIAN
+else
+    CONFIG_CFLAGS += -DHAVE_SOCKLEN_T
+endif
+
+ifneq (0,$(USE_ICONV))
+    CONFIG_CFLAGS += -DHAVE_ICONV
+    ICONV_LIBS = -liconv
+else
+    ICONV_LIBS =
+endif
+
+ifneq (0,$(USE_OGG))
+    CONFIG_CFLAGS += -DFLAC__HAS_OGG=1
+    OGG_INCLUDES = -I$(OGG_INCLUDE_DIR)
+    OGG_EXPLICIT_LIBS = $(OGG_LIB_DIR)/libogg.a
+    OGG_LIBS = -L$(OGG_LIB_DIR) -logg
+    OGG_SRCS = $(OGG_SRCS_C)
  else
-CONFIG_CFLAGS=-DHAVE_STDINT_H -DHAVE_ICONV -DHAVE_CXX_VARARRAYS 
-DHAVE_LANGINFO_CODESET -DHAVE_SOCKLEN_T -DFLAC__HAS_OGG 
-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
+    CONFIG_CFLAGS += -DFLAC__HAS_OGG=0
+    OGG_INCLUDES =
+    OGG_EXPLICIT_LIBS =
+    OGG_LIBS =
+    OGG_SRCS =
  endif

  OGG_INCLUDE_DIR=$(HOME)/local/include
diff --git a/build/exe.mk b/build/exe.mk
index 938dee4..b283d1a 100644
--- a/build/exe.mk
+++ b/build/exe.mk
@@ -22,11 +22,11 @@
  include $(topdir)/build/config.mk

  ifeq ($(OS),Darwin)
-CC          = cc
-CCC         = c++
+    CC          = cc
+    CCC         = c++
  else
-CC          = gcc
-CCC         = g++
+    CC          = gcc
+    CCC         = g++
  endif
  NASM        = nasm
  LINK        = $(CC) $(LINKAGE)
diff --git a/build/lib.mk b/build/lib.mk
index 32f9a22..cce311e 100644
--- a/build/lib.mk
+++ b/build/lib.mk
@@ -22,11 +22,11 @@
  include $(topdir)/build/config.mk

  ifeq ($(OS),Darwin)
-CC          = cc
-CCC         = c++
+    CC          = cc
+    CCC         = c++
  else
-CC          = gcc
-CCC         = g++
+    CC          = gcc
+    CCC         = g++
  endif
  AS          = as
  NASM        = nasm
@@ -36,11 +36,14 @@ LIBPATH     = $(OBJPATH)/$(BUILD)/lib
  DEBUG_LIBPATH     = $(OBJPATH)/debug/lib
  RELEASE_LIBPATH   = $(OBJPATH)/release/lib
  ifeq ($(OS),Darwin)
-STATIC_LIB_SUFFIX = a
-DYNAMIC_LIB_SUFFIX = dylib
+    STATIC_LIB_SUFFIX = a
+    DYNAMIC_LIB_SUFFIX = dylib
+else ifeq ($(findstring MINGW,$(OS)),MINGW)
+    STATIC_LIB_SUFFIX = a
+    DYNAMIC_LIB_SUFFIX = dll
  else
-STATIC_LIB_SUFFIX = a
-DYNAMIC_LIB_SUFFIX = so
+    STATIC_LIB_SUFFIX = a
+    DYNAMIC_LIB_SUFFIX = so
  endif
  STATIC_LIB_NAME     = $(LIB_NAME).$(STATIC_LIB_SUFFIX)
  DYNAMIC_LIB_NAME    = $(LIB_NAME).$(DYNAMIC_LIB_SUFFIX)
@@ -51,9 +54,9 @@ DEBUG_DYNAMIC_LIB   = $(DEBUG_LIBPATH)/$(DYNAMIC_LIB_NAME)
  RELEASE_STATIC_LIB  = $(RELEASE_LIBPATH)/$(STATIC_LIB_NAME)
  RELEASE_DYNAMIC_LIB = $(RELEASE_LIBPATH)/$(DYNAMIC_LIB_NAME)
  ifeq ($(OS),Darwin)
-LINKD       = $(CC) -dynamiclib -flat_namespace -undefined suppress 
-install_name $(DYNAMIC_LIB)
+    LINKD       = $(CC) -dynamiclib -flat_namespace -undefined suppress 
-install_name $(DYNAMIC_LIB)
  else
-LINKD       = $(CC) -shared
+    LINKD       = $(CC) -shared
  endif

  debug   : CFLAGS = -g -O0 -DDEBUG $(CONFIG_CFLAGS) $(DEBUG_CFLAGS) -W 
-Wall -Wmissing-prototypes -Wstrict-prototypes -DVERSION=$(VERSION) 
$(DEFINES) $(INCLUDES)
diff --git a/examples/c/decode/file/Makefile.lite 
b/examples/c/decode/file/Makefile.lite
index fb43c5f..35bfa5c 100644
--- a/examples/c/decode/file/Makefile.lite
+++ b/examples/c/decode/file/Makefile.lite
@@ -27,9 +27,9 @@ PROGRAM_NAME = example_c_decode_file
  INCLUDES = -I$(topdir)/include

  ifeq ($(OS),Darwin)
-EXPLICIT_LIBS = $(libdir)/libFLAC.a $(OGG_LIB_DIR)/libogg.a -lm
+    EXPLICIT_LIBS = $(libdir)/libFLAC.a $(OGG_EXPLICIT_LIBS) -lm
  else
-LIBS = -lFLAC -L$(OGG_LIB_DIR) -logg -lm
+    LIBS = -lFLAC $(OGG_LIBS) -lm
  endif

  SRCS_C = main.c
diff --git a/examples/c/encode/file/Makefile.lite 
b/examples/c/encode/file/Makefile.lite
index ff9db59..9def573 100644
--- a/examples/c/encode/file/Makefile.lite
+++ b/examples/c/encode/file/Makefile.lite
@@ -27,9 +27,9 @@ PROGRAM_NAME = example_c_encode_file
  INCLUDES = -I$(topdir)/include

  ifeq ($(OS),Darwin)
-EXPLICIT_LIBS = $(libdir)/libFLAC.a $(OGG_LIB_DIR)/libogg.a -lm
+    EXPLICIT_LIBS = $(libdir)/libFLAC.a $(OGG_EXPLICIT_LIBS) -lm
  else
-LIBS = -lFLAC -L$(OGG_LIB_DIR) -logg -lm
+    LIBS = -lFLAC $(OGG_LIBS) -lm
  endif

  SRCS_C = main.c
diff --git a/examples/cpp/decode/file/Makefile.lite 
b/examples/cpp/decode/file/Makefile.lite
index 6d25c87..ccf1e63 100644
--- a/examples/cpp/decode/file/Makefile.lite
+++ b/examples/cpp/decode/file/Makefile.lite
@@ -27,9 +27,9 @@ PROGRAM_NAME = example_cpp_decode_file
  INCLUDES = -I$(topdir)/include

  ifeq ($(OS),Darwin)
-EXPLICIT_LIBS = $(libdir)/libFLAC++.a $(libdir)/libFLAC.a 
$(OGG_LIB_DIR)/libogg.a -lm
+    EXPLICIT_LIBS = $(libdir)/libFLAC++.a $(libdir)/libFLAC.a 
$(OGG_EXPLICIT_LIBS) -lm
  else
-LIBS = -lFLAC++ -lFLAC -L$(OGG_LIB_DIR) -logg -lm
+    LIBS = -lFLAC++ -lFLAC $(OGG_LIBS) -lm
  endif

  SRCS_CPP = main.cpp
diff --git a/examples/cpp/encode/file/Makefile.lite 
b/examples/cpp/encode/file/Makefile.lite
index 001fc6e..a6926b9 100644
--- a/examples/cpp/encode/file/Makefile.lite
+++ b/examples/cpp/encode/file/Makefile.lite
@@ -27,9 +27,9 @@ PROGRAM_NAME = example_cpp_encode_file
  INCLUDES = -I$(topdir)/include

  ifeq ($(OS),Darwin)
-EXPLICIT_LIBS = $(libdir)/libFLAC++.a $(libdir)/libFLAC.a 
$(OGG_LIB_DIR)/libogg.a -lm
+    EXPLICIT_LIBS = $(libdir)/libFLAC++.a $(libdir)/libFLAC.a 
$(OGG_EXPLICIT_LIBS) -lm
  else
-LIBS = -lFLAC++ -lFLAC -L$(OGG_LIB_DIR) -logg -lm
+    LIBS = -lFLAC++ -lFLAC $(OGG_LIBS) -lm
  endif

  SRCS_CPP = main.cpp
diff --git a/src/Makefile.lite b/src/Makefile.lite
index bd2aff9..82874a0 100644
--- a/src/Makefile.lite
+++ b/src/Makefile.lite
@@ -20,17 +20,17 @@ topdir = ..
  include $(topdir)/build/config.mk

  ifeq ($(OS),Darwin)
-EXTRA_TARGETS =
+    EXTRA_TARGETS =
  else
  ifeq ($(PROC),x86_64)
-EXTRA_TARGETS =
+    EXTRA_TARGETS =
  else
-EXTRA_TARGETS = plugin_xmms
+    EXTRA_TARGETS = plugin_xmms
  endif
  endif

-.PHONY: all flac libFLAC libFLAC++ metaflac plugin_common plugin_xmms 
share test_grabbag test_libs_common test_libFLAC test_libFLAC++ 
test_seeking test_streams
-all: flac libFLAC libFLAC++ metaflac plugin_common $(EXTRA_TARGETS) 
share test_grabbag test_libs_common test_libFLAC test_libFLAC++ 
test_seeking test_streams
+.PHONY: all flac libFLAC libFLAC++ metaflac plugin_common plugin_xmms 
share test_grabbag test_libs_common test_libFLAC test_libFLAC++ 
test_seeking test_streams utils flacdiff flactimer
+all: flac libFLAC libFLAC++ metaflac plugin_common $(EXTRA_TARGETS) 
share test_grabbag test_libs_common test_libFLAC test_libFLAC++ 
test_seeking test_streams utils

  DEFAULT_CONFIG = release

@@ -44,9 +44,14 @@ debug   : all
  valgrind: all
  release : all

+all: flac libFLAC libFLAC++ metaflac plugin_common plugin_xmms share 
test_grabbag test_libs_common test_libFLAC test_libFLAC++ test_seeking 
test_streams utils
+
  flac libFLAC libFLAC++ metaflac plugin_common plugin_xmms share 
test_grabbag test_libs_common test_libFLAC test_libFLAC++ test_seeking 
test_streams:
      (cd $@ ; $(MAKE) -f Makefile.lite $(CONFIG))

+flacdiff flactimer:
+    (cd utils/$@ ; $(MAKE) -f Makefile.lite $(CONFIG))
+
  clean:
      -(cd flac ; $(MAKE) -f Makefile.lite clean)
      -(cd libFLAC ; $(MAKE) -f Makefile.lite clean)
@@ -61,15 +66,7 @@ clean:
      -(cd test_libFLAC++ ; $(MAKE) -f Makefile.lite clean)
      -(cd test_seeking ; $(MAKE) -f Makefile.lite clean)
      -(cd test_streams ; $(MAKE) -f Makefile.lite clean)
+    -(cd utils/flacdiff ; $(MAKE) -f Makefile.lite clean)
+    -(cd utils/flactimer ; $(MAKE) -f Makefile.lite clean)

-flac: libFLAC share
-libFLAC++: libFLAC
-metaflac: libFLAC share
-plugin_common: libFLAC
-plugin_xmms: libFLAC plugin_common
-share: libFLAC
-test_grabbag: share
-test_libFLAC++: libFLAC libFLAC++ test_libs_common
-test_libFLAC: libFLAC test_libs_common
-test_seeking: libFLAC
-test_streams: libFLAC
+include $(topdir)/Makefile.deps
diff --git a/src/flac/Makefile.am b/src/flac/Makefile.am
index abc10f5..38fc347 100644
--- a/src/flac/Makefile.am
+++ b/src/flac/Makefile.am
@@ -47,9 +47,9 @@ flac_SOURCES = \

  flac_LDADD = \
      $(top_builddir)/src/share/utf8/libutf8.la \
+ $(top_builddir)/src/share/replaygain_analysis/libreplaygain_analysis.la \
      $(top_builddir)/src/share/grabbag/libgrabbag.la \
      $(top_builddir)/src/share/getopt/libgetopt.a \
- $(top_builddir)/src/share/replaygain_analysis/libreplaygain_analysis.la \
$(top_builddir)/src/share/replaygain_synthesis/libreplaygain_synthesis.la \
      $(top_builddir)/src/libFLAC/libFLAC.la \
      @OGG_LIBS@ \
diff --git a/src/flac/Makefile.lite b/src/flac/Makefile.lite
index 5d7a01e..0e5329f 100644
--- a/src/flac/Makefile.lite
+++ b/src/flac/Makefile.lite
@@ -24,12 +24,12 @@ libdir = $(topdir)/obj/$(BUILD)/lib

  PROGRAM_NAME = flac

-INCLUDES = -I./include -I$(topdir)/include -I$(OGG_INCLUDE_DIR)
+INCLUDES = -I./include -I$(topdir)/include $(OGG_INCLUDES)

  ifeq ($(OS),Darwin)
-EXPLICIT_LIBS = $(libdir)/libgrabbag.a $(libdir)/libFLAC.a 
$(libdir)/libreplaygain_analysis.a $(libdir)/libreplaygain_synthesis.a 
$(libdir)/libgetopt.a $(libdir)/libutf8.a $(OGG_LIB_DIR)/libogg.a 
-liconv -lm
+    EXPLICIT_LIBS = $(libdir)/libgrabbag.a $(libdir)/libFLAC.a 
$(libdir)/libreplaygain_analysis.a $(libdir)/libreplaygain_synthesis.a 
$(libdir)/libgetopt.a $(libdir)/libutf8.a $(OGG_EXPLICIT_LIBS) 
$(ICONV_LIBS) -lm
  else
-LIBS = -lgrabbag -lFLAC -lreplaygain_analysis -lreplaygain_synthesis 
-lgetopt -lutf8 -L$(OGG_LIB_DIR) -logg -lm
+    LIBS = -lgrabbag -lFLAC -lreplaygain_analysis 
-lreplaygain_synthesis -lgetopt -lutf8 -lgrabbag $(OGG_LIBS) -lm
  endif

  SRCS_C = \
diff --git a/src/flac/Makefile.lite.iffscan b/src/flac/Makefile.lite.iffscan
index 450808a..cfbed78 100644
--- a/src/flac/Makefile.lite.iffscan
+++ b/src/flac/Makefile.lite.iffscan
@@ -24,12 +24,12 @@ libdir = $(topdir)/obj/$(BUILD)/lib

  PROGRAM_NAME = iffscan

-INCLUDES = -I./include -I$(topdir)/include -I$(OGG_INCLUDE_DIR)
+INCLUDES = -I./include -I$(topdir)/include $(OGG_INCLUDES)

-ifeq ($(DARWIN_BUILD),yes)
-EXPLICIT_LIBS = $(libdir)/libFLAC.a $(OGG_LIB_DIR)/libogg.a -liconv -lm
+ifeq ($(OS),Darwin)
+    EXPLICIT_LIBS = $(libdir)/libFLAC.a $(OGG_EXPLICIT_LIBS) 
$(ICONV_LIBS) -lm
  else
-LIBS = -lFLAC -L$(OGG_LIB_DIR) -logg -lm
+    LIBS = -lFLAC $(OGG_LIBS) -lm
  endif

  SRCS_C = \
diff --git a/src/libFLAC++/Makefile.lite b/src/libFLAC++/Makefile.lite
index 5745473..209cf74 100644
--- a/src/libFLAC++/Makefile.lite
+++ b/src/libFLAC++/Makefile.lite
@@ -33,6 +33,13 @@
  #

  topdir = ../..
+libdir = $(topdir)/obj/$(BUILD)/lib
+
+ifeq ($(OS),Darwin)
+    EXPLICIT_LIBS = $(libdir)/libFLAC.a $(OGG_EXPLICIT_LIBS) -lm -lstdc++
+else
+    LIBS = -lFLAC $(OGG_LIBS) -lm -lsupc++
+endif

  LIB_NAME = libFLAC++
  INCLUDES = -I$(topdir)/include
diff --git a/src/libFLAC/Makefile.lite b/src/libFLAC/Makefile.lite
index af67728..0eeaca2 100644
--- a/src/libFLAC/Makefile.lite
+++ b/src/libFLAC/Makefile.lite
@@ -34,21 +34,27 @@

  topdir = ../..

+ifeq ($(OS),Darwin)
+    EXPLICIT_LIBS = $(OGG_EXPLICIT_LIBS) -lm
+else
+    LIBS = $(OGG_LIBS) -lm
+endif
+
  LIB_NAME = libFLAC
  ifeq ($(OS),Darwin)
-DEFINES = -DFLAC__CPU_PPC -DFLAC__USE_ALTIVEC -DFLAC__ALIGN_MALLOC_DATA
+    DEFINES = -DFLAC__CPU_PPC -DFLAC__USE_ALTIVEC -DFLAC__ALIGN_MALLOC_DATA
  else
  ifeq ($(OS),Solaris)
-DEFINES = -DFLAC__NO_ASM -DFLAC__ALIGN_MALLOC_DATA
+    DEFINES = -DFLAC__NO_ASM -DFLAC__ALIGN_MALLOC_DATA
  else
  ifeq ($(PROC),i386)
-DEFINES = -DFLAC__CPU_IA32 -DFLAC__USE_3DNOW -DFLAC__HAS_NASM 
-DFLAC__ALIGN_MALLOC_DATA
+    DEFINES = -DFLAC__CPU_IA32 -DFLAC__USE_3DNOW -DFLAC__HAS_NASM 
-DFLAC__ALIGN_MALLOC_DATA
  else
-DEFINES = -DFLAC__ALIGN_MALLOC_DATA
+    DEFINES = -DFLAC__ALIGN_MALLOC_DATA
  endif
  endif
  endif
-INCLUDES = -I./include -I$(topdir)/include -I$(OGG_INCLUDE_DIR)
+INCLUDES = -I./include -I$(topdir)/include $(OGG_INCLUDES)
  DEBUG_CFLAGS = -DFLAC__OVERFLOW_DETECT

  ifeq ($(OS),Darwin)
@@ -65,6 +71,12 @@ SRCS_NASM = \
  endif
  endif

+OGG_SRCS_C = \
+    ogg_decoder_aspect.c \
+    ogg_encoder_aspect.c \
+    ogg_helper.c \
+    ogg_mapping.c
+
  SRCS_C = \
      bitmath.c \
      bitreader.c \
@@ -79,14 +91,11 @@ SRCS_C = \
      memory.c \
      metadata_iterators.c \
      metadata_object.c \
-    ogg_decoder_aspect.c \
-    ogg_encoder_aspect.c \
-    ogg_helper.c \
-    ogg_mapping.c \
      stream_decoder.c \
      stream_encoder.c \
      stream_encoder_framing.c \
-    window.c
+    window.c \
+    $(OGG_SRCS)

  include $(topdir)/build/lib.mk

diff --git a/src/libFLAC/lpc.c b/src/libFLAC/lpc.c
index 66a6899..4eccdc5 100644
--- a/src/libFLAC/lpc.c
+++ b/src/libFLAC/lpc.c
@@ -61,7 +61,7 @@
  #elif defined(__GNUC__)
  #define copysign __builtin_copysign
  #endif
-static inline long int lround(double x) {
+inline long int lround(double x) {
      return (long)(x + copysign (0.5, x));
  }
  //If this fails, we are in the precence of a mid 90's compiler..move 
along...
diff --git a/src/metaflac/Makefile.am b/src/metaflac/Makefile.am
index 11b6310..b1ee208 100644
--- a/src/metaflac/Makefile.am
+++ b/src/metaflac/Makefile.am
@@ -43,8 +43,8 @@ metaflac_SOURCES = \
  metaflac_LDFLAGS =

  metaflac_LDADD = \
-    $(top_builddir)/src/share/grabbag/libgrabbag.la \
$(top_builddir)/src/share/replaygain_analysis/libreplaygain_analysis.la \
+    $(top_builddir)/src/share/grabbag/libgrabbag.la \
      $(top_builddir)/src/share/getopt/libgetopt.a \
      $(top_builddir)/src/share/utf8/libutf8.la \
      $(top_builddir)/src/libFLAC/libFLAC.la \
diff --git a/src/metaflac/Makefile.lite b/src/metaflac/Makefile.lite
index 8b19894..8588d88 100644
--- a/src/metaflac/Makefile.lite
+++ b/src/metaflac/Makefile.lite
@@ -24,12 +24,12 @@ libdir = $(topdir)/obj/$(BUILD)/lib

  PROGRAM_NAME = metaflac

-INCLUDES = -I./include -I$(topdir)/include -I$(OGG_INCLUDE_DIR)
+INCLUDES = -I./include -I$(topdir)/include $(OGG_INCLUDES)

  ifeq ($(OS),Darwin)
-EXPLICIT_LIBS = $(libdir)/libgrabbag.a $(libdir)/libFLAC.a 
$(libdir)/libreplaygain_analysis.a $(libdir)/libgetopt.a 
$(libdir)/libutf8.a $(OGG_LIB_DIR)/libogg.a -liconv -lm
+    EXPLICIT_LIBS = $(libdir)/libgrabbag.a $(libdir)/libFLAC.a 
$(libdir)/libreplaygain_analysis.a $(libdir)/libgetopt.a 
$(libdir)/libutf8.a $(OGG_EXPLICIT_LIBS) $(ICONV_LIBS) -lm
  else
-LIBS = -lgrabbag -lFLAC -lreplaygain_analysis -lgetopt -lutf8 
-L$(OGG_LIB_DIR) -logg -lm
+    LIBS = -lgrabbag -lFLAC -lreplaygain_analysis -lgetopt -lutf8 
-lgrabbag $(OGG_LIBS) -lm
  endif

  SRCS_C = \
diff --git a/src/plugin_xmms/Makefile.lite b/src/plugin_xmms/Makefile.lite
index 1088d14..aff628e 100644
--- a/src/plugin_xmms/Makefile.lite
+++ b/src/plugin_xmms/Makefile.lite
@@ -20,14 +20,15 @@
  #

  topdir = ../..
+libdir = $(topdir)/obj/$(BUILD)/lib

  LIB_NAME  = libxmms-flac
  INCLUDES  = -I./include -I$(topdir)/include -I.. $(shell xmms-config 
--cflags)
  # refer to the static libs explicitly
  ifeq ($(OS),Darwin)
-LIBS = $(topdir)/obj/$(BUILD)/lib/libFLAC.a 
$(topdir)/obj/$(BUILD)/lib/libplugin_common.a 
$(topdir)/obj/$(BUILD)/lib/libgrabbag.a 
$(topdir)/obj/$(BUILD)/lib/libreplaygain_analysis.a 
$(topdir)/obj/$(BUILD)/lib/libreplaygain_synthesis.a 
$(OGG_LIB_DIR)/libogg.a -liconv -lstdc++ -lz
+    LIBS = $(libdir)/libFLAC.a $(libdir)/libplugin_common.a 
$(libdir)/libgrabbag.a $(libdir)/libreplaygain_analysis.a 
$(libdir)/libreplaygain_synthesis.a $(OGG_EXPLICIT_LIBS) $(ICONV_LIBS) 
-lm -lstdc++ -lz
  else
-LIBS = $(topdir)/obj/$(BUILD)/lib/libFLAC.a 
$(topdir)/obj/$(BUILD)/lib/libplugin_common.a 
$(topdir)/obj/$(BUILD)/lib/libgrabbag.a 
$(topdir)/obj/$(BUILD)/lib/libreplaygain_analysis.a 
$(topdir)/obj/$(BUILD)/lib/libreplaygain_synthesis.a -L$(OGG_LIB_DIR) 
-logg -lstdc++ -lz
+    LIBS = $(libdir)/libFLAC.a $(libdir)/libplugin_common.a 
$(libdir)/libgrabbag.a $(libdir)/libreplaygain_analysis.a 
$(libdir)/libreplaygain_synthesis.a $(OGG_LIBS) -lm -lsupc++ -lz
  endif

  SRCS_C = \
diff --git a/src/share/Makefile.lite b/src/share/Makefile.lite
index ecfef97..8014b7a 100644
--- a/src/share/Makefile.lite
+++ b/src/share/Makefile.lite
@@ -16,7 +16,7 @@
  #  distribution.

  .PHONY: all getopt grabbag replaygain_analysis replaygain_synthesis utf8
-all: getopt grabbag replaygain_analysis replaygain_synthesis utf8
+all: getopt replaygain_analysis grabbag replaygain_synthesis utf8

  DEFAULT_CONFIG = release

@@ -33,10 +33,10 @@ release : all
  getopt:
      (cd $@ ; $(MAKE) -f Makefile.lite $(CONFIG))

-grabbag:
+replaygain_analysis:
      (cd $@ ; $(MAKE) -f Makefile.lite $(CONFIG))

-replaygain_analysis:
+grabbag:
      (cd $@ ; $(MAKE) -f Makefile.lite $(CONFIG))

  replaygain_synthesis:
diff --git a/src/share/grabbag/Makefile.lite 
b/src/share/grabbag/Makefile.lite
index daf1975..9fdbdcc 100644
--- a/src/share/grabbag/Makefile.lite
+++ b/src/share/grabbag/Makefile.lite
@@ -3,11 +3,19 @@
  #

  topdir = ../../..
+libdir = $(topdir)/obj/$(BUILD)/lib
+
+ifeq ($(OS),Darwin)
+    EXPLICIT_LIBS = $(libdir)/libFLAC.a 
$(libdir)/libreplaygain_analysis.a $(OGG_EXPLICIT_LIBS) -lm
+else
+    LIBS = -lFLAC -lreplaygain_analysis $(OGG_LIBS) -lm
+endif

  LIB_NAME = libgrabbag
  INCLUDES = -I$(topdir)/include

  SRCS_C = \
+    alloc.c \
      cuesheet.c \
      file.c \
      picture.c \
diff --git a/src/share/utf8/Makefile.lite b/src/share/utf8/Makefile.lite
index 95e4a7f..f090278 100644
--- a/src/share/utf8/Makefile.lite
+++ b/src/share/utf8/Makefile.lite
@@ -3,8 +3,16 @@
  #

  topdir = ../../..
+libdir = $(topdir)/obj/$(BUILD)/lib

  LIB_NAME = libutf8
+
+ifeq ($(OS),Darwin)
+    EXPLICIT_LIBS = $(libdir)/libgrabbag.a $(ICONV_LIBS)
+else
+    LIBS = -lgrabbag $(ICONV_LIBS)
+endif
+
  INCLUDES = -I$(topdir)/include -I$(topdir)/include/share

  SRCS_C = \
diff --git a/src/test_grabbag/cuesheet/Makefile.lite 
b/src/test_grabbag/cuesheet/Makefile.lite
index 9ffe8f2..ae3379b 100644
--- a/src/test_grabbag/cuesheet/Makefile.lite
+++ b/src/test_grabbag/cuesheet/Makefile.lite
@@ -27,9 +27,9 @@ PROGRAM_NAME = test_cuesheet
  INCLUDES = -I./include -I$(topdir)/include

  ifeq ($(OS),Darwin)
-EXPLICIT_LIBS = $(libdir)/libgrabbag.a 
$(libdir)/libreplaygain_analysis.a $(libdir)/libFLAC.a 
$(OGG_LIB_DIR)/libogg.a -lm
+    EXPLICIT_LIBS = $(libdir)/libgrabbag.a 
$(libdir)/libreplaygain_analysis.a $(libdir)/libFLAC.a 
$(OGG_EXPLICIT_LIBS) -lm
  else
-LIBS = -lgrabbag -lreplaygain_analysis -lFLAC -L$(OGG_LIB_DIR) -logg -lm
+    LIBS = -lgrabbag -lreplaygain_analysis -lFLAC $(OGG_LIBS) -lm
  endif

  SRCS_C = \
diff --git a/src/test_grabbag/picture/Makefile.lite 
b/src/test_grabbag/picture/Makefile.lite
index 1a3e60f..4b186a8 100644
--- a/src/test_grabbag/picture/Makefile.lite
+++ b/src/test_grabbag/picture/Makefile.lite
@@ -27,9 +27,9 @@ PROGRAM_NAME = test_picture
  INCLUDES = -I./include -I$(topdir)/include

  ifeq ($(OS),Darwin)
-EXPLICIT_LIBS = $(libdir)/libgrabbag.a 
$(libdir)/libreplaygain_analysis.a $(libdir)/libFLAC.a 
$(OGG_LIB_DIR)/libogg.a -lm
+    EXPLICIT_LIBS = $(libdir)/libgrabbag.a 
$(libdir)/libreplaygain_analysis.a $(libdir)/libFLAC.a 
$(OGG_EXPLICIT_LIBS) -lm
  else
-LIBS = -lgrabbag -lreplaygain_analysis -lFLAC -L$(OGG_LIB_DIR) -logg -lm
+    LIBS = -lgrabbag -lreplaygain_analysis -lFLAC $(OGG_LIBS) -lm
  endif

  SRCS_C = \
diff --git a/src/test_libFLAC++/Makefile.lite 
b/src/test_libFLAC++/Makefile.lite
index a6dc2c6..b9ea28f 100644
--- a/src/test_libFLAC++/Makefile.lite
+++ b/src/test_libFLAC++/Makefile.lite
@@ -27,9 +27,9 @@ PROGRAM_NAME = test_libFLAC++
  INCLUDES = -I$(topdir)/include

  ifeq ($(OS),Darwin)
-EXPLICIT_LIBS = $(libdir)/libgrabbag.a 
$(libdir)/libreplaygain_analysis.a $(libdir)/libtest_libs_common.a 
$(libdir)/libFLAC++.a $(libdir)/libFLAC.a $(OGG_LIB_DIR)/libogg.a -lm
+    EXPLICIT_LIBS = $(libdir)/libgrabbag.a 
$(libdir)/libreplaygain_analysis.a $(libdir)/libtest_libs_common.a 
$(libdir)/libFLAC++.a $(libdir)/libFLAC.a $(OGG_EXPLICIT_LIBS) -lm
  else
-LIBS = -lgrabbag -lreplaygain_analysis -ltest_libs_common -lFLAC++ 
-lFLAC -L$(OGG_LIB_DIR) -logg -lm
+    LIBS = -lgrabbag -lreplaygain_analysis -ltest_libs_common -lFLAC++ 
-lFLAC $(OGG_LIBS) -lm
  endif

  SRCS_CPP = \
diff --git a/src/test_libFLAC/Makefile.lite b/src/test_libFLAC/Makefile.lite
index 25c08a4..d2494e5 100644
--- a/src/test_libFLAC/Makefile.lite
+++ b/src/test_libFLAC/Makefile.lite
@@ -27,9 +27,9 @@ PROGRAM_NAME = test_libFLAC
  INCLUDES = -I../libFLAC/include -I$(topdir)/include

  ifeq ($(OS),Darwin)
-EXPLICIT_LIBS = $(libdir)/libgrabbag.a 
$(libdir)/libreplaygain_analysis.a $(libdir)/libtest_libs_common.a 
$(libdir)/libFLAC.a $(OGG_LIB_DIR)/libogg.a -lm
+    EXPLICIT_LIBS = $(libdir)/libgrabbag.a 
$(libdir)/libreplaygain_analysis.a $(libdir)/libtest_libs_common.a 
$(libdir)/libFLAC.a $(OGG_EXPLICIT_LIBS) -lm
  else
-LIBS = -lgrabbag -lreplaygain_analysis -ltest_libs_common -lFLAC 
-L$(OGG_LIB_DIR) -logg -lm
+    LIBS = -lgrabbag -lreplaygain_analysis -ltest_libs_common -lFLAC 
$(OGG_LIBS) -lm
  endif

  SRCS_C = \
diff --git a/src/test_libs_common/Makefile.lite 
b/src/test_libs_common/Makefile.lite
index a1921ab..772422a 100644
--- a/src/test_libs_common/Makefile.lite
+++ b/src/test_libs_common/Makefile.lite
@@ -24,6 +24,12 @@ libdir = $(topdir)/obj/$(BUILD)/lib

  LIB_NAME = libtest_libs_common

+ifeq ($(OS),Darwin)
+    EXPLICIT_LIBS = $(libdir)/libFLAC.a $(OGG_EXPLICIT_LIBS) -lm
+else
+    LIBS = -lFLAC $(OGG_LIBS) -lm
+endif
+
  INCLUDES = -I$(topdir)/include

  SRCS_C = \
diff --git a/src/test_seeking/Makefile.lite b/src/test_seeking/Makefile.lite
index 16a2d0f..8b9f2da 100644
--- a/src/test_seeking/Makefile.lite
+++ b/src/test_seeking/Makefile.lite
@@ -27,9 +27,9 @@ PROGRAM_NAME = test_seeking
  INCLUDES = -I../libFLAC/include -I$(topdir)/include

  ifeq ($(OS),Darwin)
-EXPLICIT_LIBS = $(libdir)/libFLAC.a $(OGG_LIB_DIR)/libogg.a -lm
+    EXPLICIT_LIBS = $(libdir)/libFLAC.a $(OGG_EXPLICIT_LIBS) -lm
  else
-LIBS = -lFLAC -L$(OGG_LIB_DIR) -logg -lm
+    LIBS = -lFLAC $(OGG_LIBS) -lm
  endif

  SRCS_C = \
diff --git a/src/utils/flacdiff/Makefile.lite 
b/src/utils/flacdiff/Makefile.lite
index efe590a..bbc891b 100644
--- a/src/utils/flacdiff/Makefile.lite
+++ b/src/utils/flacdiff/Makefile.lite
@@ -27,9 +27,9 @@ PROGRAM_NAME = flacdiff
  INCLUDES = -I$(topdir)/include

  ifeq ($(OS),Darwin)
-EXPLICIT_LIBS = $(libdir)/libFLAC++.a $(libdir)/libFLAC.a 
$(OGG_LIB_DIR)/libogg.a -lm
+    EXPLICIT_LIBS = $(libdir)/libFLAC++.a $(libdir)/libFLAC.a 
$(OGG_EXPLICIT_LIBS) -lm
  else
-LIBS = -lFLAC++ -lFLAC -L$(OGG_LIB_DIR) -logg -lm
+    LIBS = -lFLAC++ -lFLAC $(OGG_LIBS) -lm
  endif

  SRCS_CPP = \
diff --git a/src/utils/flactimer/Makefile.lite 
b/src/utils/flactimer/Makefile.lite
new file mode 100644
index 0000000..94fb805
--- /dev/null
+++ b/src/utils/flactimer/Makefile.lite
@@ -0,0 +1,42 @@
+#  flactimer - Runs a command and prints timing information
+#  Copyright (C) 2007,2008,2009  Josh Coalson
+#
+#  This program is free software; you can redistribute it and/or
+#  modify it under the terms of the GNU General Public License
+#  as published by the Free Software Foundation; either version 2
+#  of the License, or (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License along
+#  with this program; if not, write to the Free Software Foundation, Inc.,
+#  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+#
+# GNU makefile
+#
+
+topdir = ../../..
+libdir = $(topdir)/obj/$(BUILD)/lib
+
+PROGRAM_NAME = flactimer
+
+INCLUDES = -I$(topdir)/include
+
+ifeq ($(OS),Darwin)
+    EXPLICIT_LIBS = $(libdir)/libFLAC++.a $(libdir)/libFLAC.a 
$(OGG_EXPLICIT_LIBS) -lm
+else
+    LIBS = -lFLAC++ -lFLAC $(OGG_LIBS) -lm
+endif
+
+SRCS_CPP = \
+    main.cpp
+
+include $(topdir)/build/exe.mk
+
+LINK = $(CCC) $(LINKAGE)
+
+# DO NOT DELETE THIS LINE -- make depend depends on it.
-- 
1.7.11.msysgit.1

_______________________________________________
flac-dev mailing list
flac-dev@xiph.org
http://lists.xiph.org/mailman/listinfo/flac-dev

Reply via email to