1 # FLAC - Free Lossless Audio Codec
2 # Copyright (C) 2001,2002,2003,2004 Josh Coalson
4 # This file is part the FLAC project. FLAC is comprised of several
5 # components distributed under difference licenses. The codec libraries
6 # are distributed under Xiph.Org's BSD-like license (see the file
7 # COPYING.Xiph in this distribution). All other programs, libraries, and
8 # plugins are distributed under the GPL (see COPYING.GPL). The documentation
9 # is distributed under the Gnu FDL (see COPYING.FDL). Each file in the
10 # FLAC distribution contains at the top the terms under which it may be
13 # Since this particular file is relevant to all components of FLAC,
14 # it may be distributed under the Xiph.Org license, which is the least
15 # restrictive of those mentioned above. See the file COPYING.Xiph in this
19 # GNU makefile fragment for building an executable
22 include $(topdir)/build/config.mk
24 ifeq ($(DARWIN_BUILD),yes)
32 # override to -dynamic on OSX
33 ifeq ($(DARWIN_BUILD),yes)
36 LINK = $(CC) $(LINKAGE)
37 OBJPATH = $(topdir)/obj
38 BINPATH = $(OBJPATH)/$(BUILD)/bin
39 LIBPATH = $(OBJPATH)/$(BUILD)/lib
40 DEBUG_BINPATH = $(OBJPATH)/debug/bin
41 DEBUG_LIBPATH = $(OBJPATH)/debug/lib
42 RELEASE_BINPATH = $(OBJPATH)/release/bin
43 RELEASE_LIBPATH = $(OBJPATH)/release/lib
44 PROGRAM = $(BINPATH)/$(PROGRAM_NAME)
45 DEBUG_PROGRAM = $(DEBUG_BINPATH)/$(PROGRAM_NAME)
46 RELEASE_PROGRAM = $(RELEASE_BINPATH)/$(PROGRAM_NAME)
48 debug : CFLAGS = -g -O0 -DDEBUG $(CONFIG_CFLAGS) $(DEBUG_CFLAGS) -Wall -W -DVERSION=$(VERSION) $(DEFINES) $(INCLUDES)
49 valgrind: CFLAGS = -g -O0 -DDEBUG $(CONFIG_CFLAGS) $(DEBUG_CFLAGS) -DFLAC__VALGRIND_TESTING -Wall -W -DVERSION=$(VERSION) $(DEFINES) $(INCLUDES)
50 release : CFLAGS = -O3 -fomit-frame-pointer -funroll-loops -finline-functions -DNDEBUG $(CONFIG_CFLAGS) $(RELEASE_CFLAGS) -Wall -W -Winline -DFLaC__INLINE=__inline__ -DVERSION=$(VERSION) $(DEFINES) $(INCLUDES)
54 DEBUG_OBJS = $(SRCS_C:%.c=%.debug.o) $(SRCS_CC:%.cc=%.debug.o) $(SRCS_CPP:%.cpp=%.debug.o) $(SRCS_NASM:%.nasm=%.debug.o)
55 RELEASE_OBJS = $(SRCS_C:%.c=%.release.o) $(SRCS_CC:%.cc=%.release.o) $(SRCS_CPP:%.cpp=%.release.o) $(SRCS_NASM:%.nasm=%.release.o)
57 debug : $(ORDINALS_H) $(DEBUG_PROGRAM)
58 valgrind: $(ORDINALS_H) $(DEBUG_PROGRAM)
59 release : $(ORDINALS_H) $(RELEASE_PROGRAM)
61 $(DEBUG_PROGRAM) : $(DEBUG_OBJS)
62 $(LINK) -o $@ $(DEBUG_OBJS) $(LFLAGS) $(LIBS)
64 $(RELEASE_PROGRAM) : $(RELEASE_OBJS)
65 $(LINK) -o $@ $(RELEASE_OBJS) $(LFLAGS) $(LIBS)
67 %.debug.o %.release.o : %.c
68 $(CC) $(CFLAGS) -c $< -o $@
69 %.debug.o %.release.o : %.cc
70 $(CCC) $(CFLAGS) -c $< -o $@
71 %.debug.o %.release.o : %.cpp
72 $(CCC) $(CFLAGS) -c $< -o $@
73 %.debug.i %.release.i : %.c
74 $(CC) $(CFLAGS) -E $< -o $@
75 %.debug.i %.release.i : %.cc
76 $(CCC) $(CFLAGS) -E $< -o $@
77 %.debug.i %.release.i : %.cpp
78 $(CCC) $(CFLAGS) -E $< -o $@
80 %.debug.o %.release.o : %.nasm
81 $(NASM) -f elf -d OBJ_FORMAT_elf -i ia32/ $< -o $@
85 -rm -f $(DEBUG_OBJS) $(RELEASE_OBJS) $(OBJPATH)/*/bin/$(PROGRAM_NAME)
89 makedepend -fMakefile.lite -- $(CFLAGS) $(INCLUDES) -- *.c *.cc *.cpp