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 a library |
| 20 | # |
| 21 | |
Josh Coalson | 6e14490 | 2001-12-07 19:28:25 +0000 | [diff] [blame] | 22 | ifeq ($(DARWIN_BUILD),yes) |
| 23 | CC = cc |
Josh Coalson | b7557fd | 2002-05-17 06:08:44 +0000 | [diff] [blame] | 24 | CCC = c++ |
Josh Coalson | 6e14490 | 2001-12-07 19:28:25 +0000 | [diff] [blame] | 25 | else |
Josh Coalson | bb7f6b9 | 2000-12-10 04:09:52 +0000 | [diff] [blame] | 26 | CC = gcc |
Josh Coalson | b7557fd | 2002-05-17 06:08:44 +0000 | [diff] [blame] | 27 | CCC = g++ |
Josh Coalson | 6e14490 | 2001-12-07 19:28:25 +0000 | [diff] [blame] | 28 | endif |
Josh Coalson | 955a767 | 2001-05-03 02:24:39 +0000 | [diff] [blame] | 29 | NASM = nasm |
Josh Coalson | bb7f6b9 | 2000-12-10 04:09:52 +0000 | [diff] [blame] | 30 | LINK = ar cru |
Josh Coalson | 1ce20ee | 2002-08-14 00:50:48 +0000 | [diff] [blame] | 31 | LIBPATH = ../../obj/lib |
Josh Coalson | 6e14490 | 2001-12-07 19:28:25 +0000 | [diff] [blame] | 32 | ifeq ($(DARWIN_BUILD),yes) |
Josh Coalson | 1ce20ee | 2002-08-14 00:50:48 +0000 | [diff] [blame] | 33 | STATIC_LIB_SUFFIX = a |
| 34 | DYNAMIC_LIB_SUFFIX = dylib |
| 35 | else |
| 36 | STATIC_LIB_SUFFIX = a |
| 37 | DYNAMIC_LIB_SUFFIX = so |
| 38 | endif |
| 39 | STATIC_LIB = $(LIBPATH)/$(LIB_NAME).$(STATIC_LIB_SUFFIX) |
| 40 | DYNAMIC_LIB = $(LIBPATH)/$(LIB_NAME).$(DYNAMIC_LIB_SUFFIX) |
| 41 | ifeq ($(DARWIN_BUILD),yes) |
| 42 | LINKD = $(CC) -dynamiclib -flat_namespace -undefined suppress -install_name $(DYNAMIC_LIB) |
Josh Coalson | 6e14490 | 2001-12-07 19:28:25 +0000 | [diff] [blame] | 43 | else |
Josh Coalson | bb7f6b9 | 2000-12-10 04:09:52 +0000 | [diff] [blame] | 44 | LINKD = ld -G |
Josh Coalson | 6e14490 | 2001-12-07 19:28:25 +0000 | [diff] [blame] | 45 | endif |
Josh Coalson | bb7f6b9 | 2000-12-10 04:09:52 +0000 | [diff] [blame] | 46 | |
| 47 | all : release |
| 48 | |
Josh Coalson | 6ca4b1b | 2001-06-29 02:54:59 +0000 | [diff] [blame] | 49 | include ../../build/config.mk |
| 50 | |
| 51 | 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] | 52 | 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] | 53 | |
| 54 | LFLAGS = -L$(LIBPATH) |
| 55 | |
Josh Coalson | 6ca4b1b | 2001-06-29 02:54:59 +0000 | [diff] [blame] | 56 | debug : $(ORDINALS_H) $(STATIC_LIB) $(DYNAMIC_LIB) |
| 57 | release : $(ORDINALS_H) $(STATIC_LIB) $(DYNAMIC_LIB) |
Josh Coalson | bb7f6b9 | 2000-12-10 04:09:52 +0000 | [diff] [blame] | 58 | |
| 59 | $(STATIC_LIB) : $(OBJS) |
Josh Coalson | 6e14490 | 2001-12-07 19:28:25 +0000 | [diff] [blame] | 60 | $(LINK) $@ $(OBJS) && ranlib $@ |
Josh Coalson | bb7f6b9 | 2000-12-10 04:09:52 +0000 | [diff] [blame] | 61 | |
| 62 | $(DYNAMIC_LIB) : $(OBJS) |
Josh Coalson | 6e14490 | 2001-12-07 19:28:25 +0000 | [diff] [blame] | 63 | ifeq ($(DARWIN_BUILD),yes) |
| 64 | $(LINKD) -o $@ $(OBJS) $(LFLAGS) $(LIBS) -lc |
| 65 | else |
Josh Coalson | bb7f6b9 | 2000-12-10 04:09:52 +0000 | [diff] [blame] | 66 | $(LINKD) -o $@ $(OBJS) $(LFLAGS) $(LIBS) |
Josh Coalson | 6e14490 | 2001-12-07 19:28:25 +0000 | [diff] [blame] | 67 | endif |
Josh Coalson | bb7f6b9 | 2000-12-10 04:09:52 +0000 | [diff] [blame] | 68 | |
| 69 | %.o : %.c |
| 70 | $(CC) $(CFLAGS) -c $< -o $@ |
Josh Coalson | b7557fd | 2002-05-17 06:08:44 +0000 | [diff] [blame] | 71 | %.o : %.cc |
| 72 | $(CCC) $(CFLAGS) -c $< -o $@ |
Josh Coalson | bb7f6b9 | 2000-12-10 04:09:52 +0000 | [diff] [blame] | 73 | %.i : %.c |
| 74 | $(CC) $(CFLAGS) -E $< -o $@ |
Josh Coalson | b7557fd | 2002-05-17 06:08:44 +0000 | [diff] [blame] | 75 | %.i : %.cc |
| 76 | $(CCC) $(CFLAGS) -E $< -o $@ |
Josh Coalson | bb7f6b9 | 2000-12-10 04:09:52 +0000 | [diff] [blame] | 77 | |
Josh Coalson | 2255848 | 2001-06-13 18:04:47 +0000 | [diff] [blame] | 78 | %.o : %.nasm |
Josh Coalson | 1162f18 | 2001-06-19 06:48:21 +0000 | [diff] [blame] | 79 | $(NASM) -f elf -d OBJ_FORMAT_elf -i ia32/ $< -o $@ |
Josh Coalson | 955a767 | 2001-05-03 02:24:39 +0000 | [diff] [blame] | 80 | |
Josh Coalson | bb7f6b9 | 2000-12-10 04:09:52 +0000 | [diff] [blame] | 81 | .PHONY : clean |
| 82 | clean : |
Josh Coalson | 6ca4b1b | 2001-06-29 02:54:59 +0000 | [diff] [blame] | 83 | -rm -f $(OBJS) $(STATIC_LIB) $(DYNAMIC_LIB) $(ORDINALS_H) |
Josh Coalson | bb7f6b9 | 2000-12-10 04:09:52 +0000 | [diff] [blame] | 84 | |
| 85 | .PHONY : depend |
| 86 | depend: |
Josh Coalson | 087a5d2 | 2002-07-18 05:33:06 +0000 | [diff] [blame] | 87 | makedepend -fMakefile.lite -- $(CFLAGS) $(INCLUDES) -- *.c *.cc |