Chris@1: # FLAC - Free Lossless Audio Codec Chris@1: # Copyright (C) 2001,2002,2003,2004,2005,2006,2007 Josh Coalson Chris@1: # Chris@1: # This file is part the FLAC project. FLAC is comprised of several Chris@1: # components distributed under difference licenses. The codec libraries Chris@1: # are distributed under Xiph.Org's BSD-like license (see the file Chris@1: # COPYING.Xiph in this distribution). All other programs, libraries, and Chris@1: # plugins are distributed under the GPL (see COPYING.GPL). The documentation Chris@1: # is distributed under the Gnu FDL (see COPYING.FDL). Each file in the Chris@1: # FLAC distribution contains at the top the terms under which it may be Chris@1: # distributed. Chris@1: # Chris@1: # Since this particular file is relevant to all components of FLAC, Chris@1: # it may be distributed under the Xiph.Org license, which is the least Chris@1: # restrictive of those mentioned above. See the file COPYING.Xiph in this Chris@1: # distribution. Chris@1: Chris@1: # Chris@1: # GNU makefile fragment for building an executable Chris@1: # Chris@1: Chris@1: include $(topdir)/build/config.mk Chris@1: Chris@1: ifeq ($(DARWIN_BUILD),yes) Chris@1: CC = cc Chris@1: CCC = c++ Chris@1: else Chris@1: CC = gcc Chris@1: CCC = g++ Chris@1: endif Chris@1: NASM = nasm Chris@1: LINK = $(CC) $(LINKAGE) Chris@1: OBJPATH = $(topdir)/obj Chris@1: BINPATH = $(OBJPATH)/$(BUILD)/bin Chris@1: LIBPATH = $(OBJPATH)/$(BUILD)/lib Chris@1: DEBUG_BINPATH = $(OBJPATH)/debug/bin Chris@1: DEBUG_LIBPATH = $(OBJPATH)/debug/lib Chris@1: RELEASE_BINPATH = $(OBJPATH)/release/bin Chris@1: RELEASE_LIBPATH = $(OBJPATH)/release/lib Chris@1: PROGRAM = $(BINPATH)/$(PROGRAM_NAME) Chris@1: DEBUG_PROGRAM = $(DEBUG_BINPATH)/$(PROGRAM_NAME) Chris@1: RELEASE_PROGRAM = $(RELEASE_BINPATH)/$(PROGRAM_NAME) Chris@1: Chris@1: debug : CFLAGS = -g -O0 -DDEBUG $(CONFIG_CFLAGS) $(DEBUG_CFLAGS) -W -Wall -Wmissing-prototypes -Wstrict-prototypes -DVERSION=$(VERSION) $(DEFINES) $(INCLUDES) Chris@1: valgrind: CFLAGS = -g -O0 -DDEBUG $(CONFIG_CFLAGS) $(DEBUG_CFLAGS) -DFLAC__VALGRIND_TESTING -W -Wall -Wmissing-prototypes -Wstrict-prototypes -DVERSION=$(VERSION) $(DEFINES) $(INCLUDES) Chris@1: 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) Chris@1: Chris@1: LFLAGS = -L$(LIBPATH) Chris@1: Chris@1: DEBUG_OBJS = $(SRCS_C:%.c=%.debug.o) $(SRCS_CC:%.cc=%.debug.o) $(SRCS_CPP:%.cpp=%.debug.o) $(SRCS_NASM:%.nasm=%.debug.o) Chris@1: RELEASE_OBJS = $(SRCS_C:%.c=%.release.o) $(SRCS_CC:%.cc=%.release.o) $(SRCS_CPP:%.cpp=%.release.o) $(SRCS_NASM:%.nasm=%.release.o) Chris@1: Chris@1: debug : $(DEBUG_PROGRAM) Chris@1: valgrind: $(DEBUG_PROGRAM) Chris@1: release : $(RELEASE_PROGRAM) Chris@1: Chris@1: # by default on OS X we link with static libs as much as possible Chris@1: Chris@1: $(DEBUG_PROGRAM) : $(DEBUG_OBJS) Chris@1: ifeq ($(DARWIN_BUILD),yes) Chris@1: $(LINK) -o $@ $(DEBUG_OBJS) $(EXPLICIT_LIBS) Chris@1: else Chris@1: $(LINK) -o $@ $(DEBUG_OBJS) $(LFLAGS) $(LIBS) Chris@1: endif Chris@1: Chris@1: $(RELEASE_PROGRAM) : $(RELEASE_OBJS) Chris@1: ifeq ($(DARWIN_BUILD),yes) Chris@1: $(LINK) -o $@ $(RELEASE_OBJS) $(EXPLICIT_LIBS) Chris@1: else Chris@1: $(LINK) -o $@ $(RELEASE_OBJS) $(LFLAGS) $(LIBS) Chris@1: endif Chris@1: Chris@1: %.debug.o %.release.o : %.c Chris@1: $(CC) $(CFLAGS) -c $< -o $@ Chris@1: %.debug.o %.release.o : %.cc Chris@1: $(CCC) $(CFLAGS) -c $< -o $@ Chris@1: %.debug.o %.release.o : %.cpp Chris@1: $(CCC) $(CFLAGS) -c $< -o $@ Chris@1: %.debug.i %.release.i : %.c Chris@1: $(CC) $(CFLAGS) -E $< -o $@ Chris@1: %.debug.i %.release.i : %.cc Chris@1: $(CCC) $(CFLAGS) -E $< -o $@ Chris@1: %.debug.i %.release.i : %.cpp Chris@1: $(CCC) $(CFLAGS) -E $< -o $@ Chris@1: Chris@1: %.debug.o : %.nasm Chris@1: $(NASM) -f elf -d OBJ_FORMAT_elf -i ia32/ -g $< -o $@ Chris@1: %.release.o : %.nasm Chris@1: $(NASM) -f elf -d OBJ_FORMAT_elf -i ia32/ $< -o $@ Chris@1: Chris@1: .PHONY : clean Chris@1: clean : Chris@1: -rm -f $(DEBUG_OBJS) $(RELEASE_OBJS) $(OBJPATH)/*/bin/$(PROGRAM_NAME) Chris@1: Chris@1: .PHONY : depend Chris@1: depend: Chris@1: makedepend -fMakefile.lite -- $(CFLAGS) $(INCLUDES) -- *.c *.cc *.cpp