exe.mk 1.72 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#  FLAC - Free Lossless Audio Codec
#  Copyright (C) 2001  Josh Coalson
#
#  This program is part of FLAC; you can redistribute it and/or
#  modify it under the terms of the GNU General Public License
#  as published by the Free Software Foundation; either version 2
#  of the License, or (at your option) any later version.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program; if not, write to the Free Software
#  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

Josh Coalson's avatar
Josh Coalson committed
18
19
20
21
#
# GNU makefile fragment for building an executable
#

Josh Coalson's avatar
Josh Coalson committed
22
23
CC          = gcc
NASM        = nasm
Josh Coalson's avatar
Josh Coalson committed
24
# LINKAGE can be forced to -static or -dynamic from invocation if desired, but it defaults to -static
Josh Coalson's avatar
Josh Coalson committed
25
26
27
28
29
LINKAGE     = -static
LINK        = gcc $(LINKAGE)
BINPATH     = ../../obj/bin
LIBPATH     = ../../obj/lib
PROGRAM     = $(BINPATH)/$(PROGRAM_NAME)
Josh Coalson's avatar
Josh Coalson committed
30
31
32

all : release

Josh Coalson's avatar
Josh Coalson committed
33
34
debug   : CFLAGS = -g -O0 -DDEBUG $(DEBUG_CFLAGS) -Wall -W $(DEFINES) $(INCLUDES)
release : CFLAGS = -O3 -fomit-frame-pointer -funroll-loops -ffast-math -finline-functions -DNDEBUG $(RELEASE_CFLAGS) -Wall -W $(DEFINES) $(INCLUDES)
Josh Coalson's avatar
Josh Coalson committed
35
36
37
38
39
40
41
42
43
44
45
46
47
48

LFLAGS  = -L$(LIBPATH)

debug   : $(PROGRAM)
release : $(PROGRAM)

$(PROGRAM) : $(OBJS)
	$(LINK) -o $@ $(OBJS) $(LFLAGS) $(LIBS)

%.o : %.c
	$(CC) $(CFLAGS) -c $< -o $@
%.i : %.c
	$(CC) $(CFLAGS) -E $< -o $@

49
%.o : %.nasm
Josh Coalson's avatar
Josh Coalson committed
50
51
	$(NASM) -f elf -d ELF -i i386/ $< -o $@

Josh Coalson's avatar
Josh Coalson committed
52
53
54
55
56
57
58
.PHONY : clean
clean :
	-rm -f $(OBJS) $(PROGRAM)

.PHONY : depend
depend:
	makedepend -- $(CFLAGS) $(INCLUDES) -- *.c