Blame build/lib.mk

Packit Service 065837
#  FLAC - Free Lossless Audio Codec
Packit Service 065837
#  Copyright (C) 2001-2009  Josh Coalson
Packit Service 065837
#  Copyright (C) 2011-2016  Xiph.Org Foundation
Packit Service 065837
#
Packit Service 065837
#  This file is part the FLAC project.  FLAC is comprised of several
Packit Service 065837
#  components distributed under different licenses.  The codec libraries
Packit Service 065837
#  are distributed under Xiph.Org's BSD-like license (see the file
Packit Service 065837
#  COPYING.Xiph in this distribution).  All other programs, libraries, and
Packit Service 065837
#  plugins are distributed under the GPL (see COPYING.GPL).  The documentation
Packit Service 065837
#  is distributed under the Gnu FDL (see COPYING.FDL).  Each file in the
Packit Service 065837
#  FLAC distribution contains at the top the terms under which it may be
Packit Service 065837
#  distributed.
Packit Service 065837
#
Packit Service 065837
#  Since this particular file is relevant to all components of FLAC,
Packit Service 065837
#  it may be distributed under the Xiph.Org license, which is the least
Packit Service 065837
#  restrictive of those mentioned above.  See the file COPYING.Xiph in this
Packit Service 065837
#  distribution.
Packit Service 065837
Packit Service 065837
#
Packit Service 065837
# GNU makefile fragment for building a library
Packit Service 065837
#
Packit Service 065837
Packit Service 065837
include $(topdir)/build/config.mk
Packit Service 065837
Packit Service 065837
ifeq ($(OS),Darwin)
Packit Service 065837
    CC          = cc
Packit Service 065837
    CCC         = c++
Packit Service 065837
else
Packit Service 065837
ifeq ($(OS),FreeBSD)
Packit Service 065837
    CC          = cc
Packit Service 065837
    CCC         = c++
Packit Service 065837
else
Packit Service 065837
    CC          = gcc
Packit Service 065837
    CCC         = g++
Packit Service 065837
endif
Packit Service 065837
endif
Packit Service 065837
NASM        = nasm
Packit Service 065837
LINK        = ar cru
Packit Service 065837
OBJPATH     = $(topdir)/objs
Packit Service 065837
LIBPATH     = $(OBJPATH)/$(BUILD)/lib
Packit Service 065837
DEBUG_LIBPATH     = $(OBJPATH)/debug/lib
Packit Service 065837
RELEASE_LIBPATH   = $(OBJPATH)/release/lib
Packit Service 065837
ifeq ($(OS),Darwin)
Packit Service 065837
    STATIC_LIB_SUFFIX = a
Packit Service 065837
    DYNAMIC_LIB_SUFFIX = dylib
Packit Service 065837
else
Packit Service 065837
ifeq ($(findstring Windows,$(OS)),Windows)
Packit Service 065837
    STATIC_LIB_SUFFIX = a
Packit Service 065837
    DYNAMIC_LIB_SUFFIX = dll
Packit Service 065837
else
Packit Service 065837
    STATIC_LIB_SUFFIX = a
Packit Service 065837
    DYNAMIC_LIB_SUFFIX = so
Packit Service 065837
endif
Packit Service 065837
endif
Packit Service 065837
STATIC_LIB_NAME     = $(LIB_NAME).$(STATIC_LIB_SUFFIX)
Packit Service 065837
DYNAMIC_LIB_NAME    = $(LIB_NAME).$(DYNAMIC_LIB_SUFFIX)
Packit Service 065837
STATIC_LIB          = $(LIBPATH)/$(STATIC_LIB_NAME)
Packit Service 065837
DYNAMIC_LIB         = $(LIBPATH)/$(DYNAMIC_LIB_NAME)
Packit Service 065837
DEBUG_STATIC_LIB    = $(DEBUG_LIBPATH)/$(STATIC_LIB_NAME)
Packit Service 065837
DEBUG_DYNAMIC_LIB   = $(DEBUG_LIBPATH)/$(DYNAMIC_LIB_NAME)
Packit Service 065837
RELEASE_STATIC_LIB  = $(RELEASE_LIBPATH)/$(STATIC_LIB_NAME)
Packit Service 065837
RELEASE_DYNAMIC_LIB = $(RELEASE_LIBPATH)/$(DYNAMIC_LIB_NAME)
Packit Service 065837
ifeq ($(OS),Darwin)
Packit Service 065837
    LINKD       = $(CC) -dynamiclib -flat_namespace -undefined suppress -install_name $(DYNAMIC_LIB)
Packit Service 065837
else
Packit Service 065837
    LINKD       = $(CC) -shared
Packit Service 065837
endif
Packit Service 065837
Packit Service 065837
BASE_CFLAGS = -Wall -Wextra $(CONFIG_CFLAGS) -DVERSION=$(VERSION) -DPACKAGE_VERSION=$(VERSION) $(DEFINES) $(INCLUDES)
Packit Service 065837
Packit Service 065837
ifeq ($(DEFAULT_BUILD),debug)
Packit Service 065837
CFLAGS   := -g -O0 -DDEBUG $(CFLAGS) $(BASE_CFLAGS) -Wmissing-prototypes -Wstrict-prototypes
Packit Service 065837
CXXFLAGS := -g -O0 -DDEBUG $(CFLAGS) $(BASE_CFLAGS)
Packit Service 065837
endif
Packit Service 065837
Packit Service 065837
ifeq ($(DEFAULT_BUILD),valgrind)
Packit Service 065837
CFLAGS   := -g -O0 -DDEBUG  -DDEBUG -DFLAC__VALGRIND_TESTING $(CFLAGS) $(BASE_CFLAGS) -Wmissing-prototypes -Wstrict-prototypes
Packit Service 065837
CXXFLAGS := -g -O0 -DDEBUG -DDEBUG -DFLAC__VALGRIND_TESTING $(CFLAGS) $(BASE_CFLAGS)
Packit Service 065837
endif
Packit Service 065837
Packit Service 065837
ifeq ($(DEFAULT_BUILD),release)
Packit Service 065837
CFLAGS   := -O3 -fomit-frame-pointer -funroll-loops -finline-functions -DFLaC__INLINE=__inline__ -DNDEBUG $(CFLAGS) $(BASE_CFLAGS) -Wmissing-prototypes -Wstrict-prototypes
Packit Service 065837
CXXFLAGS := -O3 -fomit-frame-pointer -funroll-loops -finline-functions -DFLaC__INLINE=__inline__ -DNDEBUG $(CFLAGS) $(BASE_CFLAGS)
Packit Service 065837
endif
Packit Service 065837
Packit Service 065837
LFLAGS   = -L$(LIBPATH)
Packit Service 065837
Packit Service 065837
DEBUG_OBJS = $(SRCS_C:%.c=%.debug.o) $(SRCS_CC:%.cc=%.debug.o) $(SRCS_CPP:%.cpp=%.debug.o) $(SRCS_NASM:%.nasm=%.debug.o)
Packit Service 065837
RELEASE_OBJS = $(SRCS_C:%.c=%.release.o) $(SRCS_CC:%.cc=%.release.o) $(SRCS_CPP:%.cpp=%.release.o) $(SRCS_NASM:%.nasm=%.release.o)
Packit Service 065837
ifeq ($(PROC),x86_64)
Packit Service 065837
DEBUG_PIC_OBJS = $(SRCS_C:%.c=%.debug.pic.o) $(SRCS_CC:%.cc=%.debug.pic.o) $(SRCS_CPP:%.cpp=%.debug.pic.o) $(SRCS_NASM:%.nasm=%.debug.pic.o)
Packit Service 065837
RELEASE_PIC_OBJS = $(SRCS_C:%.c=%.release.pic.o) $(SRCS_CC:%.cc=%.release.pic.o) $(SRCS_CPP:%.cpp=%.release.pic.o) $(SRCS_NASM:%.nasm=%.release.pic.o)
Packit Service 065837
endif
Packit Service 065837
Packit Service 065837
debug   : $(DEBUG_STATIC_LIB) $(DEBUG_DYNAMIC_LIB)
Packit Service 065837
valgrind: $(DEBUG_STATIC_LIB) $(DEBUG_DYNAMIC_LIB)
Packit Service 065837
release : $(RELEASE_STATIC_LIB) $(RELEASE_DYNAMIC_LIB)
Packit Service 065837
Packit Service 065837
$(DEBUG_STATIC_LIB): $(DEBUG_OBJS)
Packit Service 065837
	$(LINK) $@ $(DEBUG_OBJS) && ranlib $@
Packit Service 065837
Packit Service 065837
$(RELEASE_STATIC_LIB): $(RELEASE_OBJS)
Packit Service 065837
	$(LINK) $@ $(RELEASE_OBJS) && ranlib $@
Packit Service 065837
Packit Service 065837
$(DEBUG_DYNAMIC_LIB) : $(DEBUG_OBJS) $(DEBUG_PIC_OBJS)
Packit Service 065837
ifeq ($(OS),Darwin)
Packit Service 065837
	echo Not building dynamic lib, command is: $(LINKD) -o $@ $(DEBUG_OBJS) $(LFLAGS) $(LIBS) -lc
Packit Service 065837
else
Packit Service 065837
ifeq ($(PROC),x86_64)
Packit Service 065837
	$(LINKD) -o $@ $(DEBUG_PIC_OBJS) $(LFLAGS) $(LIBS)
Packit Service 065837
else
Packit Service 065837
	$(LINKD) -o $@ $(DEBUG_OBJS) $(LFLAGS) $(LIBS)
Packit Service 065837
endif
Packit Service 065837
endif
Packit Service 065837
Packit Service 065837
$(RELEASE_DYNAMIC_LIB) : $(RELEASE_OBJS) $(RELEASE_PIC_OBJS)
Packit Service 065837
ifeq ($(OS),Darwin)
Packit Service 065837
	echo Not building dynamic lib, command is: $(LINKD) -o $@ $(RELEASE_OBJS) $(LFLAGS) $(LIBS) -lc
Packit Service 065837
else
Packit Service 065837
ifeq ($(PROC),x86_64)
Packit Service 065837
	$(LINKD) -o $@ $(RELEASE_PIC_OBJS) $(LFLAGS) $(LIBS)
Packit Service 065837
else
Packit Service 065837
	$(LINKD) -o $@ $(RELEASE_OBJS) $(LFLAGS) $(LIBS)
Packit Service 065837
endif
Packit Service 065837
endif
Packit Service 065837
Packit Service 065837
include $(topdir)/build/compile.mk
Packit Service 065837
Packit Service 065837
.PHONY : clean
Packit Service 065837
clean :
Packit Service 065837
	-rm -f $(DEBUG_OBJS) $(RELEASE_OBJS) $(DEBUG_PIC_OBJS) $(RELEASE_PIC_OBJS) $(OBJPATH)/*/lib/$(STATIC_LIB_NAME) $(OBJPATH)/*/lib/$(DYNAMIC_LIB_NAME)
Packit Service 065837
Packit Service 065837
.PHONY : depend
Packit Service 065837
depend:
Packit Service 065837
	makedepend -fMakefile.lite -- $(CFLAGS) $(INCLUDES) -- *.c *.cc *.cpp