# FLAC - Free Lossless Audio Codec
-# Copyright (C) 2001,2002,2003,2004,2005,2006,2007,2008 Josh Coalson
+# Copyright (C) 2001,2002,2003,2004,2005,2006,2007,2008,2009 Josh Coalson
#
# This file is part the FLAC project. FLAC is comprised of several
# components distributed under difference licenses. The codec libraries
include $(topdir)/build/config.mk
-ifeq ($(DARWIN_BUILD),yes)
-CC = cc
-CCC = c++
+ifeq ($(OS),Darwin)
+ CC = cc
+ CCC = c++
else
-CC = gcc
-CCC = g++
+ CC = gcc
+ CCC = g++
endif
NASM = nasm
LINK = $(CC) $(LINKAGE)
-OBJPATH = $(topdir)/obj
+OBJPATH = $(topdir)/objs
BINPATH = $(OBJPATH)/$(BUILD)/bin
LIBPATH = $(OBJPATH)/$(BUILD)/lib
DEBUG_BINPATH = $(OBJPATH)/debug/bin
LFLAGS = -L$(LIBPATH)
-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_OBJS = $(SRCS_C:%.c=%.debug.o) $(SRCS_CC:%.cc=%.debug.o) $(SRCS_CPP:%.cpp=%.debug.o) $(SRCS_NASM:%.nasm=%.debug.o) $(SRCS_S:%.s=%.debug.o)
+RELEASE_OBJS = $(SRCS_C:%.c=%.release.o) $(SRCS_CC:%.cc=%.release.o) $(SRCS_CPP:%.cpp=%.release.o) $(SRCS_NASM:%.nasm=%.release.o) $(SRCS_S:%.s=%.release.o)
+ifeq ($(PROC),x86_64)
+DEBUG_PIC_OBJS = $(SRCS_C:%.c=%.debug.pic.o) $(SRCS_CC:%.cc=%.debug.pic.o) $(SRCS_CPP:%.cpp=%.debug.pic.o) $(SRCS_NASM:%.nasm=%.debug.pic.o) $(SRCS_S:%.s=%.debug.pic.o)
+RELEASE_PIC_OBJS = $(SRCS_C:%.c=%.release.pic.o) $(SRCS_CC:%.cc=%.release.pic.o) $(SRCS_CPP:%.cpp=%.release.pic.o) $(SRCS_NASM:%.nasm=%.release.pic.o) $(SRCS_S:%.s=%.release.pic.o)
+endif
debug : $(DEBUG_PROGRAM)
valgrind: $(DEBUG_PROGRAM)
# by default on OS X we link with static libs as much as possible
-$(DEBUG_PROGRAM) : $(DEBUG_OBJS)
-ifeq ($(DARWIN_BUILD),yes)
+$(DEBUG_PROGRAM) : $(DEBUG_OBJS) $(DEBUG_PIC_OBJS)
+ifeq ($(OS),Darwin)
$(LINK) -o $@ $(DEBUG_OBJS) $(EXPLICIT_LIBS)
else
$(LINK) -o $@ $(DEBUG_OBJS) $(LFLAGS) $(LIBS)
endif
-$(RELEASE_PROGRAM) : $(RELEASE_OBJS)
-ifeq ($(DARWIN_BUILD),yes)
+$(RELEASE_PROGRAM) : $(RELEASE_OBJS) $(RELEASE_PIC_OBJS)
+ifeq ($(OS),Darwin)
$(LINK) -o $@ $(RELEASE_OBJS) $(EXPLICIT_LIBS)
else
$(LINK) -o $@ $(RELEASE_OBJS) $(LFLAGS) $(LIBS)
endif
-%.debug.o %.release.o : %.c
- $(CC) $(CFLAGS) -c $< -o $@
-%.debug.o %.release.o : %.cc
- $(CCC) $(CFLAGS) -c $< -o $@
-%.debug.o %.release.o : %.cpp
- $(CCC) $(CFLAGS) -c $< -o $@
-%.debug.i %.release.i : %.c
- $(CC) $(CFLAGS) -E $< -o $@
-%.debug.i %.release.i : %.cc
- $(CCC) $(CFLAGS) -E $< -o $@
-%.debug.i %.release.i : %.cpp
- $(CCC) $(CFLAGS) -E $< -o $@
-
-%.debug.o : %.nasm
- $(NASM) -f elf -d OBJ_FORMAT_elf -i ia32/ -g $< -o $@
-%.release.o : %.nasm
- $(NASM) -f elf -d OBJ_FORMAT_elf -i ia32/ $< -o $@
+include $(topdir)/build/compile.mk
.PHONY : clean
clean :
- -rm -f $(DEBUG_OBJS) $(RELEASE_OBJS) $(OBJPATH)/*/bin/$(PROGRAM_NAME)
+ -rm -f $(DEBUG_OBJS) $(RELEASE_OBJS) $(DEBUG_PIC_OBJS) $(RELEASE_PIC_OBJS) $(OBJPATH)/*/bin/$(PROGRAM_NAME)
.PHONY : depend
depend: