lib.mk 1.86 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#  FLAC - Free Lossless Audio Codec
#  Copyright (C) 2001  Josh Coalson
#
#  This program is part of FLAC; you can redistribute it and/or
#  modify it under the terms of the GNU General Public License
#  as published by the Free Software Foundation; either version 2
#  of the License, or (at your option) any later version.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program; if not, write to the Free Software
#  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

Josh Coalson's avatar
Josh Coalson committed
18
19
20
21
22
#
# GNU makefile fragment for building a library
#

CC          = gcc
Josh Coalson's avatar
Josh Coalson committed
23
NASM        = nasm
Josh Coalson's avatar
Josh Coalson committed
24
25
26
27
28
29
30
31
LINK        = ar cru
LINKD       = ld -G
LIBPATH     = ../../obj/lib
STATIC_LIB  = $(LIBPATH)/$(LIB_NAME).a
DYNAMIC_LIB = $(LIBPATH)/$(LIB_NAME).so

all : release

32
33
34
include ../../build/config.mk

debug   : CFLAGS = -g -O0 -DDEBUG $(DEBUG_CFLAGS) -Wall -W -DVERSION=$(VERSION) $(DEFINES) $(INCLUDES)
Josh Coalson's avatar
Josh Coalson committed
35
release : CFLAGS = -O3 -fomit-frame-pointer -funroll-loops -finline-functions -DNDEBUG $(RELEASE_CFLAGS) -Wall -W -Winline -DFLAC__INLINE=__inline__ -DVERSION=$(VERSION) $(DEFINES) $(INCLUDES)
Josh Coalson's avatar
Josh Coalson committed
36
37
38

LFLAGS  = -L$(LIBPATH)

39
40
debug   : $(ORDINALS_H) $(STATIC_LIB) $(DYNAMIC_LIB)
release : $(ORDINALS_H) $(STATIC_LIB) $(DYNAMIC_LIB)
Josh Coalson's avatar
Josh Coalson committed
41
42
43
44
45
46
47
48
49
50
51
52

$(STATIC_LIB) : $(OBJS)
	$(LINK) $@ $(OBJS)

$(DYNAMIC_LIB) : $(OBJS)
	$(LINKD) -o $@ $(OBJS) $(LFLAGS) $(LIBS)

%.o : %.c
	$(CC) $(CFLAGS) -c $< -o $@
%.i : %.c
	$(CC) $(CFLAGS) -E $< -o $@

53
%.o : %.nasm
Josh Coalson's avatar
Josh Coalson committed
54
	$(NASM) -f elf -d OBJ_FORMAT_elf -i ia32/ $< -o $@
Josh Coalson's avatar
Josh Coalson committed
55

Josh Coalson's avatar
Josh Coalson committed
56
57
.PHONY : clean
clean :
58
	-rm -f $(OBJS) $(STATIC_LIB) $(DYNAMIC_LIB) $(ORDINALS_H)
Josh Coalson's avatar
Josh Coalson committed
59
60
61
62

.PHONY : depend
depend:
	makedepend -- $(CFLAGS) $(INCLUDES) -- *.c