add support for Darwin builds

This commit is contained in:
Josh Coalson 2001-12-07 19:28:25 +00:00
parent 04180befd4
commit 6e14490030
4 changed files with 49 additions and 10 deletions

View File

@ -19,11 +19,19 @@
# GNU makefile fragment for building an executable
#
ifeq ($(DARWIN_BUILD),yes)
CC = cc
else
CC = gcc
endif
NASM = nasm
# LINKAGE can be forced to -static or -dynamic from invocation if desired, but it defaults to -static
# 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
LINKAGE = -static
LINK = gcc $(LINKAGE)
endif
LINK = $(CC) $(LINKAGE)
BINPATH = ../../obj/bin
LIBPATH = ../../obj/lib
PROGRAM = $(BINPATH)/$(PROGRAM_NAME)

View File

@ -19,13 +19,27 @@
# GNU makefile fragment for building a library
#
ifeq ($(DARWIN_BUILD),yes)
CC = cc
else
CC = gcc
endif
NASM = nasm
LINK = ar cru
ifeq ($(DARWIN_BUILD),yes)
LINKD = $(CC) -dynamiclib -flat_namespace -undefined suppress -install_name ../../obj/lib/libFLAC.dylib
#LINKD = $(CC) -dynamiclib -flat_namespace -undefined suppress -install_name ../../obj/lib/libFLAC.1.dylib -compatibility_version 3 -current_version 3.1
else
LINKD = ld -G
endif
LIBPATH = ../../obj/lib
STATIC_LIB = $(LIBPATH)/$(LIB_NAME).a
ifeq ($(DARWIN_BUILD),yes)
DYNAMIC_LIB = $(LIBPATH)/$(LIB_NAME).dylib
#DYNAMIC_LIB = $(LIBPATH)/$(LIB_NAME).1.1.1.dylib
else
DYNAMIC_LIB = $(LIBPATH)/$(LIB_NAME).so
endif
all : release
@ -40,10 +54,14 @@ debug : $(ORDINALS_H) $(STATIC_LIB) $(DYNAMIC_LIB)
release : $(ORDINALS_H) $(STATIC_LIB) $(DYNAMIC_LIB)
$(STATIC_LIB) : $(OBJS)
$(LINK) $@ $(OBJS)
$(LINK) $@ $(OBJS) && ranlib $@
$(DYNAMIC_LIB) : $(OBJS)
ifeq ($(DARWIN_BUILD),yes)
$(LINKD) -o $@ $(OBJS) $(LFLAGS) $(LIBS) -lc
else
$(LINKD) -o $@ $(OBJS) $(LFLAGS) $(LIBS)
endif
%.o : %.c
$(CC) $(CFLAGS) -c $< -o $@

View File

@ -20,10 +20,14 @@
#
PROGRAM_NAME = flac
#@@@OGG
ifeq ($(DARWIN_BUILD),yes)
INCLUDES = -I./include -I../../include
LIBS = -lFLAC -lc -lm
else
#@@@ TODO: conditionalize ogg includes, defines, and -logg
INCLUDES = -I./include -I../../include -I$(HOME)/local/include -DFLAC__HAS_OGG
#@@@OGG conditionalize -logg
LIBS = -lFLAC -lm -L$(HOME)/local/lib -logg
endif
OBJS = \
analyze.o \

View File

@ -21,11 +21,23 @@
#
LIB_NAME = libFLAC
ifeq ($(DARWIN_BUILD),yes)
DEFINES = -DFLAC__NO_NASM -DFLAC__ALIGN_MALLOC_DATA
else
DEFINES = -DFLAC__CPU_IA32 -DFLAC__HAS_NASM -DFLAC__ALIGN_MALLOC_DATA
endif
INCLUDES = -I./include -I../../include
DEBUG_CFLAGS = -DFLAC__OVERFLOW_DETECT
OBJS = \
ifeq ($(DARWIN_BUILD),yes)
else
ASM_OBJS = \
ia32/cpu_asm.o \
ia32/fixed_asm.o \
ia32/lpc_asm.o
endif
OBJS = $(ASM_OBJS) \
bitbuffer.o \
bitmath.o \
cpu.o \
@ -41,10 +53,7 @@ OBJS = \
stream_decoder.o \
stream_encoder.o \
stream_encoder_framing.o \
utility.o \
ia32/cpu_asm.o \
ia32/fixed_asm.o \
ia32/lpc_asm.o
utility.o
include ../../build/lib.mk