2001-06-08 00:13:21 +00:00
|
|
|
# FLAC - Free Lossless Audio Codec
|
2002-01-26 18:05:12 +00:00
|
|
|
# Copyright (C) 2001,2002 Josh Coalson
|
2001-06-08 00:13:21 +00:00
|
|
|
#
|
|
|
|
# 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.
|
|
|
|
|
2000-12-10 04:09:52 +00:00
|
|
|
#
|
|
|
|
# GNU makefile fragment for building an executable
|
|
|
|
#
|
|
|
|
|
2002-11-20 06:40:08 +00:00
|
|
|
include $(topdir)/build/config.mk
|
|
|
|
|
2001-12-07 19:28:25 +00:00
|
|
|
ifeq ($(DARWIN_BUILD),yes)
|
|
|
|
CC = cc
|
2002-05-17 06:08:44 +00:00
|
|
|
CCC = c++
|
2001-12-07 19:28:25 +00:00
|
|
|
else
|
2001-05-03 02:24:39 +00:00
|
|
|
CC = gcc
|
2002-05-17 06:08:44 +00:00
|
|
|
CCC = g++
|
2001-12-07 19:28:25 +00:00
|
|
|
endif
|
2001-05-03 02:24:39 +00:00
|
|
|
NASM = nasm
|
2001-12-07 19:28:25 +00:00
|
|
|
# LINKAGE can be forced to -static or -dynamic from invocation if desired, but it defaults to -static except on OSX
|
|
|
|
ifeq ($(DARWIN_BUILD),yes)
|
|
|
|
LINKAGE = -dynamic
|
|
|
|
else
|
2001-05-03 02:24:39 +00:00
|
|
|
LINKAGE = -static
|
2001-12-07 19:28:25 +00:00
|
|
|
endif
|
|
|
|
LINK = $(CC) $(LINKAGE)
|
2002-11-20 06:40:08 +00:00
|
|
|
OBJPATH = $(topdir)/obj
|
|
|
|
BINPATH = $(OBJPATH)/$(BUILD)/bin
|
|
|
|
LIBPATH = $(OBJPATH)/$(BUILD)/lib
|
|
|
|
DEBUG_BINPATH = $(OBJPATH)/debug/bin
|
|
|
|
DEBUG_LIBPATH = $(OBJPATH)/debug/lib
|
|
|
|
RELEASE_BINPATH = $(OBJPATH)/release/bin
|
|
|
|
RELEASE_LIBPATH = $(OBJPATH)/release/lib
|
|
|
|
PROGRAM = $(BINPATH)/$(PROGRAM_NAME)
|
|
|
|
DEBUG_PROGRAM = $(DEBUG_BINPATH)/$(PROGRAM_NAME)
|
|
|
|
RELEASE_PROGRAM = $(RELEASE_BINPATH)/$(PROGRAM_NAME)
|
2001-06-29 02:54:59 +00:00
|
|
|
|
|
|
|
debug : CFLAGS = -g -O0 -DDEBUG $(DEBUG_CFLAGS) -Wall -W -DVERSION=$(VERSION) $(DEFINES) $(INCLUDES)
|
2001-07-20 23:44:35 +00:00
|
|
|
release : CFLAGS = -O3 -fomit-frame-pointer -funroll-loops -finline-functions -DNDEBUG $(RELEASE_CFLAGS) -Wall -W -Winline -DFLaC__INLINE=__inline__ -DVERSION=$(VERSION) $(DEFINES) $(INCLUDES)
|
2000-12-10 04:09:52 +00:00
|
|
|
|
|
|
|
LFLAGS = -L$(LIBPATH)
|
|
|
|
|
2002-11-20 06:40:08 +00:00
|
|
|
#@@@ OBJS = $(SRCS_C:%.c=%.o) $(SRCS_CC:%.cc=%.o) $(SRCS_CPP:%.cpp=%.o) $(SRCS_NASM:%.nasm=%.o)
|
|
|
|
#@@@ OBJS = $(SRCS_C:%.c=%.$(BUILD).o) $(SRCS_CC:%.cc=%.$(BUILD).o) $(SRCS_CPP:%.cpp=%.$(BUILD).o) $(SRCS_NASM:%.nasm=%.$(BUILD).o)
|
|
|
|
DEBUG_OBJS = $(SRCS_C:%.c=%.debug.o) $(SRCS_CC:%.cc=%.debug.o) $(SRCS_CPP:%.cpp=%.debug.o) $(SRCS_NASM:%.nasm=%.debug.o)
|
|
|
|
RELEASE_OBJS = $(SRCS_C:%.c=%.release.o) $(SRCS_CC:%.cc=%.release.o) $(SRCS_CPP:%.cpp=%.release.o) $(SRCS_NASM:%.nasm=%.release.o)
|
|
|
|
|
|
|
|
debug : $(ORDINALS_H) $(DEBUG_PROGRAM)
|
|
|
|
release : $(ORDINALS_H) $(RELEASE_PROGRAM)
|
|
|
|
|
|
|
|
$(DEBUG_PROGRAM) : $(DEBUG_OBJS)
|
|
|
|
$(LINK) -o $@ $(DEBUG_OBJS) $(LFLAGS) $(LIBS)
|
2000-12-10 04:09:52 +00:00
|
|
|
|
2002-11-20 06:40:08 +00:00
|
|
|
$(RELEASE_PROGRAM) : $(RELEASE_OBJS)
|
|
|
|
$(LINK) -o $@ $(RELEASE_OBJS) $(LFLAGS) $(LIBS)
|
2000-12-10 04:09:52 +00:00
|
|
|
|
2002-11-20 06:40:08 +00:00
|
|
|
%.debug.o %.release.o : %.c
|
2000-12-10 04:09:52 +00:00
|
|
|
$(CC) $(CFLAGS) -c $< -o $@
|
2002-11-20 06:40:08 +00:00
|
|
|
%.debug.o %.release.o : %.cc
|
2002-05-17 06:08:44 +00:00
|
|
|
$(CCC) $(CFLAGS) -c $< -o $@
|
2002-11-20 06:40:08 +00:00
|
|
|
%.debug.o %.release.o : %.cpp
|
2002-10-16 22:33:56 +00:00
|
|
|
$(CCC) $(CFLAGS) -c $< -o $@
|
2002-11-20 06:40:08 +00:00
|
|
|
%.debug.i %.release.i : %.c
|
2000-12-10 04:09:52 +00:00
|
|
|
$(CC) $(CFLAGS) -E $< -o $@
|
2002-11-20 06:40:08 +00:00
|
|
|
%.debug.i %.release.i : %.cc
|
2002-05-17 06:08:44 +00:00
|
|
|
$(CCC) $(CFLAGS) -E $< -o $@
|
2002-11-20 06:40:08 +00:00
|
|
|
%.debug.i %.release.i : %.cpp
|
2002-10-16 22:33:56 +00:00
|
|
|
$(CCC) $(CFLAGS) -E $< -o $@
|
2000-12-10 04:09:52 +00:00
|
|
|
|
2002-11-20 06:40:08 +00:00
|
|
|
%.debug.o %.release.o : %.nasm
|
2001-06-19 06:48:21 +00:00
|
|
|
$(NASM) -f elf -d OBJ_FORMAT_elf -i ia32/ $< -o $@
|
2001-05-03 02:24:39 +00:00
|
|
|
|
2000-12-10 04:09:52 +00:00
|
|
|
.PHONY : clean
|
|
|
|
clean :
|
2002-11-21 09:09:03 +00:00
|
|
|
-rm -f $(DEBUG_OBJS) $(RELEASE_OBJS) $(OBJPATH)/*/bin/$(PROGRAM_NAME)
|
2000-12-10 04:09:52 +00:00
|
|
|
|
|
|
|
.PHONY : depend
|
|
|
|
depend:
|
2002-10-16 22:33:56 +00:00
|
|
|
makedepend -fMakefile.lite -- $(CFLAGS) $(INCLUDES) -- *.c *.cc *.cpp
|