Update and improve autotools build
[platform/upstream/flac.git] / src / libFLAC / Makefile.am
1 #  libFLAC - Free Lossless Audio Codec library
2 #  Copyright (C) 2001,2002,2003,2004,2005,2006,2007,2008,2009  Josh Coalson
3 #
4 #  Redistribution and use in source and binary forms, with or without
5 #  modification, are permitted provided that the following conditions
6 #  are met:
7 #
8 #  - Redistributions of source code must retain the above copyright
9 #  notice, this list of conditions and the following disclaimer.
10 #
11 #  - Redistributions in binary form must reproduce the above copyright
12 #  notice, this list of conditions and the following disclaimer in the
13 #  documentation and/or other materials provided with the distribution.
14 #
15 #  - Neither the name of the Xiph.org Foundation nor the names of its
16 #  contributors may be used to endorse or promote products derived from
17 #  this software without specific prior written permission.
18 #
19 #  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 #  ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 #  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 #  A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR
23 #  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
24 #  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
25 #  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
26 #  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27 #  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28 #  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29 #  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
31 AM_CPPFLAGS = -I$(top_builddir) -I$(srcdir)/include -I$(top_srcdir)/include
32 lib_LTLIBRARIES = libFLAC.la
33 if DEBUG
34 DEBUGCFLAGS = -DFLAC__OVERFLOW_DETECT
35 endif
36 if FLaC__CPU_PPC
37 # The -force_cpusubtype_ALL is needed to insert a ppc64 instruction
38 # into cpu.c with an asm().
39 if FLaC__SYS_DARWIN
40 #@@@ PPC optimizations temporarily disabled
41 CPUCFLAGS = -faltivec -force_cpusubtype_ALL -DFLAC__NO_ASM
42 else
43 # Linux-gcc for PPC does not have -force_cpusubtype_ALL, it is Darwin-specific
44 CPUCFLAGS =
45 if FLaC__CPU_PPC_SPE
46 else
47 CPUCFLAGS += -maltivec -mabi=altivec
48 endif
49 #@@@ PPC optimizations temporarily disabled
50 CPUCFLAGS += -DFLAC__NO_ASM
51 endif
52 endif
53
54 AM_CFLAGS = $(DEBUGCFLAGS) $(CPUCFLAGS) @OGG_CFLAGS@
55
56 if FLaC__NO_ASM
57 else
58 if FLaC__CPU_IA32
59 if FLaC__HAS_NASM
60 ARCH_SUBDIRS = ia32
61 LOCAL_EXTRA_LIBADD = ia32/libFLAC-asm.la
62 endif
63 endif
64 if FLaC__CPU_PPC
65 ARCH_SUBDIRS = ppc
66 if FLaC__HAS_AS__TEMPORARILY_DISABLED
67 if FLaC__CPU_PPC_SPE
68 else
69 LOCAL_EXTRA_LIBADD = ppc/as/libFLAC-asm.la
70 LOCAL_EXTRA_LDFLAGS = "-Wl,-read_only_relocs,warning"
71 else
72 if FLaC__HAS_GAS__TEMPORARILY_DISABLED
73 LOCAL_EXTRA_LIBADD = ppc/gas/libFLAC-asm.la
74 LOCAL_EXTRA_LDFLAGS = ""
75 endif
76 endif
77 endif
78 endif
79 endif
80
81 libFLAC_la_LIBADD = $(LOCAL_EXTRA_LIBADD) @OGG_LIBS@ -lm
82
83 SUBDIRS = $(ARCH_SUBDIRS) include .
84
85 m4datadir = $(datadir)/aclocal
86 m4data_DATA = libFLAC.m4
87
88 pkgconfigdir = $(libdir)/pkgconfig
89 pkgconfig_DATA = flac.pc
90
91 EXTRA_DIST = \
92         Makefile.lite \
93         flac.pc.in \
94         libFLAC_dynamic.dsp \
95         libFLAC_dynamic.vcproj \
96         libFLAC_static.dsp \
97         libFLAC_static.vcproj \
98         libFLAC.m4
99
100 if FLaC__HAS_OGG
101 extra_ogg_sources = \
102         ogg_decoder_aspect.c \
103         ogg_encoder_aspect.c \
104         ogg_helper.c \
105         ogg_mapping.c
106 endif
107 # see 'http://www.gnu.org/software/libtool/manual.html#Libtool-versioning' for numbering convention
108 libFLAC_la_LDFLAGS = -version-info 10:0:2 $(LOCAL_EXTRA_LDFLAGS) @LT_NO_UNDEFINED@
109 libFLAC_la_SOURCES = \
110         bitmath.c \
111         bitreader.c \
112         bitwriter.c \
113         cpu.c \
114         crc.c \
115         fixed.c \
116         float.c \
117         format.c \
118         lpc.c \
119         md5.c \
120         memory.c \
121         metadata_iterators.c \
122         metadata_object.c \
123         stream_decoder.c \
124         stream_encoder.c \
125         stream_encoder_framing.c \
126         window.c \
127         $(extra_ogg_sources)