comparison src/flac-1.2.1/build/lib.mk @ 1:05aa0afa9217

Bring in flac, ogg, vorbis
author Chris Cannam
date Tue, 19 Mar 2013 17:37:49 +0000
parents
children
comparison
equal deleted inserted replaced
0:c7265573341e 1:05aa0afa9217
1 # FLAC - Free Lossless Audio Codec
2 # Copyright (C) 2001,2002,2003,2004,2005,2006,2007 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 # GNU makefile fragment for building a library
20 #
21
22 include $(topdir)/build/config.mk
23
24 ifeq ($(DARWIN_BUILD),yes)
25 CC = cc
26 CCC = c++
27 else
28 CC = gcc
29 CCC = g++
30 endif
31 AS = as
32 NASM = nasm
33 LINK = ar cru
34 OBJPATH = $(topdir)/obj
35 LIBPATH = $(OBJPATH)/$(BUILD)/lib
36 DEBUG_LIBPATH = $(OBJPATH)/debug/lib
37 RELEASE_LIBPATH = $(OBJPATH)/release/lib
38 ifeq ($(DARWIN_BUILD),yes)
39 STATIC_LIB_SUFFIX = a
40 DYNAMIC_LIB_SUFFIX = dylib
41 else
42 STATIC_LIB_SUFFIX = a
43 DYNAMIC_LIB_SUFFIX = so
44 endif
45 STATIC_LIB_NAME = $(LIB_NAME).$(STATIC_LIB_SUFFIX)
46 DYNAMIC_LIB_NAME = $(LIB_NAME).$(DYNAMIC_LIB_SUFFIX)
47 STATIC_LIB = $(LIBPATH)/$(STATIC_LIB_NAME)
48 DYNAMIC_LIB = $(LIBPATH)/$(DYNAMIC_LIB_NAME)
49 DEBUG_STATIC_LIB = $(DEBUG_LIBPATH)/$(STATIC_LIB_NAME)
50 DEBUG_DYNAMIC_LIB = $(DEBUG_LIBPATH)/$(DYNAMIC_LIB_NAME)
51 RELEASE_STATIC_LIB = $(RELEASE_LIBPATH)/$(STATIC_LIB_NAME)
52 RELEASE_DYNAMIC_LIB = $(RELEASE_LIBPATH)/$(DYNAMIC_LIB_NAME)
53 ifeq ($(DARWIN_BUILD),yes)
54 LINKD = $(CC) -dynamiclib -flat_namespace -undefined suppress -install_name $(DYNAMIC_LIB)
55 else
56 LINKD = $(CC) -shared
57 endif
58
59 debug : CFLAGS = -g -O0 -DDEBUG $(CONFIG_CFLAGS) $(DEBUG_CFLAGS) -W -Wall -Wmissing-prototypes -Wstrict-prototypes -DVERSION=$(VERSION) $(DEFINES) $(INCLUDES)
60 valgrind: CFLAGS = -g -O0 -DDEBUG $(CONFIG_CFLAGS) $(DEBUG_CFLAGS) -DFLAC__VALGRIND_TESTING -W -Wall -Wmissing-prototypes -Wstrict-prototypes -DVERSION=$(VERSION) $(DEFINES) $(INCLUDES)
61 release : CFLAGS = -O3 -fomit-frame-pointer -funroll-loops -finline-functions -DNDEBUG $(CONFIG_CFLAGS) $(RELEASE_CFLAGS) -W -Wall -Wmissing-prototypes -Wstrict-prototypes -Winline -DFLaC__INLINE=__inline__ -DVERSION=$(VERSION) $(DEFINES) $(INCLUDES)
62
63 LFLAGS = -L$(LIBPATH)
64
65 DEBUG_OBJS = $(SRCS_C:%.c=%.debug.o) $(SRCS_CC:%.cc=%.debug.o) $(SRCS_CPP:%.cpp=%.debug.o) $(SRCS_NASM:%.nasm=%.debug.o) $(SRCS_S:%.s=%.debug.o)
66 RELEASE_OBJS = $(SRCS_C:%.c=%.release.o) $(SRCS_CC:%.cc=%.release.o) $(SRCS_CPP:%.cpp=%.release.o) $(SRCS_NASM:%.nasm=%.release.o) $(SRCS_S:%.s=%.release.o)
67
68 debug : $(DEBUG_STATIC_LIB) $(DEBUG_DYNAMIC_LIB)
69 valgrind: $(DEBUG_STATIC_LIB) $(DEBUG_DYNAMIC_LIB)
70 release : $(RELEASE_STATIC_LIB) $(RELEASE_DYNAMIC_LIB)
71
72 $(DEBUG_STATIC_LIB): $(DEBUG_OBJS)
73 $(LINK) $@ $(DEBUG_OBJS) && ranlib $@
74
75 $(RELEASE_STATIC_LIB): $(RELEASE_OBJS)
76 $(LINK) $@ $(RELEASE_OBJS) && ranlib $@
77
78 $(DEBUG_DYNAMIC_LIB) : $(DEBUG_OBJS)
79 ifeq ($(DARWIN_BUILD),yes)
80 echo Not building dynamic lib, command is: $(LINKD) -o $@ $(DEBUG_OBJS) $(LFLAGS) $(LIBS) -lc
81 else
82 $(LINKD) -o $@ $(DEBUG_OBJS) $(LFLAGS) $(LIBS)
83 endif
84
85 $(RELEASE_DYNAMIC_LIB) : $(RELEASE_OBJS)
86 ifeq ($(DARWIN_BUILD),yes)
87 echo Not building dynamic lib, command is: $(LINKD) -o $@ $(RELEASE_OBJS) $(LFLAGS) $(LIBS) -lc
88 else
89 $(LINKD) -o $@ $(RELEASE_OBJS) $(LFLAGS) $(LIBS)
90 endif
91
92 %.debug.o %.release.o : %.c
93 $(CC) $(CFLAGS) -c $< -o $@
94 %.debug.o %.release.o : %.cc
95 $(CCC) $(CFLAGS) -c $< -o $@
96 %.debug.o %.release.o : %.cpp
97 $(CCC) $(CFLAGS) -c $< -o $@
98 %.debug.i %.release.i : %.c
99 $(CC) $(CFLAGS) -E $< -o $@
100 %.debug.i %.release.i : %.cc
101 $(CCC) $(CFLAGS) -E $< -o $@
102 %.debug.i %.release.i : %.cpp
103 $(CCC) $(CFLAGS) -E $< -o $@
104
105 %.debug.o %.release.o : %.s
106 ifeq ($(DARWIN_BUILD),yes)
107 #$(CC) -c -arch ppc -Wall -force_cpusubtype_ALL $< -o $@
108 $(AS) -arch ppc -force_cpusubtype_ALL $< -o $@
109 else
110 $(AS) $< -o $@
111 endif
112
113 %.debug.o : %.nasm
114 $(NASM) -f elf -d OBJ_FORMAT_elf -i ia32/ -g $< -o $@
115 %.release.o : %.nasm
116 $(NASM) -f elf -d OBJ_FORMAT_elf -i ia32/ $< -o $@
117
118 .PHONY : clean
119 clean :
120 -rm -f $(DEBUG_OBJS) $(RELEASE_OBJS) $(OBJPATH)/*/lib/$(STATIC_LIB_NAME) $(OBJPATH)/*/lib/$(DYNAMIC_LIB_NAME)
121
122 .PHONY : depend
123 depend:
124 makedepend -fMakefile.lite -- $(CFLAGS) $(INCLUDES) -- *.c *.cc *.cpp