summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorHendricks266 <Hendricks266@gmail.com>2012-12-29 04:22:59 -0600
committerErik de Castro Lopo <erikd@mega-nerd.com>2013-01-02 21:35:47 +1100
commit96d081c1c9b96743631f3a90d4798150ead43d47 (patch)
tree9a5f9a46f2826352fe2577301ec690d429fc8f3c /examples
parent0da96d3cfd13931439324785ca1b89bb788a4a49 (diff)
downloadflac-96d081c1c9b96743631f3a90d4798150ead43d47.tar.gz
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>
Diffstat (limited to 'examples')
-rw-r--r--examples/c/decode/file/Makefile.lite4
-rw-r--r--examples/c/encode/file/Makefile.lite4
-rw-r--r--examples/cpp/decode/file/Makefile.lite4
-rw-r--r--examples/cpp/encode/file/Makefile.lite4
4 files changed, 8 insertions, 8 deletions
diff --git a/examples/c/decode/file/Makefile.lite b/examples/c/decode/file/Makefile.lite
index fb43c5fe..35bfa5ca 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 ff9db592..9def573b 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 6d25c87f..ccf1e638 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 001fc6e6..a6926b9f 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