Josh Coalson | 6b05bc5 | 2001-06-08 00:13:21 +0000 | [diff] [blame] | 1 | # FLAC - Free Lossless Audio Codec |
Josh Coalson | 1152f9f | 2002-01-26 18:05:12 +0000 | [diff] [blame] | 2 | # Copyright (C) 2001,2002 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 | 6e14490 | 2001-12-07 19:28:25 +0000 | [diff] [blame] | 32 | # LINKAGE can be forced to -static or -dynamic from invocation if desired, but it defaults to -static except on OSX |
| 33 | ifeq ($(DARWIN_BUILD),yes) |
| 34 | LINKAGE = -dynamic |
| 35 | else |
Josh Coalson | 955a767 | 2001-05-03 02:24:39 +0000 | [diff] [blame] | 36 | LINKAGE = -static |
Josh Coalson | 6e14490 | 2001-12-07 19:28:25 +0000 | [diff] [blame] | 37 | endif |
| 38 | LINK = $(CC) $(LINKAGE) |
Josh Coalson | b74fc98 | 2002-11-20 06:40:08 +0000 | [diff] [blame] | 39 | OBJPATH = $(topdir)/obj |
| 40 | BINPATH = $(OBJPATH)/$(BUILD)/bin |
| 41 | LIBPATH = $(OBJPATH)/$(BUILD)/lib |
| 42 | DEBUG_BINPATH = $(OBJPATH)/debug/bin |
| 43 | DEBUG_LIBPATH = $(OBJPATH)/debug/lib |
| 44 | RELEASE_BINPATH = $(OBJPATH)/release/bin |
| 45 | RELEASE_LIBPATH = $(OBJPATH)/release/lib |
| 46 | PROGRAM = $(BINPATH)/$(PROGRAM_NAME) |
| 47 | DEBUG_PROGRAM = $(DEBUG_BINPATH)/$(PROGRAM_NAME) |
| 48 | RELEASE_PROGRAM = $(RELEASE_BINPATH)/$(PROGRAM_NAME) |
Josh Coalson | 6ca4b1b | 2001-06-29 02:54:59 +0000 | [diff] [blame] | 49 | |
| 50 | debug : CFLAGS = -g -O0 -DDEBUG $(DEBUG_CFLAGS) -Wall -W -DVERSION=$(VERSION) $(DEFINES) $(INCLUDES) |
Josh Coalson | 9bab041 | 2001-07-20 23:44:35 +0000 | [diff] [blame] | 51 | 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] | 52 | |
| 53 | LFLAGS = -L$(LIBPATH) |
| 54 | |
Josh Coalson | b74fc98 | 2002-11-20 06:40:08 +0000 | [diff] [blame] | 55 | #@@@ OBJS = $(SRCS_C:%.c=%.o) $(SRCS_CC:%.cc=%.o) $(SRCS_CPP:%.cpp=%.o) $(SRCS_NASM:%.nasm=%.o) |
| 56 | #@@@ OBJS = $(SRCS_C:%.c=%.$(BUILD).o) $(SRCS_CC:%.cc=%.$(BUILD).o) $(SRCS_CPP:%.cpp=%.$(BUILD).o) $(SRCS_NASM:%.nasm=%.$(BUILD).o) |
| 57 | DEBUG_OBJS = $(SRCS_C:%.c=%.debug.o) $(SRCS_CC:%.cc=%.debug.o) $(SRCS_CPP:%.cpp=%.debug.o) $(SRCS_NASM:%.nasm=%.debug.o) |
| 58 | 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] | 59 | |
Josh Coalson | b74fc98 | 2002-11-20 06:40:08 +0000 | [diff] [blame] | 60 | debug : $(ORDINALS_H) $(DEBUG_PROGRAM) |
| 61 | release : $(ORDINALS_H) $(RELEASE_PROGRAM) |
Josh Coalson | bb7f6b9 | 2000-12-10 04:09:52 +0000 | [diff] [blame] | 62 | |
Josh Coalson | b74fc98 | 2002-11-20 06:40:08 +0000 | [diff] [blame] | 63 | $(DEBUG_PROGRAM) : $(DEBUG_OBJS) |
| 64 | $(LINK) -o $@ $(DEBUG_OBJS) $(LFLAGS) $(LIBS) |
| 65 | |
| 66 | $(RELEASE_PROGRAM) : $(RELEASE_OBJS) |
| 67 | $(LINK) -o $@ $(RELEASE_OBJS) $(LFLAGS) $(LIBS) |
| 68 | |
| 69 | %.debug.o %.release.o : %.c |
Josh Coalson | bb7f6b9 | 2000-12-10 04:09:52 +0000 | [diff] [blame] | 70 | $(CC) $(CFLAGS) -c $< -o $@ |
Josh Coalson | b74fc98 | 2002-11-20 06:40:08 +0000 | [diff] [blame] | 71 | %.debug.o %.release.o : %.cc |
Josh Coalson | b7557fd | 2002-05-17 06:08:44 +0000 | [diff] [blame] | 72 | $(CCC) $(CFLAGS) -c $< -o $@ |
Josh Coalson | b74fc98 | 2002-11-20 06:40:08 +0000 | [diff] [blame] | 73 | %.debug.o %.release.o : %.cpp |
Josh Coalson | 5601bca | 2002-10-16 22:33:56 +0000 | [diff] [blame] | 74 | $(CCC) $(CFLAGS) -c $< -o $@ |
Josh Coalson | b74fc98 | 2002-11-20 06:40:08 +0000 | [diff] [blame] | 75 | %.debug.i %.release.i : %.c |
Josh Coalson | bb7f6b9 | 2000-12-10 04:09:52 +0000 | [diff] [blame] | 76 | $(CC) $(CFLAGS) -E $< -o $@ |
Josh Coalson | b74fc98 | 2002-11-20 06:40:08 +0000 | [diff] [blame] | 77 | %.debug.i %.release.i : %.cc |
Josh Coalson | b7557fd | 2002-05-17 06:08:44 +0000 | [diff] [blame] | 78 | $(CCC) $(CFLAGS) -E $< -o $@ |
Josh Coalson | b74fc98 | 2002-11-20 06:40:08 +0000 | [diff] [blame] | 79 | %.debug.i %.release.i : %.cpp |
Josh Coalson | 5601bca | 2002-10-16 22:33:56 +0000 | [diff] [blame] | 80 | $(CCC) $(CFLAGS) -E $< -o $@ |
Josh Coalson | bb7f6b9 | 2000-12-10 04:09:52 +0000 | [diff] [blame] | 81 | |
Josh Coalson | b74fc98 | 2002-11-20 06:40:08 +0000 | [diff] [blame] | 82 | %.debug.o %.release.o : %.nasm |
Josh Coalson | 1162f18 | 2001-06-19 06:48:21 +0000 | [diff] [blame] | 83 | $(NASM) -f elf -d OBJ_FORMAT_elf -i ia32/ $< -o $@ |
Josh Coalson | 955a767 | 2001-05-03 02:24:39 +0000 | [diff] [blame] | 84 | |
Josh Coalson | bb7f6b9 | 2000-12-10 04:09:52 +0000 | [diff] [blame] | 85 | .PHONY : clean |
| 86 | clean : |
Josh Coalson | b166b9d | 2002-11-21 09:09:03 +0000 | [diff] [blame^] | 87 | -rm -f $(DEBUG_OBJS) $(RELEASE_OBJS) $(OBJPATH)/*/bin/$(PROGRAM_NAME) |
Josh Coalson | bb7f6b9 | 2000-12-10 04:09:52 +0000 | [diff] [blame] | 88 | |
| 89 | .PHONY : depend |
| 90 | depend: |
Josh Coalson | 5601bca | 2002-10-16 22:33:56 +0000 | [diff] [blame] | 91 | makedepend -fMakefile.lite -- $(CFLAGS) $(INCLUDES) -- *.c *.cc *.cpp |