• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#  FLAC - Free Lossless Audio Codec
2#  Copyright (C) 2001-2009  Josh Coalson
3#  Copyright (C) 2011-2016  Xiph.Org Foundation
4#
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.
13#
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.
18
19#
20# customizable settings from the make invocation
21#
22
23USE_OGG     ?= 1
24USE_ICONV   ?= 1
25USE_LROUND  ?= 1
26USE_FSEEKO  ?= 1
27USE_LANGINFO_CODESET ?= 1
28
29#
30# debug/release selection
31#
32
33DEFAULT_BUILD = release
34
35F_PIC := -fPIC
36
37# returns Linux, Darwin, FreeBSD, etc.
38ifndef OS
39    OS := $(shell uname -s)
40endif
41# returns i386, x86_64, powerpc, etc.
42ifndef PROC
43    ifeq ($(findstring Windows,$(OS)),Windows)
44        PROC := i386 # failsafe
45        # ifeq ($(findstring i686,$(shell gcc -dumpmachine)),i686) # MinGW-w64: i686-w64-mingw32
46        ifeq ($(findstring x86_64,$(shell gcc -dumpmachine)),x86_64) # MinGW-w64: x86_64-w64-mingw32
47            PROC := x86_64
48        endif
49    else
50        ifeq ($(shell uname -p),amd64)
51            PROC := x86_64
52        else
53            PROC := $(shell uname -p)
54        endif
55    endif
56endif
57ifeq ($(PROC),powerpc)
58    PROC := ppc
59endif
60# x64_64 Mac OS outputs 'i386' in uname -p; use uname -m instead
61ifeq ($(PROC),i386)
62    ifeq ($(OS),Darwin)
63        PROC := $(shell uname -m)
64    endif
65endif
66
67ifeq ($(OS),Linux)
68    PROC := $(shell uname -m)
69    USE_ICONV := 0
70endif
71
72ifeq ($(findstring Windows,$(OS)),Windows)
73    F_PIC :=
74    USE_ICONV := 0
75    USE_LANGINFO_CODESET := 0
76    ifeq (mingw32,$(shell gcc -dumpmachine)) # MinGW (mainline): mingw32
77        USE_FSEEKO := 0
78    endif
79endif
80
81debug    : BUILD = debug
82valgrind : BUILD = debug
83release  : BUILD = release
84
85# override LINKAGE on OS X until we figure out how to get 'cc -static' to work
86ifeq ($(OS),Darwin)
87LINKAGE = -arch $(PROC)
88else
89debug    : LINKAGE = -static
90valgrind : LINKAGE = -dynamic
91release  : LINKAGE = -static
92endif
93
94all default: $(DEFAULT_BUILD)
95
96#
97# GNU makefile fragment for emulating stuff normally done by configure
98#
99
100VERSION=\"1.3.3\"
101
102CONFIG_CFLAGS=$(CUSTOM_CFLAGS) -DHAVE_STDINT_H -DHAVE_INTTYPES_H -DHAVE_CXX_VARARRAYS -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
103
104ifeq ($(OS),Darwin)
105    CONFIG_CFLAGS += -DFLAC__SYS_DARWIN -DHAVE_SYS_PARAM_H -arch $(PROC)
106else
107    CONFIG_CFLAGS += -DHAVE_SOCKLEN_T
108endif
109
110ifeq ($(PROC),ppc)
111    CONFIG_CFLAGS += -DWORDS_BIGENDIAN=1 -DCPU_IS_LITTLE_ENDIAN=0
112else
113    CONFIG_CFLAGS += -DWORDS_BIGENDIAN=0 -DCPU_IS_LITTLE_ENDIAN=1
114endif
115
116ifeq ($(OS),Linux)
117	ifeq ($(PROC),x86_64)
118        CONFIG_CFLAGS += -fPIC
119	endif
120endif
121ifeq ($(OS),FreeBSD)
122    CONFIG_CFLAGS += -DHAVE_SYS_PARAM_H
123endif
124
125ifneq (0,$(USE_ICONV))
126    CONFIG_CFLAGS += -DHAVE_ICONV
127    ICONV_LIBS = -liconv
128else
129    ICONV_LIBS =
130endif
131
132ifneq (0,$(USE_OGG))
133    CONFIG_CFLAGS += -DFLAC__HAS_OGG=1
134    OGG_INCLUDES = -I$(OGG_INCLUDE_DIR)
135    OGG_EXPLICIT_LIBS = $(OGG_LIB_DIR)/libogg.a
136    OGG_LIBS = -L$(OGG_LIB_DIR) -logg
137    OGG_SRCS = $(OGG_SRCS_C)
138else
139    CONFIG_CFLAGS += -DFLAC__HAS_OGG=0
140    OGG_INCLUDES =
141    OGG_EXPLICIT_LIBS =
142    OGG_LIBS =
143    OGG_SRCS =
144endif
145
146OGG_INCLUDE_DIR=$(HOME)/local/include
147OGG_LIB_DIR=$(HOME)/local/lib
148
149ifneq (0,$(USE_LROUND))
150    CONFIG_CFLAGS += -DHAVE_LROUND
151endif
152
153ifneq (0,$(USE_FSEEKO))
154    CONFIG_CFLAGS += -DHAVE_FSEEKO
155endif
156
157ifneq (0,$(USE_LANGINFO_CODESET))
158    CONFIG_CFLAGS += -DHAVE_LANGINFO_CODESET
159endif
160