Josh Coalson | 6b05bc5 | 2001-06-08 00:13:21 +0000 | [diff] [blame] | 1 | # FLAC - Free Lossless Audio Codec |
Josh Coalson | afae69f | 2003-01-02 07:03:16 +0000 | [diff] [blame] | 2 | # Copyright (C) 2001,2002,2003 Josh Coalson |
Josh Coalson | 6b05bc5 | 2001-06-08 00:13:21 +0000 | [diff] [blame] | 3 | # |
| 4 | # This program is part of FLAC; you can redistribute it and/or |
| 5 | # modify it under the terms of the GNU General Public License |
| 6 | # as published by the Free Software Foundation; either version 2 |
| 7 | # of the License, or (at your option) any later version. |
| 8 | # |
| 9 | # This program is distributed in the hope that it will be useful, |
| 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | # GNU General Public License for more details. |
| 13 | # |
| 14 | # You should have received a copy of the GNU General Public License |
| 15 | # along with this program; if not, write to the Free Software |
| 16 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 17 | |
Josh Coalson | bb7f6b9 | 2000-12-10 04:09:52 +0000 | [diff] [blame] | 18 | # |
| 19 | # GNU makefile fragment for building an executable |
| 20 | # |
| 21 | |
Josh Coalson | b74fc98 | 2002-11-20 06:40:08 +0000 | [diff] [blame] | 22 | include $(topdir)/build/config.mk |
| 23 | |
Josh Coalson | 6e14490 | 2001-12-07 19:28:25 +0000 | [diff] [blame] | 24 | ifeq ($(DARWIN_BUILD),yes) |
| 25 | CC = cc |
Josh Coalson | b7557fd | 2002-05-17 06:08:44 +0000 | [diff] [blame] | 26 | CCC = c++ |
Josh Coalson | 6e14490 | 2001-12-07 19:28:25 +0000 | [diff] [blame] | 27 | else |
Josh Coalson | 955a767 | 2001-05-03 02:24:39 +0000 | [diff] [blame] | 28 | CC = gcc |
Josh Coalson | b7557fd | 2002-05-17 06:08:44 +0000 | [diff] [blame] | 29 | CCC = g++ |
Josh Coalson | 6e14490 | 2001-12-07 19:28:25 +0000 | [diff] [blame] | 30 | endif |
Josh Coalson | 955a767 | 2001-05-03 02:24:39 +0000 | [diff] [blame] | 31 | NASM = nasm |
Josh Coalson | 34c1ea8 | 2002-12-04 04:57:33 +0000 | [diff] [blame] | 32 | # override to -dynamic on OSX |
Josh Coalson | 6e14490 | 2001-12-07 19:28:25 +0000 | [diff] [blame] | 33 | ifeq ($(DARWIN_BUILD),yes) |
| 34 | LINKAGE = -dynamic |
Josh Coalson | 6e14490 | 2001-12-07 19:28:25 +0000 | [diff] [blame] | 35 | endif |
| 36 | LINK = $(CC) $(LINKAGE) |
Josh Coalson | b74fc98 | 2002-11-20 06:40:08 +0000 | [diff] [blame] | 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) |
Josh Coalson | 6ca4b1b | 2001-06-29 02:54:59 +0000 | [diff] [blame] | 47 | |
| 48 | debug : CFLAGS = -g -O0 -DDEBUG $(DEBUG_CFLAGS) -Wall -W -DVERSION=$(VERSION) $(DEFINES) $(INCLUDES) |
Josh Coalson | 962bb3b | 2002-12-28 07:08:31 +0000 | [diff] [blame] | 49 | valgrind: CFLAGS = -g -O0 -DDEBUG $(DEBUG_CFLAGS) -DFLAC__VALGRIND_TESTING -Wall -W -DVERSION=$(VERSION) $(DEFINES) $(INCLUDES) |
Josh Coalson | 9bab041 | 2001-07-20 23:44:35 +0000 | [diff] [blame] | 50 | release : CFLAGS = -O3 -fomit-frame-pointer -funroll-loops -finline-functions -DNDEBUG $(RELEASE_CFLAGS) -Wall -W -Winline -DFLaC__INLINE=__inline__ -DVERSION=$(VERSION) $(DEFINES) $(INCLUDES) |
Josh Coalson | bb7f6b9 | 2000-12-10 04:09:52 +0000 | [diff] [blame] | 51 | |
| 52 | LFLAGS = -L$(LIBPATH) |
| 53 | |
Josh Coalson | b74fc98 | 2002-11-20 06:40:08 +0000 | [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 | bb7f6b9 | 2000-12-10 04:09:52 +0000 | [diff] [blame] | 56 | |
Josh Coalson | b74fc98 | 2002-11-20 06:40:08 +0000 | [diff] [blame] | 57 | debug : $(ORDINALS_H) $(DEBUG_PROGRAM) |
Josh Coalson | 34c1ea8 | 2002-12-04 04:57:33 +0000 | [diff] [blame] | 58 | valgrind: $(ORDINALS_H) $(DEBUG_PROGRAM) |
Josh Coalson | b74fc98 | 2002-11-20 06:40:08 +0000 | [diff] [blame] | 59 | release : $(ORDINALS_H) $(RELEASE_PROGRAM) |
Josh Coalson | bb7f6b9 | 2000-12-10 04:09:52 +0000 | [diff] [blame] | 60 | |
Josh Coalson | b74fc98 | 2002-11-20 06:40:08 +0000 | [diff] [blame] | 61 | $(DEBUG_PROGRAM) : $(DEBUG_OBJS) |
| 62 | $(LINK) -o $@ $(DEBUG_OBJS) $(LFLAGS) $(LIBS) |
| 63 | |
| 64 | $(RELEASE_PROGRAM) : $(RELEASE_OBJS) |
| 65 | $(LINK) -o $@ $(RELEASE_OBJS) $(LFLAGS) $(LIBS) |
| 66 | |
| 67 | %.debug.o %.release.o : %.c |
Josh Coalson | bb7f6b9 | 2000-12-10 04:09:52 +0000 | [diff] [blame] | 68 | $(CC) $(CFLAGS) -c $< -o $@ |
Josh Coalson | b74fc98 | 2002-11-20 06:40:08 +0000 | [diff] [blame] | 69 | %.debug.o %.release.o : %.cc |
Josh Coalson | b7557fd | 2002-05-17 06:08:44 +0000 | [diff] [blame] | 70 | $(CCC) $(CFLAGS) -c $< -o $@ |
Josh Coalson | b74fc98 | 2002-11-20 06:40:08 +0000 | [diff] [blame] | 71 | %.debug.o %.release.o : %.cpp |
Josh Coalson | 5601bca | 2002-10-16 22:33:56 +0000 | [diff] [blame] | 72 | $(CCC) $(CFLAGS) -c $< -o $@ |
Josh Coalson | b74fc98 | 2002-11-20 06:40:08 +0000 | [diff] [blame] | 73 | %.debug.i %.release.i : %.c |
Josh Coalson | bb7f6b9 | 2000-12-10 04:09:52 +0000 | [diff] [blame] | 74 | $(CC) $(CFLAGS) -E $< -o $@ |
Josh Coalson | b74fc98 | 2002-11-20 06:40:08 +0000 | [diff] [blame] | 75 | %.debug.i %.release.i : %.cc |
Josh Coalson | b7557fd | 2002-05-17 06:08:44 +0000 | [diff] [blame] | 76 | $(CCC) $(CFLAGS) -E $< -o $@ |
Josh Coalson | b74fc98 | 2002-11-20 06:40:08 +0000 | [diff] [blame] | 77 | %.debug.i %.release.i : %.cpp |
Josh Coalson | 5601bca | 2002-10-16 22:33:56 +0000 | [diff] [blame] | 78 | $(CCC) $(CFLAGS) -E $< -o $@ |
Josh Coalson | bb7f6b9 | 2000-12-10 04:09:52 +0000 | [diff] [blame] | 79 | |
Josh Coalson | b74fc98 | 2002-11-20 06:40:08 +0000 | [diff] [blame] | 80 | %.debug.o %.release.o : %.nasm |
Josh Coalson | 1162f18 | 2001-06-19 06:48:21 +0000 | [diff] [blame] | 81 | $(NASM) -f elf -d OBJ_FORMAT_elf -i ia32/ $< -o $@ |
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 | b166b9d | 2002-11-21 09:09:03 +0000 | [diff] [blame] | 85 | -rm -f $(DEBUG_OBJS) $(RELEASE_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 |