flac/build/lib.mk

81 lines
2.4 KiB
Makefile
Raw Normal View History

# FLAC - Free Lossless Audio Codec
2002-01-26 18:05:12 +00:00
# Copyright (C) 2001,2002 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.
2000-12-10 04:09:52 +00:00
#
# GNU makefile fragment for building a library
#
2001-12-07 19:28:25 +00:00
ifeq ($(DARWIN_BUILD),yes)
CC = cc
else
2000-12-10 04:09:52 +00:00
CC = gcc
2001-12-07 19:28:25 +00:00
endif
2001-05-03 02:24:39 +00:00
NASM = nasm
2000-12-10 04:09:52 +00:00
LINK = ar cru
2001-12-07 19:28:25 +00:00
ifeq ($(DARWIN_BUILD),yes)
LINKD = $(CC) -dynamiclib -flat_namespace -undefined suppress -install_name ../../obj/lib/libFLAC.dylib
#LINKD = $(CC) -dynamiclib -flat_namespace -undefined suppress -install_name ../../obj/lib/libFLAC.1.dylib -compatibility_version 3 -current_version 3.1
else
2000-12-10 04:09:52 +00:00
LINKD = ld -G
2001-12-07 19:28:25 +00:00
endif
2000-12-10 04:09:52 +00:00
LIBPATH = ../../obj/lib
STATIC_LIB = $(LIBPATH)/$(LIB_NAME).a
2001-12-07 19:28:25 +00:00
ifeq ($(DARWIN_BUILD),yes)
DYNAMIC_LIB = $(LIBPATH)/$(LIB_NAME).dylib
#DYNAMIC_LIB = $(LIBPATH)/$(LIB_NAME).1.1.1.dylib
else
2000-12-10 04:09:52 +00:00
DYNAMIC_LIB = $(LIBPATH)/$(LIB_NAME).so
2001-12-07 19:28:25 +00:00
endif
2000-12-10 04:09:52 +00:00
all : release
include ../../build/config.mk
debug : CFLAGS = -g -O0 -DDEBUG $(DEBUG_CFLAGS) -Wall -W -DVERSION=$(VERSION) $(DEFINES) $(INCLUDES)
release : CFLAGS = -O3 -fomit-frame-pointer -funroll-loops -finline-functions -DNDEBUG $(RELEASE_CFLAGS) -Wall -W -Winline -DFLaC__INLINE=__inline__ -DVERSION=$(VERSION) $(DEFINES) $(INCLUDES)
2000-12-10 04:09:52 +00:00
LFLAGS = -L$(LIBPATH)
debug : $(ORDINALS_H) $(STATIC_LIB) $(DYNAMIC_LIB)
release : $(ORDINALS_H) $(STATIC_LIB) $(DYNAMIC_LIB)
2000-12-10 04:09:52 +00:00
$(STATIC_LIB) : $(OBJS)
2001-12-07 19:28:25 +00:00
$(LINK) $@ $(OBJS) && ranlib $@
2000-12-10 04:09:52 +00:00
$(DYNAMIC_LIB) : $(OBJS)
2001-12-07 19:28:25 +00:00
ifeq ($(DARWIN_BUILD),yes)
$(LINKD) -o $@ $(OBJS) $(LFLAGS) $(LIBS) -lc
else
2000-12-10 04:09:52 +00:00
$(LINKD) -o $@ $(OBJS) $(LFLAGS) $(LIBS)
2001-12-07 19:28:25 +00:00
endif
2000-12-10 04:09:52 +00:00
%.o : %.c
$(CC) $(CFLAGS) -c $< -o $@
%.i : %.c
$(CC) $(CFLAGS) -E $< -o $@
%.o : %.nasm
2001-06-19 06:48:21 +00:00
$(NASM) -f elf -d OBJ_FORMAT_elf -i ia32/ $< -o $@
2001-05-03 02:24:39 +00:00
2000-12-10 04:09:52 +00:00
.PHONY : clean
clean :
-rm -f $(OBJS) $(STATIC_LIB) $(DYNAMIC_LIB) $(ORDINALS_H)
2000-12-10 04:09:52 +00:00
.PHONY : depend
depend:
makedepend -- $(CFLAGS) $(INCLUDES) -- *.c