add/update copyright and license notices
[platform/upstream/flac.git] / build / lib.mk
1 #  FLAC - Free Lossless Audio Codec
2 #  Copyright (C) 2001  Josh Coalson
3 #
4 #  This program is part of FLAC; you can redistribute it and/or
5 #  modify it under the terms of the GNU General Public License
6 #  as published by the Free Software Foundation; either version 2
7 #  of the License, or (at your option) any later version.
8 #
9 #  This program is distributed in the hope that it will be useful,
10 #  but WITHOUT ANY WARRANTY; without even the implied warranty of
11 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 #  GNU General Public License for more details.
13 #
14 #  You should have received a copy of the GNU General Public License
15 #  along with this program; if not, write to the Free Software
16 #  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
17
18 #
19 # GNU makefile fragment for building a library
20 #
21
22 CC          = gcc
23 NASM        = nasm
24 LINK        = ar cru
25 LINKD       = ld -G
26 LIBPATH     = ../../obj/lib
27 STATIC_LIB  = $(LIBPATH)/$(LIB_NAME).a
28 DYNAMIC_LIB = $(LIBPATH)/$(LIB_NAME).so
29
30 all : release
31
32 debug   : CFLAGS = -g -O0 -DDEBUG $(DEBUG_CFLAGS) -Wall -W $(DEFINES) $(INCLUDES)
33 release : CFLAGS = -O3 -fomit-frame-pointer -funroll-loops -ffast-math -finline-functions -DNDEBUG $(RELEASE_CFLAGS) -Wall -W $(DEFINES) $(INCLUDES)
34
35 LFLAGS  = -L$(LIBPATH)
36
37 debug   : $(STATIC_LIB) $(DYNAMIC_LIB)
38 release : $(STATIC_LIB) $(DYNAMIC_LIB)
39
40 $(STATIC_LIB) : $(OBJS)
41         $(LINK) $@ $(OBJS)
42
43 $(DYNAMIC_LIB) : $(OBJS)
44         $(LINKD) -o $@ $(OBJS) $(LFLAGS) $(LIBS)
45
46 %.o : %.c
47         $(CC) $(CFLAGS) -c $< -o $@
48 %.i : %.c
49         $(CC) $(CFLAGS) -E $< -o $@
50
51 %.o : %.s
52         $(NASM) -f elf -d ELF -i i386/ $< -o $@
53
54 .PHONY : clean
55 clean :
56         -rm -f $(OBJS) $(STATIC_LIB) $(DYNAMIC_LIB)
57
58 .PHONY : depend
59 depend:
60         makedepend -- $(CFLAGS) $(INCLUDES) -- *.c