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 | 955a767 | 2001-05-03 02:24:39 +0000 | [diff] [blame] | 22 | CC = gcc |
| 23 | NASM = nasm |
Josh Coalson | bb7f6b9 | 2000-12-10 04:09:52 +0000 | [diff] [blame] | 24 | # LINKAGE can be forced to -static or -dynamic from invocation if desired, but it defaults to -static |
Josh Coalson | 955a767 | 2001-05-03 02:24:39 +0000 | [diff] [blame] | 25 | LINKAGE = -static |
| 26 | LINK = gcc $(LINKAGE) |
| 27 | BINPATH = ../../obj/bin |
| 28 | LIBPATH = ../../obj/lib |
| 29 | PROGRAM = $(BINPATH)/$(PROGRAM_NAME) |
Josh Coalson | bb7f6b9 | 2000-12-10 04:09:52 +0000 | [diff] [blame] | 30 | |
| 31 | all : release |
| 32 | |
Josh Coalson | 9c03c19 | 2001-05-03 00:48:32 +0000 | [diff] [blame] | 33 | debug : CFLAGS = -g -O0 -DDEBUG $(DEBUG_CFLAGS) -Wall -W $(DEFINES) $(INCLUDES) |
| 34 | release : CFLAGS = -O3 -fomit-frame-pointer -funroll-loops -ffast-math -finline-functions -DNDEBUG $(RELEASE_CFLAGS) -Wall -W $(DEFINES) $(INCLUDES) |
Josh Coalson | bb7f6b9 | 2000-12-10 04:09:52 +0000 | [diff] [blame] | 35 | |
| 36 | LFLAGS = -L$(LIBPATH) |
| 37 | |
| 38 | debug : $(PROGRAM) |
| 39 | release : $(PROGRAM) |
| 40 | |
| 41 | $(PROGRAM) : $(OBJS) |
| 42 | $(LINK) -o $@ $(OBJS) $(LFLAGS) $(LIBS) |
| 43 | |
| 44 | %.o : %.c |
| 45 | $(CC) $(CFLAGS) -c $< -o $@ |
| 46 | %.i : %.c |
| 47 | $(CC) $(CFLAGS) -E $< -o $@ |
| 48 | |
Josh Coalson | 31c8a1f | 2001-05-25 00:21:42 +0000 | [diff] [blame] | 49 | %.o : %.s |
Josh Coalson | 955a767 | 2001-05-03 02:24:39 +0000 | [diff] [blame] | 50 | $(NASM) -f elf -d ELF -i i386/ $< -o $@ |
| 51 | |
Josh Coalson | bb7f6b9 | 2000-12-10 04:09:52 +0000 | [diff] [blame] | 52 | .PHONY : clean |
| 53 | clean : |
| 54 | -rm -f $(OBJS) $(PROGRAM) |
| 55 | |
| 56 | .PHONY : depend |
| 57 | depend: |
| 58 | makedepend -- $(CFLAGS) $(INCLUDES) -- *.c |