Josh Coalson | 6b05bc5 | 2001-06-08 00:13:21 +0000 | [diff] [blame] | 1 | # FLAC - Free Lossless Audio Codec |
| 2 | # Copyright (C) 2001 Josh Coalson |
| 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 | 6e14490 | 2001-12-07 19:28:25 +0000 | [diff] [blame^] | 22 | ifeq ($(DARWIN_BUILD),yes) |
| 23 | CC = cc |
| 24 | else |
Josh Coalson | 955a767 | 2001-05-03 02:24:39 +0000 | [diff] [blame] | 25 | CC = gcc |
Josh Coalson | 6e14490 | 2001-12-07 19:28:25 +0000 | [diff] [blame^] | 26 | endif |
Josh Coalson | 955a767 | 2001-05-03 02:24:39 +0000 | [diff] [blame] | 27 | NASM = nasm |
Josh Coalson | 6e14490 | 2001-12-07 19:28:25 +0000 | [diff] [blame^] | 28 | # LINKAGE can be forced to -static or -dynamic from invocation if desired, but it defaults to -static except on OSX |
| 29 | ifeq ($(DARWIN_BUILD),yes) |
| 30 | LINKAGE = -dynamic |
| 31 | else |
Josh Coalson | 955a767 | 2001-05-03 02:24:39 +0000 | [diff] [blame] | 32 | LINKAGE = -static |
Josh Coalson | 6e14490 | 2001-12-07 19:28:25 +0000 | [diff] [blame^] | 33 | endif |
| 34 | LINK = $(CC) $(LINKAGE) |
Josh Coalson | 955a767 | 2001-05-03 02:24:39 +0000 | [diff] [blame] | 35 | BINPATH = ../../obj/bin |
| 36 | LIBPATH = ../../obj/lib |
| 37 | PROGRAM = $(BINPATH)/$(PROGRAM_NAME) |
Josh Coalson | bb7f6b9 | 2000-12-10 04:09:52 +0000 | [diff] [blame] | 38 | |
| 39 | all : release |
| 40 | |
Josh Coalson | 6ca4b1b | 2001-06-29 02:54:59 +0000 | [diff] [blame] | 41 | include ../../build/config.mk |
| 42 | |
| 43 | 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] | 44 | 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] | 45 | |
| 46 | LFLAGS = -L$(LIBPATH) |
| 47 | |
Josh Coalson | 6ca4b1b | 2001-06-29 02:54:59 +0000 | [diff] [blame] | 48 | debug : $(ORDINALS_H) $(PROGRAM) |
| 49 | release : $(ORDINALS_H) $(PROGRAM) |
Josh Coalson | bb7f6b9 | 2000-12-10 04:09:52 +0000 | [diff] [blame] | 50 | |
| 51 | $(PROGRAM) : $(OBJS) |
| 52 | $(LINK) -o $@ $(OBJS) $(LFLAGS) $(LIBS) |
| 53 | |
| 54 | %.o : %.c |
| 55 | $(CC) $(CFLAGS) -c $< -o $@ |
| 56 | %.i : %.c |
| 57 | $(CC) $(CFLAGS) -E $< -o $@ |
| 58 | |
Josh Coalson | 2255848 | 2001-06-13 18:04:47 +0000 | [diff] [blame] | 59 | %.o : %.nasm |
Josh Coalson | 1162f18 | 2001-06-19 06:48:21 +0000 | [diff] [blame] | 60 | $(NASM) -f elf -d OBJ_FORMAT_elf -i ia32/ $< -o $@ |
Josh Coalson | 955a767 | 2001-05-03 02:24:39 +0000 | [diff] [blame] | 61 | |
Josh Coalson | bb7f6b9 | 2000-12-10 04:09:52 +0000 | [diff] [blame] | 62 | .PHONY : clean |
| 63 | clean : |
| 64 | -rm -f $(OBJS) $(PROGRAM) |
| 65 | |
| 66 | .PHONY : depend |
| 67 | depend: |
| 68 | makedepend -- $(CFLAGS) $(INCLUDES) -- *.c |