examples/c/decode/file/main.c : Add extra error handling.
[flac.git] / build / config.mk
blobe539630155123d72c295217035f8d687a732b1b5
1 # FLAC - Free Lossless Audio Codec
2 # Copyright (C) 2001-2009 Josh Coalson
3 # Copyright (C) 2011-2013 Xiph.Org Foundation
5 # This file is part the FLAC project. FLAC is comprised of several
6 # components distributed under different licenses. The codec libraries
7 # are distributed under Xiph.Org's BSD-like license (see the file
8 # COPYING.Xiph in this distribution). All other programs, libraries, and
9 # plugins are distributed under the GPL (see COPYING.GPL). The documentation
10 # is distributed under the Gnu FDL (see COPYING.FDL). Each file in the
11 # FLAC distribution contains at the top the terms under which it may be
12 # distributed.
14 # Since this particular file is relevant to all components of FLAC,
15 # it may be distributed under the Xiph.Org license, which is the least
16 # restrictive of those mentioned above. See the file COPYING.Xiph in this
17 # distribution.
20 # customizable settings from the make invocation
23 USE_OGG ?= 1
24 USE_ICONV ?= 1
25 USE_LROUND ?= 1
26 USE_FSEEKO ?= 1
27 USE_LANGINFO_CODESET ?= 1
30 # debug/release selection
33 DEFAULT_BUILD = release
35 F_PIC := -fPIC
37 # returns Linux, Darwin, FreeBSD, etc.
38 ifndef OS
39 OS := $(shell uname -s)
40 endif
41 # returns i386, x86_64, powerpc, etc.
42 ifndef PROC
43 ifeq ($(findstring Windows,$(OS)),Windows)
44 PROC := i386 # failsafe
45 USE_ICONV := 0
46 USE_LANGINFO_CODESET := 0
47 ifeq (mingw32,$(shell gcc -dumpmachine)) # MinGW (mainline): mingw32
48 USE_FSEEKO := 0
49 endif
50 # ifeq ($(findstring i686,$(shell gcc -dumpmachine)),i686) # MinGW-w64: i686-w64-mingw32
51 ifeq ($(findstring x86_64,$(shell gcc -dumpmachine)),x86_64) # MinGW-w64: x86_64-w64-mingw32
52 PROC := x86_64
53 F_PIC :=
54 endif
55 else
56 PROC := $(shell uname -p)
57 endif
58 endif
59 ifeq ($(PROC),powerpc)
60 PROC := ppc
61 endif
63 ifeq ($(OS),Linux)
64 PROC := $(shell uname -m)
65 USE_ICONV := 0
66 endif
68 debug : BUILD = debug
69 valgrind : BUILD = debug
70 release : BUILD = release
72 # override LINKAGE on OS X until we figure out how to get 'cc -static' to work
73 ifeq ($(OS),Darwin)
74 LINKAGE = -arch $(PROC)
75 else
76 debug : LINKAGE = -static
77 valgrind : LINKAGE = -dynamic
78 release : LINKAGE = -static
79 endif
81 all default: $(DEFAULT_BUILD)
84 # GNU makefile fragment for emulating stuff normally done by configure
87 VERSION=\"1.3.0\"
89 CONFIG_CFLAGS=$(CUSTOM_CFLAGS) -DHAVE_STDINT_H -DHAVE_INTTYPES_H -DHAVE_CXX_VARARRAYS -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
91 ifeq ($(OS),Darwin)
92 CONFIG_CFLAGS += -DFLAC__SYS_DARWIN -arch $(PROC)
93 else
94 CONFIG_CFLAGS += -DHAVE_SOCKLEN_T
95 endif
97 ifeq ($(PROC),ppc)
98 CONFIG_CFLAGS += -DWORDS_BIGENDIAN=1 -DCPU_IS_LITTLE_ENDIAN=0
99 else
100 CONFIG_CFLAGS += -DWORDS_BIGENDIAN=0 -DCPU_IS_LITTLE_ENDIAN=1
101 endif
103 ifeq ($(OS),Linux)
104 ifeq ($(PROC),x86_64)
105 CONFIG_CFLAGS += -fPIC
106 endif
107 endif
109 ifneq (0,$(USE_ICONV))
110 CONFIG_CFLAGS += -DHAVE_ICONV
111 ICONV_LIBS = -liconv
112 else
113 ICONV_LIBS =
114 endif
116 ifneq (0,$(USE_OGG))
117 CONFIG_CFLAGS += -DFLAC__HAS_OGG=1
118 OGG_INCLUDES = -I$(OGG_INCLUDE_DIR)
119 OGG_EXPLICIT_LIBS = $(OGG_LIB_DIR)/libogg.a
120 OGG_LIBS = -L$(OGG_LIB_DIR) -logg
121 OGG_SRCS = $(OGG_SRCS_C)
122 else
123 CONFIG_CFLAGS += -DFLAC__HAS_OGG=0
124 OGG_INCLUDES =
125 OGG_EXPLICIT_LIBS =
126 OGG_LIBS =
127 OGG_SRCS =
128 endif
130 OGG_INCLUDE_DIR=$(HOME)/local/include
131 OGG_LIB_DIR=$(HOME)/local/lib
133 ifneq (0,$(USE_LROUND))
134 CONFIG_CFLAGS += -DHAVE_LROUND
135 endif
137 ifneq (0,$(USE_FSEEKO))
138 CONFIG_CFLAGS += -DHAVE_FSEEKO
139 endif
141 ifneq (0,$(USE_LANGINFO_CODESET))
142 CONFIG_CFLAGS += -DHAVE_LANGINFO_CODESET
143 endif