2001-06-08 00:13:21 +00:00
|
|
|
# FLAC - Free Lossless Audio Codec
|
2003-01-02 07:03:16 +00:00
|
|
|
# Copyright (C) 2001,2002,2003 Josh Coalson
|
2001-06-08 00:13:21 +00:00
|
|
|
#
|
2003-02-07 00:14:32 +00:00
|
|
|
# This file is part the FLAC project. FLAC is comprised of several
|
|
|
|
# components distributed under difference licenses. The codec libraries
|
|
|
|
# are distributed under Xiph.Org's BSD-like license (see the file
|
|
|
|
# COPYING.Xiph in this distribution). All other programs, libraries, and
|
|
|
|
# plugins are distributed under the GPL (see COPYING.GPL). The documentation
|
|
|
|
# is distributed under the Gnu FDL (see COPYING.FDL). Each file in the
|
|
|
|
# FLAC distribution contains at the top the terms under which it may be
|
|
|
|
# distributed.
|
2001-06-08 00:13:21 +00:00
|
|
|
#
|
2003-02-07 00:14:32 +00:00
|
|
|
# Since this particular file is relevant to all components of FLAC,
|
|
|
|
# it may be distributed under the Xiph.Org license, which is the least
|
|
|
|
# restrictive of those mentioned above. See the file COPYING.Xiph in this
|
|
|
|
# distribution.
|
2001-06-08 00:13:21 +00:00
|
|
|
|
2000-12-10 04:09:52 +00:00
|
|
|
#
|
|
|
|
# GNU makefile fragment for building a library
|
|
|
|
#
|
|
|
|
|
2002-11-20 06:40:08 +00:00
|
|
|
include $(topdir)/build/config.mk
|
|
|
|
|
2001-12-07 19:28:25 +00:00
|
|
|
ifeq ($(DARWIN_BUILD),yes)
|
|
|
|
CC = cc
|
2002-05-17 06:08:44 +00:00
|
|
|
CCC = c++
|
2001-12-07 19:28:25 +00:00
|
|
|
else
|
2000-12-10 04:09:52 +00:00
|
|
|
CC = gcc
|
2002-05-17 06:08:44 +00:00
|
|
|
CCC = g++
|
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
|
2002-11-20 06:40:08 +00:00
|
|
|
OBJPATH = $(topdir)/obj
|
|
|
|
LIBPATH = $(OBJPATH)/$(BUILD)/lib
|
|
|
|
DEBUG_LIBPATH = $(OBJPATH)/debug/lib
|
|
|
|
RELEASE_LIBPATH = $(OBJPATH)/release/lib
|
2001-12-07 19:28:25 +00:00
|
|
|
ifeq ($(DARWIN_BUILD),yes)
|
2002-08-14 00:50:48 +00:00
|
|
|
STATIC_LIB_SUFFIX = a
|
|
|
|
DYNAMIC_LIB_SUFFIX = dylib
|
2001-12-07 19:28:25 +00:00
|
|
|
else
|
2002-08-14 00:50:48 +00:00
|
|
|
STATIC_LIB_SUFFIX = a
|
|
|
|
DYNAMIC_LIB_SUFFIX = so
|
2001-12-07 19:28:25 +00:00
|
|
|
endif
|
2002-11-20 06:40:08 +00:00
|
|
|
STATIC_LIB_NAME = $(LIB_NAME).$(STATIC_LIB_SUFFIX)
|
|
|
|
DYNAMIC_LIB_NAME = $(LIB_NAME).$(DYNAMIC_LIB_SUFFIX)
|
|
|
|
STATIC_LIB = $(LIBPATH)/$(STATIC_LIB_NAME)
|
|
|
|
DYNAMIC_LIB = $(LIBPATH)/$(DYNAMIC_LIB_NAME)
|
|
|
|
DEBUG_STATIC_LIB = $(DEBUG_LIBPATH)/$(STATIC_LIB_NAME)
|
|
|
|
DEBUG_DYNAMIC_LIB = $(DEBUG_LIBPATH)/$(DYNAMIC_LIB_NAME)
|
|
|
|
RELEASE_STATIC_LIB = $(RELEASE_LIBPATH)/$(STATIC_LIB_NAME)
|
|
|
|
RELEASE_DYNAMIC_LIB = $(RELEASE_LIBPATH)/$(DYNAMIC_LIB_NAME)
|
2001-12-07 19:28:25 +00:00
|
|
|
ifeq ($(DARWIN_BUILD),yes)
|
2002-08-14 00:50:48 +00:00
|
|
|
LINKD = $(CC) -dynamiclib -flat_namespace -undefined suppress -install_name $(DYNAMIC_LIB)
|
2001-12-07 19:28:25 +00:00
|
|
|
else
|
2002-09-12 06:40:55 +00:00
|
|
|
LINKD = $(CC) -shared
|
2001-12-07 19:28:25 +00:00
|
|
|
endif
|
2000-12-10 04:09:52 +00:00
|
|
|
|
2001-06-29 02:54:59 +00:00
|
|
|
debug : CFLAGS = -g -O0 -DDEBUG $(DEBUG_CFLAGS) -Wall -W -DVERSION=$(VERSION) $(DEFINES) $(INCLUDES)
|
2002-12-28 07:08:31 +00:00
|
|
|
valgrind: CFLAGS = -g -O0 -DDEBUG $(DEBUG_CFLAGS) -DFLAC__VALGRIND_TESTING -Wall -W -DVERSION=$(VERSION) $(DEFINES) $(INCLUDES)
|
2001-07-20 23:44:35 +00:00
|
|
|
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)
|
|
|
|
|
2002-11-20 06:40:08 +00:00
|
|
|
DEBUG_OBJS = $(SRCS_C:%.c=%.debug.o) $(SRCS_CC:%.cc=%.debug.o) $(SRCS_CPP:%.cpp=%.debug.o) $(SRCS_NASM:%.nasm=%.debug.o)
|
|
|
|
RELEASE_OBJS = $(SRCS_C:%.c=%.release.o) $(SRCS_CC:%.cc=%.release.o) $(SRCS_CPP:%.cpp=%.release.o) $(SRCS_NASM:%.nasm=%.release.o)
|
|
|
|
|
|
|
|
debug : $(ORDINALS_H) $(DEBUG_STATIC_LIB) $(DEBUG_DYNAMIC_LIB)
|
2002-12-04 04:57:33 +00:00
|
|
|
valgrind: $(ORDINALS_H) $(DEBUG_STATIC_LIB) $(DEBUG_DYNAMIC_LIB)
|
2002-11-20 06:40:08 +00:00
|
|
|
release : $(ORDINALS_H) $(RELEASE_STATIC_LIB) $(RELEASE_DYNAMIC_LIB)
|
2000-12-10 04:09:52 +00:00
|
|
|
|
2002-11-20 06:40:08 +00:00
|
|
|
$(DEBUG_STATIC_LIB): $(DEBUG_OBJS)
|
|
|
|
$(LINK) $@ $(DEBUG_OBJS) && ranlib $@
|
|
|
|
|
|
|
|
$(RELEASE_STATIC_LIB): $(RELEASE_OBJS)
|
|
|
|
$(LINK) $@ $(RELEASE_OBJS) && ranlib $@
|
|
|
|
|
|
|
|
$(DEBUG_DYNAMIC_LIB) : $(DEBUG_OBJS)
|
|
|
|
ifeq ($(DARWIN_BUILD),yes)
|
|
|
|
$(LINKD) -o $@ $(DEBUG_OBJS) $(LFLAGS) $(LIBS) -lc
|
|
|
|
else
|
|
|
|
$(LINKD) -o $@ $(DEBUG_OBJS) $(LFLAGS) $(LIBS)
|
|
|
|
endif
|
2000-12-10 04:09:52 +00:00
|
|
|
|
2002-11-20 06:40:08 +00:00
|
|
|
$(RELEASE_DYNAMIC_LIB) : $(RELEASE_OBJS)
|
2001-12-07 19:28:25 +00:00
|
|
|
ifeq ($(DARWIN_BUILD),yes)
|
2002-11-20 06:40:08 +00:00
|
|
|
$(LINKD) -o $@ $(RELEASE_OBJS) $(LFLAGS) $(LIBS) -lc
|
2001-12-07 19:28:25 +00:00
|
|
|
else
|
2002-11-20 06:40:08 +00:00
|
|
|
$(LINKD) -o $@ $(RELEASE_OBJS) $(LFLAGS) $(LIBS)
|
2001-12-07 19:28:25 +00:00
|
|
|
endif
|
2000-12-10 04:09:52 +00:00
|
|
|
|
2002-11-20 06:40:08 +00:00
|
|
|
%.debug.o %.release.o : %.c
|
2000-12-10 04:09:52 +00:00
|
|
|
$(CC) $(CFLAGS) -c $< -o $@
|
2002-11-20 06:40:08 +00:00
|
|
|
%.debug.o %.release.o : %.cc
|
2002-05-17 06:08:44 +00:00
|
|
|
$(CCC) $(CFLAGS) -c $< -o $@
|
2002-11-20 06:40:08 +00:00
|
|
|
%.debug.o %.release.o : %.cpp
|
2002-10-16 22:33:56 +00:00
|
|
|
$(CCC) $(CFLAGS) -c $< -o $@
|
2002-11-20 06:40:08 +00:00
|
|
|
%.debug.i %.release.i : %.c
|
2000-12-10 04:09:52 +00:00
|
|
|
$(CC) $(CFLAGS) -E $< -o $@
|
2002-11-20 06:40:08 +00:00
|
|
|
%.debug.i %.release.i : %.cc
|
2002-05-17 06:08:44 +00:00
|
|
|
$(CCC) $(CFLAGS) -E $< -o $@
|
2002-11-20 06:40:08 +00:00
|
|
|
%.debug.i %.release.i : %.cpp
|
2002-10-16 22:33:56 +00:00
|
|
|
$(CCC) $(CFLAGS) -E $< -o $@
|
2000-12-10 04:09:52 +00:00
|
|
|
|
2002-11-20 06:40:08 +00:00
|
|
|
%.debug.o %.release.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 :
|
2002-11-21 09:09:03 +00:00
|
|
|
-rm -f $(DEBUG_OBJS) $(RELEASE_OBJS) $(OBJPATH)/*/lib/$(STATIC_LIB_NAME) $(OBJPATH)/*/lib/$(DYNAMIC_LIB_NAME) $(ORDINALS_H)
|
2000-12-10 04:09:52 +00:00
|
|
|
|
|
|
|
.PHONY : depend
|
|
|
|
depend:
|
2002-10-16 22:33:56 +00:00
|
|
|
makedepend -fMakefile.lite -- $(CFLAGS) $(INCLUDES) -- *.c *.cc *.cpp
|