X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;ds=sidebyside;f=build%2Fexe.mk;h=62b546eceb0685ad33e11eddfd99c5ba3fab6f5d;hb=52fab8ba7e2a728e884a06fa80f9e0a0d4938e05;hp=369464d7c68289bf16d49ff5753168e21111dcd7;hpb=287fccd661fdf81329345959e87f1cdc44377a78;p=platform%2Fupstream%2Fflac.git diff --git a/build/exe.mk b/build/exe.mk index 369464d..62b546e 100644 --- a/build/exe.mk +++ b/build/exe.mk @@ -1,58 +1,85 @@ # FLAC - Free Lossless Audio Codec -# Copyright (C) 2001 Josh Coalson +# Copyright (C) 2001,2002,2003,2004,2005,2006,2007,2008,2009 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 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. # -# 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. +# 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. # # GNU makefile fragment for building an executable # -CC = gcc -NASM = nasm -# LINKAGE can be forced to -static or -dynamic from invocation if desired, but it defaults to -static -LINKAGE = -static -LINK = gcc $(LINKAGE) -BINPATH = ../../obj/bin -LIBPATH = ../../obj/lib -PROGRAM = $(BINPATH)/$(PROGRAM_NAME) +include $(topdir)/build/config.mk -all : release +ifeq ($(OS),Darwin) + CC = cc + CCC = c++ +else + CC = gcc + CCC = g++ +endif +NASM = nasm +LINK = $(CC) $(LINKAGE) +OBJPATH = $(topdir)/objs +BINPATH = $(OBJPATH)/$(BUILD)/bin +LIBPATH = $(OBJPATH)/$(BUILD)/lib +DEBUG_BINPATH = $(OBJPATH)/debug/bin +DEBUG_LIBPATH = $(OBJPATH)/debug/lib +RELEASE_BINPATH = $(OBJPATH)/release/bin +RELEASE_LIBPATH = $(OBJPATH)/release/lib +PROGRAM = $(BINPATH)/$(PROGRAM_NAME) +DEBUG_PROGRAM = $(DEBUG_BINPATH)/$(PROGRAM_NAME) +RELEASE_PROGRAM = $(RELEASE_BINPATH)/$(PROGRAM_NAME) -debug : CFLAGS = -g -O0 -DDEBUG $(DEBUG_CFLAGS) -Wall -W -DVERSION="1.0devel" $(DEFINES) $(INCLUDES) -release : CFLAGS = -O3 -fomit-frame-pointer -funroll-loops -ffast-math -finline-functions -DNDEBUG $(RELEASE_CFLAGS) -Wall -W -DVERSION="1.0devel" $(DEFINES) $(INCLUDES) +debug : CFLAGS = -g -O0 -DDEBUG $(CONFIG_CFLAGS) $(DEBUG_CFLAGS) -W -Wall -Wmissing-prototypes -Wstrict-prototypes -DVERSION=$(VERSION) $(DEFINES) $(INCLUDES) +valgrind: CFLAGS = -g -O0 -DDEBUG $(CONFIG_CFLAGS) $(DEBUG_CFLAGS) -DFLAC__VALGRIND_TESTING -W -Wall -Wmissing-prototypes -Wstrict-prototypes -DVERSION=$(VERSION) $(DEFINES) $(INCLUDES) +release : CFLAGS = -O3 -fomit-frame-pointer -funroll-loops -finline-functions -DNDEBUG $(CONFIG_CFLAGS) $(RELEASE_CFLAGS) -W -Wall -Wmissing-prototypes -Wstrict-prototypes -Winline -DFLaC__INLINE=__inline__ -DVERSION=$(VERSION) $(DEFINES) $(INCLUDES) LFLAGS = -L$(LIBPATH) -debug : $(PROGRAM) -release : $(PROGRAM) +DEBUG_OBJS = $(SRCS_C:%.c=%.debug.o) $(SRCS_CC:%.cc=%.debug.o) $(SRCS_CPP:%.cpp=%.debug.o) $(SRCS_NASM:%.nasm=%.debug.o) $(SRCS_S:%.s=%.debug.o) +RELEASE_OBJS = $(SRCS_C:%.c=%.release.o) $(SRCS_CC:%.cc=%.release.o) $(SRCS_CPP:%.cpp=%.release.o) $(SRCS_NASM:%.nasm=%.release.o) $(SRCS_S:%.s=%.release.o) +ifeq ($(PROC),x86_64) +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) $(SRCS_S:%.s=%.debug.pic.o) +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) $(SRCS_S:%.s=%.release.pic.o) +endif + +debug : $(DEBUG_PROGRAM) +valgrind: $(DEBUG_PROGRAM) +release : $(RELEASE_PROGRAM) + +# by default on OS X we link with static libs as much as possible -$(PROGRAM) : $(OBJS) - $(LINK) -o $@ $(OBJS) $(LFLAGS) $(LIBS) +$(DEBUG_PROGRAM) : $(DEBUG_OBJS) $(DEBUG_PIC_OBJS) +ifeq ($(OS),Darwin) + $(LINK) -o $@ $(DEBUG_OBJS) $(EXPLICIT_LIBS) +else + $(LINK) -o $@ $(DEBUG_OBJS) $(LFLAGS) $(LIBS) +endif -%.o : %.c - $(CC) $(CFLAGS) -c $< -o $@ -%.i : %.c - $(CC) $(CFLAGS) -E $< -o $@ +$(RELEASE_PROGRAM) : $(RELEASE_OBJS) $(RELEASE_PIC_OBJS) +ifeq ($(OS),Darwin) + $(LINK) -o $@ $(RELEASE_OBJS) $(EXPLICIT_LIBS) +else + $(LINK) -o $@ $(RELEASE_OBJS) $(LFLAGS) $(LIBS) +endif -%.o : %.nasm - $(NASM) -f elf -d ELF -i ia32/ $< -o $@ +include $(topdir)/build/compile.mk .PHONY : clean clean : - -rm -f $(OBJS) $(PROGRAM) + -rm -f $(DEBUG_OBJS) $(RELEASE_OBJS) $(DEBUG_PIC_OBJS) $(RELEASE_PIC_OBJS) $(OBJPATH)/*/bin/$(PROGRAM_NAME) .PHONY : depend depend: - makedepend -- $(CFLAGS) $(INCLUDES) -- *.c + makedepend -fMakefile.lite -- $(CFLAGS) $(INCLUDES) -- *.c *.cc *.cpp