5dd72bbe3a0bcd0271e9abb96c9589243fbf3738
[platform/upstream/flac.git] / build / config.mk
1 #  FLAC - Free Lossless Audio Codec
2 #  Copyright (C) 2001,2002,2003,2004,2005,2006,2007,2008,2009  Josh Coalson
3 #
4 #  This file is part the FLAC project.  FLAC is comprised of several
5 #  components distributed under difference licenses.  The codec libraries
6 #  are distributed under Xiph.Org's BSD-like license (see the file
7 #  COPYING.Xiph in this distribution).  All other programs, libraries, and
8 #  plugins are distributed under the GPL (see COPYING.GPL).  The documentation
9 #  is distributed under the Gnu FDL (see COPYING.FDL).  Each file in the
10 #  FLAC distribution contains at the top the terms under which it may be
11 #  distributed.
12 #
13 #  Since this particular file is relevant to all components of FLAC,
14 #  it may be distributed under the Xiph.Org license, which is the least
15 #  restrictive of those mentioned above.  See the file COPYING.Xiph in this
16 #  distribution.
17
18 #
19 # customizable settings from the make invocation
20 #
21
22 USE_OGG     ?= 1
23 USE_ICONV   ?= 1
24
25 #
26 # debug/release selection
27 #
28
29 DEFAULT_BUILD = release
30
31 # returns Linux, Darwin, FreeBSD, etc.
32 ifdef OS_OVERRIDE
33     OS := $(OS_OVERRIDE)
34 else
35     OS := $(shell uname -s)
36 endif
37 # returns i386, x86_64, powerpc, etc.
38 ifdef PROC_OVERRIDE
39     PROC := $(PROC_OVERRIDE)
40 else
41     ifeq ($(findstring MINGW,$(OS)),MINGW)
42         PROC := i386 # failsafe
43         # ifeq (mingw32,$(shell gcc -dumpmachine)) # MinGW (mainline): mingw32
44         ifeq ($(findstring i686,$(shell gcc -dumpmachine)),i686) # MinGW-w64: i686-w64-mingw32
45             USE_ICONV := 0
46         else ifeq ($(findstring x86_64,$(shell gcc -dumpmachine)),x86_64) # MinGW-w64: x86_64-w64-mingw32
47             USE_ICONV := 0
48             PROC := x86_64
49         endif
50     else
51         PROC := $(shell uname -p)
52     endif
53 endif
54 ifeq ($(PROC),powerpc)
55     PROC := ppc
56 endif
57
58 ifeq ($(OS),Linux)
59     PROC := $(shell uname -m)
60     USE_ICONV := 0
61 endif
62
63 debug    : BUILD = debug
64 valgrind : BUILD = debug
65 release  : BUILD = release
66
67 # override LINKAGE on OS X until we figure out how to get 'cc -static' to work
68 ifeq ($(OS),Darwin)
69 LINKAGE = -arch $(PROC)
70 else
71 debug    : LINKAGE = -static
72 valgrind : LINKAGE = -dynamic
73 release  : LINKAGE = -static
74 endif
75
76 all default: $(DEFAULT_BUILD)
77
78 #
79 # GNU makefile fragment for emulating stuff normally done by configure
80 #
81
82 VERSION=\"1.2.1\"
83
84 CONFIG_CFLAGS=-DHAVE_STDINT_H -DHAVE_INTTYPES_H -DHAVE_CXX_VARARRAYS -DHAVE_LANGINFO_CODESET -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
85
86 ifeq ($(OS),Darwin)
87     CONFIG_CFLAGS += -DFLAC__SYS_DARWIN -arch $(PROC)
88 else
89     CONFIG_CFLAGS += -DHAVE_SOCKLEN_T
90 endif
91
92 ifeq ($(PROC),ppc)
93     CONFIG_CFLAGS += -DWORDS_BIGENDIAN=1
94 else
95     CONFIG_CFLAGS += -DWORDS_BIGENDIAN=0
96 endif
97
98 ifeq ($(OS),Linux)
99         ifeq ($(PROC),x86_64)
100         CONFIG_CFLAGS += -fPIC
101         endif
102 endif
103
104 ifneq (0,$(USE_ICONV))
105     CONFIG_CFLAGS += -DHAVE_ICONV
106     ICONV_LIBS = -liconv
107 else
108     ICONV_LIBS =
109 endif
110
111 ifneq (0,$(USE_OGG))
112     CONFIG_CFLAGS += -DFLAC__HAS_OGG=1
113     OGG_INCLUDES = -I$(OGG_INCLUDE_DIR)
114     OGG_EXPLICIT_LIBS = $(OGG_LIB_DIR)/libogg.a
115     OGG_LIBS = -L$(OGG_LIB_DIR) -logg
116     OGG_SRCS = $(OGG_SRCS_C)
117 else
118     CONFIG_CFLAGS += -DFLAC__HAS_OGG=0
119     OGG_INCLUDES =
120     OGG_EXPLICIT_LIBS =
121     OGG_LIBS =
122     OGG_SRCS =
123 endif
124
125 OGG_INCLUDE_DIR=$(HOME)/local/include
126 OGG_LIB_DIR=$(HOME)/local/lib