Josh Coalson | 6b05bc5 | 2001-06-08 00:13:21 +0000 | [diff] [blame] | 1 | # FLAC - Free Lossless Audio Codec |
Erik de Castro Lopo | b1982fb | 2013-05-25 17:11:19 +1000 | [diff] [blame] | 2 | # Copyright (C) 2001-2009 Josh Coalson |
Erik de Castro Lopo | 1437391 | 2014-11-24 22:07:15 +1100 | [diff] [blame] | 3 | # Copyright (C) 2011-2014 Xiph.Org Foundation |
Josh Coalson | 6b05bc5 | 2001-06-08 00:13:21 +0000 | [diff] [blame] | 4 | # |
Josh Coalson | e8a7601 | 2003-02-07 00:14:32 +0000 | [diff] [blame] | 5 | # This file is part the FLAC project. FLAC is comprised of several |
Ulrich Klauer | cd4ddab | 2013-05-26 22:53:43 +0200 | [diff] [blame] | 6 | # components distributed under different licenses. The codec libraries |
Josh Coalson | e8a7601 | 2003-02-07 00:14:32 +0000 | [diff] [blame] | 7 | # are distributed under Xiph.Org's BSD-like license (see the file |
| 8 | # COPYING.Xiph in this distribution). All other programs, libraries, and |
| 9 | # plugins are distributed under the GPL (see COPYING.GPL). The documentation |
| 10 | # is distributed under the Gnu FDL (see COPYING.FDL). Each file in the |
| 11 | # FLAC distribution contains at the top the terms under which it may be |
| 12 | # distributed. |
Josh Coalson | 6b05bc5 | 2001-06-08 00:13:21 +0000 | [diff] [blame] | 13 | # |
Josh Coalson | e8a7601 | 2003-02-07 00:14:32 +0000 | [diff] [blame] | 14 | # Since this particular file is relevant to all components of FLAC, |
| 15 | # it may be distributed under the Xiph.Org license, which is the least |
| 16 | # restrictive of those mentioned above. See the file COPYING.Xiph in this |
| 17 | # distribution. |
Josh Coalson | 6b05bc5 | 2001-06-08 00:13:21 +0000 | [diff] [blame] | 18 | |
Josh Coalson | bb7f6b9 | 2000-12-10 04:09:52 +0000 | [diff] [blame] | 19 | # |
| 20 | # GNU makefile fragment for building an executable |
| 21 | # |
| 22 | |
Josh Coalson | b74fc98 | 2002-11-20 06:40:08 +0000 | [diff] [blame] | 23 | include $(topdir)/build/config.mk |
| 24 | |
Josh Coalson | c10f978 | 2008-09-14 19:59:52 +0000 | [diff] [blame] | 25 | ifeq ($(OS),Darwin) |
Hendricks266 | 96d081c | 2012-12-29 04:22:59 -0600 | [diff] [blame] | 26 | CC = cc |
| 27 | CCC = c++ |
Josh Coalson | 6e14490 | 2001-12-07 19:28:25 +0000 | [diff] [blame] | 28 | else |
Hendricks266 | 96d081c | 2012-12-29 04:22:59 -0600 | [diff] [blame] | 29 | CC = gcc |
| 30 | CCC = g++ |
Josh Coalson | 6e14490 | 2001-12-07 19:28:25 +0000 | [diff] [blame] | 31 | endif |
Josh Coalson | 955a767 | 2001-05-03 02:24:39 +0000 | [diff] [blame] | 32 | NASM = nasm |
Josh Coalson | 6e14490 | 2001-12-07 19:28:25 +0000 | [diff] [blame] | 33 | LINK = $(CC) $(LINKAGE) |
Erik de Castro Lopo | 85d5c53 | 2013-01-02 22:37:42 +1100 | [diff] [blame] | 34 | OBJPATH = $(topdir)/objs |
Josh Coalson | b74fc98 | 2002-11-20 06:40:08 +0000 | [diff] [blame] | 35 | BINPATH = $(OBJPATH)/$(BUILD)/bin |
| 36 | LIBPATH = $(OBJPATH)/$(BUILD)/lib |
| 37 | DEBUG_BINPATH = $(OBJPATH)/debug/bin |
| 38 | DEBUG_LIBPATH = $(OBJPATH)/debug/lib |
| 39 | RELEASE_BINPATH = $(OBJPATH)/release/bin |
| 40 | RELEASE_LIBPATH = $(OBJPATH)/release/lib |
| 41 | PROGRAM = $(BINPATH)/$(PROGRAM_NAME) |
| 42 | DEBUG_PROGRAM = $(DEBUG_BINPATH)/$(PROGRAM_NAME) |
| 43 | RELEASE_PROGRAM = $(RELEASE_BINPATH)/$(PROGRAM_NAME) |
Josh Coalson | 6ca4b1b | 2001-06-29 02:54:59 +0000 | [diff] [blame] | 44 | |
Evan Ramos | 9df6736 | 2014-06-23 16:24:49 -0500 | [diff] [blame] | 45 | debug : CFLAGS = -g -O0 -DDEBUG $(CONFIG_CFLAGS) $(DEBUG_CFLAGS) -W -Wall -DVERSION=$(VERSION) $(DEFINES) $(INCLUDES) |
| 46 | valgrind: CFLAGS = -g -O0 -DDEBUG $(CONFIG_CFLAGS) $(DEBUG_CFLAGS) -DFLAC__VALGRIND_TESTING -W -Wall -DVERSION=$(VERSION) $(DEFINES) $(INCLUDES) |
| 47 | release : CFLAGS = -O3 -fomit-frame-pointer -funroll-loops -finline-functions -DNDEBUG $(CONFIG_CFLAGS) $(RELEASE_CFLAGS) -W -Wall -Winline -DFLaC__INLINE=__inline__ -DVERSION=$(VERSION) $(DEFINES) $(INCLUDES) |
Josh Coalson | bb7f6b9 | 2000-12-10 04:09:52 +0000 | [diff] [blame] | 48 | |
Evan Ramos | 9df6736 | 2014-06-23 16:24:49 -0500 | [diff] [blame] | 49 | CFLAGS = $(CFLAGS) -Wmissing-prototypes -Wstrict-prototypes |
| 50 | CXXFLAGS = $(CFLAGS) |
| 51 | |
| 52 | LFLAGS = -L$(LIBPATH) |
Josh Coalson | bb7f6b9 | 2000-12-10 04:09:52 +0000 | [diff] [blame] | 53 | |
Erik de Castro Lopo | b60f16b | 2014-07-13 21:19:48 +1000 | [diff] [blame] | 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) |
Josh Coalson | c10f978 | 2008-09-14 19:59:52 +0000 | [diff] [blame] | 56 | ifeq ($(PROC),x86_64) |
Erik de Castro Lopo | b60f16b | 2014-07-13 21:19:48 +1000 | [diff] [blame] | 57 | 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) |
| 58 | 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) |
Josh Coalson | c10f978 | 2008-09-14 19:59:52 +0000 | [diff] [blame] | 59 | endif |
Josh Coalson | bb7f6b9 | 2000-12-10 04:09:52 +0000 | [diff] [blame] | 60 | |
Josh Coalson | f8ecdde | 2004-12-30 03:56:08 +0000 | [diff] [blame] | 61 | debug : $(DEBUG_PROGRAM) |
| 62 | valgrind: $(DEBUG_PROGRAM) |
| 63 | release : $(RELEASE_PROGRAM) |
Josh Coalson | bb7f6b9 | 2000-12-10 04:09:52 +0000 | [diff] [blame] | 64 | |
Josh Coalson | 2757af6 | 2004-10-30 00:03:21 +0000 | [diff] [blame] | 65 | # by default on OS X we link with static libs as much as possible |
| 66 | |
Josh Coalson | c10f978 | 2008-09-14 19:59:52 +0000 | [diff] [blame] | 67 | $(DEBUG_PROGRAM) : $(DEBUG_OBJS) $(DEBUG_PIC_OBJS) |
| 68 | ifeq ($(OS),Darwin) |
Josh Coalson | 2757af6 | 2004-10-30 00:03:21 +0000 | [diff] [blame] | 69 | $(LINK) -o $@ $(DEBUG_OBJS) $(EXPLICIT_LIBS) |
| 70 | else |
Josh Coalson | b74fc98 | 2002-11-20 06:40:08 +0000 | [diff] [blame] | 71 | $(LINK) -o $@ $(DEBUG_OBJS) $(LFLAGS) $(LIBS) |
Josh Coalson | 2757af6 | 2004-10-30 00:03:21 +0000 | [diff] [blame] | 72 | endif |
Josh Coalson | b74fc98 | 2002-11-20 06:40:08 +0000 | [diff] [blame] | 73 | |
Josh Coalson | c10f978 | 2008-09-14 19:59:52 +0000 | [diff] [blame] | 74 | $(RELEASE_PROGRAM) : $(RELEASE_OBJS) $(RELEASE_PIC_OBJS) |
| 75 | ifeq ($(OS),Darwin) |
Josh Coalson | 2757af6 | 2004-10-30 00:03:21 +0000 | [diff] [blame] | 76 | $(LINK) -o $@ $(RELEASE_OBJS) $(EXPLICIT_LIBS) |
| 77 | else |
Josh Coalson | b74fc98 | 2002-11-20 06:40:08 +0000 | [diff] [blame] | 78 | $(LINK) -o $@ $(RELEASE_OBJS) $(LFLAGS) $(LIBS) |
Josh Coalson | 2757af6 | 2004-10-30 00:03:21 +0000 | [diff] [blame] | 79 | endif |
Josh Coalson | b74fc98 | 2002-11-20 06:40:08 +0000 | [diff] [blame] | 80 | |
Josh Coalson | c10f978 | 2008-09-14 19:59:52 +0000 | [diff] [blame] | 81 | include $(topdir)/build/compile.mk |
Josh Coalson | 955a767 | 2001-05-03 02:24:39 +0000 | [diff] [blame] | 82 | |
Josh Coalson | bb7f6b9 | 2000-12-10 04:09:52 +0000 | [diff] [blame] | 83 | .PHONY : clean |
| 84 | clean : |
Josh Coalson | c10f978 | 2008-09-14 19:59:52 +0000 | [diff] [blame] | 85 | -rm -f $(DEBUG_OBJS) $(RELEASE_OBJS) $(DEBUG_PIC_OBJS) $(RELEASE_PIC_OBJS) $(OBJPATH)/*/bin/$(PROGRAM_NAME) |
Josh Coalson | bb7f6b9 | 2000-12-10 04:09:52 +0000 | [diff] [blame] | 86 | |
| 87 | .PHONY : depend |
| 88 | depend: |
Josh Coalson | 5601bca | 2002-10-16 22:33:56 +0000 | [diff] [blame] | 89 | makedepend -fMakefile.lite -- $(CFLAGS) $(INCLUDES) -- *.c *.cc *.cpp |