Commit 2757af6c authored by Josh Coalson's avatar Josh Coalson
Browse files

get Makefile.lite system (with asm) working on Darwin, better handling of libogg paths and linkage

parent 4f4d9675
......@@ -25,9 +25,14 @@ debug : BUILD = debug
valgrind : BUILD = debug
release : BUILD = release
# override LINKAGE on OS X until we figure out how to get 'cc -static' to work
ifeq ($(DARWIN_BUILD),yes)
LINKAGE =
else
debug : LINKAGE = -static
valgrind : LINKAGE = -dynamic
release : LINKAGE = -static
endif
all default: $(DEFAULT_BUILD)
......@@ -37,4 +42,7 @@ all default: $(DEFAULT_BUILD)
VERSION=\"1.1.1\"
CONFIG_CFLAGS=-D_GNU_SOURCE -DHAVE_INTTYPES_H -DHAVE_WCSDUP -DHAVE_WCSCASECMP
CONFIG_CFLAGS=-D_GNU_SOURCE -DHAVE_INTTYPES_H -DHAVE_WCSDUP -DHAVE_WCSCASECMP -DFLAC__HAS_OGG
OGG_INCLUDE_DIR=$(HOME)/local.ogg/include
OGG_LIB_DIR=$(HOME)/local.ogg/lib
......@@ -29,10 +29,6 @@ CC = gcc
CCC = g++
endif
NASM = nasm
# override to -dynamic on OSX
ifeq ($(DARWIN_BUILD),yes)
LINKAGE = -dynamic
endif
LINK = $(CC) $(LINKAGE)
OBJPATH = $(topdir)/obj
BINPATH = $(OBJPATH)/$(BUILD)/bin
......@@ -58,11 +54,21 @@ debug : $(ORDINALS_H) $(DEBUG_PROGRAM)
valgrind: $(ORDINALS_H) $(DEBUG_PROGRAM)
release : $(ORDINALS_H) $(RELEASE_PROGRAM)
# by default on OS X we link with static libs as much as possible
$(DEBUG_PROGRAM) : $(DEBUG_OBJS)
ifeq ($(DARWIN_BUILD),yes)
$(LINK) -o $@ $(DEBUG_OBJS) $(EXPLICIT_LIBS)
else
$(LINK) -o $@ $(DEBUG_OBJS) $(LFLAGS) $(LIBS)
endif
$(RELEASE_PROGRAM) : $(RELEASE_OBJS)
ifeq ($(DARWIN_BUILD),yes)
$(LINK) -o $@ $(RELEASE_OBJS) $(EXPLICIT_LIBS)
else
$(LINK) -o $@ $(RELEASE_OBJS) $(LFLAGS) $(LIBS)
endif
%.debug.o %.release.o : %.c
$(CC) $(CFLAGS) -c $< -o $@
......
......@@ -28,6 +28,7 @@ else
CC = gcc
CCC = g++
endif
AS = as
NASM = nasm
LINK = ar cru
OBJPATH = $(topdir)/obj
......@@ -61,8 +62,8 @@ release : CFLAGS = -O3 -fomit-frame-pointer -funroll-loops -finline-functions -D
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)
debug : $(ORDINALS_H) $(DEBUG_STATIC_LIB) $(DEBUG_DYNAMIC_LIB)
valgrind: $(ORDINALS_H) $(DEBUG_STATIC_LIB) $(DEBUG_DYNAMIC_LIB)
......@@ -76,7 +77,7 @@ $(RELEASE_STATIC_LIB): $(RELEASE_OBJS)
$(DEBUG_DYNAMIC_LIB) : $(DEBUG_OBJS)
ifeq ($(DARWIN_BUILD),yes)
$(LINKD) -o $@ $(DEBUG_OBJS) $(LFLAGS) $(LIBS) -lc
echo Not building dynamic lib, command is: $(LINKD) -o $@ $(DEBUG_OBJS) $(LFLAGS) $(LIBS) -lc
else
$(LINKD) -o $@ $(DEBUG_OBJS) $(LFLAGS) $(LIBS)
endif
......@@ -101,6 +102,14 @@ endif
%.debug.i %.release.i : %.cpp
$(CCC) $(CFLAGS) -E $< -o $@
%.debug.o %.release.o : %.s
ifeq ($(DARWIN_BUILD),yes)
#$(CC) -c -arch ppc -Wall -force_cpusubtype_ALL $< -o $@
$(AS) -arch ppc -force_cpusubtype_ALL $< -o $@
else
$(AS) $< -o $@
endif
%.debug.o %.release.o : %.nasm
$(NASM) -f elf -d OBJ_FORMAT_elf -i ia32/ $< -o $@
......
......@@ -20,21 +20,16 @@
#
topdir = ../..
libdir = $(topdir)/obj/$(BUILD)/lib
PROGRAM_NAME = flac
INCLUDES = -I./include -I$(topdir)/include -I$(OGG_INCLUDE_DIR)
ifeq ($(DARWIN_BUILD),yes)
INCLUDES = -I./include -I$(topdir)/include
LIBS = -lgrabbag -lFLAC -lreplaygain_analysis -lreplaygain_synthesis -lgetopt -lutf8 -lc -lm
EXPLICIT_LIBS = $(libdir)/libgrabbag.a $(libdir)/libOggFLAC.a $(libdir)/libFLAC.a $(libdir)/libreplaygain_analysis.a $(libdir)/libreplaygain_synthesis.a $(libdir)/libgetopt.a $(libdir)/libutf8.a $(OGG_LIB_DIR)/libogg.a -lm
else
#@@@ TODO: conditionalize ogg includes, defines, and -logg
ifeq ($(SOLARIS_BUILD),yes)
INCLUDES = -I./include -I$(topdir)/include -I$(HOME)/local/include -DFLAC__HAS_OGG
LIBS = -lgrabbag -lOggFLAC -lFLAC -lreplaygain_analysis -lreplaygain_synthesis -lgetopt -lutf8 -lm -L$(HOME)/local/lib -logg
else
#@@@ TODO: conditionalize ogg includes, defines, and -logg
INCLUDES = -I./include -I$(topdir)/include -I$(HOME)/local/include -DFLAC__HAS_OGG
LIBS = -lgrabbag -lOggFLAC -lFLAC -lreplaygain_analysis -lreplaygain_synthesis -lgetopt -lutf8 -lm -L$(HOME)/local/lib -logg
endif
LIBS = -lgrabbag -lOggFLAC -lFLAC -lreplaygain_analysis -lreplaygain_synthesis -lgetopt -lutf8 -lm -L$(OGG_LIB_DIR) -logg
endif
SRCS_C = \
......
......@@ -36,7 +36,7 @@ topdir = ../..
LIB_NAME = libFLAC
ifeq ($(DARWIN_BUILD),yes)
DEFINES = -DFLAC__NO_NASM -DFLAC__ALIGN_MALLOC_DATA
DEFINES = -DFLAC__CPU_PPC -DFLAC__USE_ALTIVEC -DFLAC__ALIGN_MALLOC_DATA
else
ifeq ($(SOLARIS_BUILD),yes)
DEFINES = -DFLAC__NO_NASM -DFLAC__ALIGN_MALLOC_DATA
......@@ -48,6 +48,8 @@ INCLUDES = -I./include -I$(topdir)/include
DEBUG_CFLAGS = -DFLAC__OVERFLOW_DETECT
ifeq ($(DARWIN_BUILD),yes)
SRCS_S = \
ppc/lpc_asm.s
else
ifeq ($(SOLARIS_BUILD),yes)
else
......
......@@ -44,7 +44,7 @@ else
DEFINES =
endif
endif
INCLUDES = -I./include -I$(topdir)/include -I$(HOME)/local/include
INCLUDES = -I./include -I$(topdir)/include -I$(OGG_INCLUDE_DIR)
DEBUG_CFLAGS =
SRCS_C = \
......
......@@ -20,10 +20,17 @@
#
topdir = ../..
libdir = $(topdir)/obj/$(BUILD)/lib
PROGRAM_NAME = metaflac
INCLUDES = -I./include -I$(topdir)/include
LIBS = -lgrabbag -lFLAC -lreplaygain_analysis -lgetopt -lutf8 -lm
INCLUDES = -I./include -I$(topdir)/include
ifeq ($(DARWIN_BUILD),yes)
EXPLICIT_LIBS = $(libdir)/libgrabbag.a $(libdir)/libFLAC.a $(libdir)/libreplaygain_analysis.a $(libdir)/libgetopt.a $(libdir)/libutf8.a -lm
else
LIBS = -lgrabbag -lFLAC -lreplaygain_analysis -lgetopt -lutf8 -lm
endif
SRCS_C = \
main.c \
......
......@@ -125,7 +125,7 @@
Also, when `ordering' is RETURN_IN_ORDER,
each non-option ARGV-element is returned here. */
char *share__optarg;
char *share__optarg = 0; /*[JEC] initialize to avoid being a 'Common' symbol */
/* Index in ARGV of the next element to be scanned.
This is used for communication to and from the caller
......@@ -146,7 +146,7 @@ int share__optind = 1;
causes problems with re-calling getopt as programs generally don't
know that. */
int share____getopt_initialized;
static int share____getopt_initialized = 0;
/* The next char to be scanned in the option-element
in which the last option character we returned was found.
......
......@@ -20,10 +20,18 @@
#
topdir = ../../..
libdir = $(topdir)/obj/$(BUILD)/lib
PROGRAM_NAME = test_cuesheet
INCLUDES = -I./include -I$(topdir)/include
LIBS = -lgrabbag -lreplaygain_analysis -lFLAC -lm
INCLUDES = -I./include -I$(topdir)/include
ifeq ($(DARWIN_BUILD),yes)
EXPLICIT_LIBS = $(libdir)/libgrabbag.a $(libdir)/libreplaygain_analysis.a $(libdir)/libFLAC.a -lm
else
LIBS = -lgrabbag -lreplaygain_analysis -lFLAC -lm
endif
SRCS_C = \
main.c
......
......@@ -20,10 +20,18 @@
#
topdir = ../..
libdir = $(topdir)/obj/$(BUILD)/lib
PROGRAM_NAME = test_libFLAC++
INCLUDES = -I$(topdir)/include
LIBS = -lgrabbag -lreplaygain_analysis -lFLAC++ -lFLAC -lm
INCLUDES = -I$(topdir)/include
ifeq ($(DARWIN_BUILD),yes)
EXPLICIT_LIBS = $(libdir)/libgrabbag.a $(libdir)/libreplaygain_analysis.a $(libdir)/libFLAC++.a $(libdir)/libFLAC.a -lm
else
LIBS = -lgrabbag -lreplaygain_analysis -lFLAC++ -lFLAC -lm
endif
SRCS_C = \
file_utils.c \
metadata_utils.c
......
......@@ -20,10 +20,18 @@
#
topdir = ../..
libdir = $(topdir)/obj/$(BUILD)/lib
PROGRAM_NAME = test_libFLAC
INCLUDES = -I../libFLAC/include -I$(topdir)/include
LIBS = -lgrabbag -lreplaygain_analysis -lFLAC -lm
INCLUDES = -I../libFLAC/include -I$(topdir)/include
ifeq ($(DARWIN_BUILD),yes)
EXPLICIT_LIBS = $(libdir)/libgrabbag.a $(libdir)/libreplaygain_analysis.a $(libdir)/libFLAC.a -lm
else
LIBS = -lgrabbag -lreplaygain_analysis -lFLAC -lm
endif
SRCS_C = \
bitbuffer.c \
decoders.c \
......
......@@ -20,11 +20,18 @@
#
topdir = ../..
libdir = $(topdir)/obj/$(BUILD)/lib
PROGRAM_NAME = test_libOggFLAC++
#@@@ TODO: conditionalize ogg lib path and -logg
INCLUDES = -I$(topdir)/include
LIBS = -lgrabbag -lreplaygain_analysis -lOggFLAC++ -lOggFLAC -lFLAC -L$(HOME)/local/lib -logg -lm
INCLUDES = -I$(topdir)/include
ifeq ($(DARWIN_BUILD),yes)
EXPLICIT_LIBS = $(libdir)/libgrabbag.a $(libdir)/libreplaygain_analysis.a $(libdir)/libOggFLAC++.a $(libdir)/libOggFLAC.a $(libdir)/libFLAC.a $(OGG_LIB_DIR)/libogg.a -lm
else
LIBS = -lgrabbag -lreplaygain_analysis -lOggFLAC++ -lOggFLAC -lFLAC -L$(OGG_LIB_DIR) -logg -lm
endif
SRCS_C = \
file_utils.c \
metadata_utils.c
......
......@@ -20,11 +20,18 @@
#
topdir = ../..
libdir = $(topdir)/obj/$(BUILD)/lib
PROGRAM_NAME = test_libOggFLAC
#@@@ TODO: conditionalize ogg lib path and -logg
INCLUDES = -I$(topdir)/include
LIBS = -lgrabbag -lreplaygain_analysis -lOggFLAC -lFLAC -L$(HOME)/local/lib -logg -lm
INCLUDES = -I$(topdir)/include
ifeq ($(DARWIN_BUILD),yes)
EXPLICIT_LIBS = $(libdir)/libgrabbag.a $(libdir)/libreplaygain_analysis.a $(libdir)/libOggFLAC.a $(libdir)/libFLAC.a $(OGG_LIB_DIR)/libogg.a -lm
else
LIBS = -lgrabbag -lreplaygain_analysis -lOggFLAC -lFLAC -L$(OGG_LIB_DIR) -logg -lm
endif
SRCS_C = \
decoders.c \
encoders.c \
......
......@@ -20,10 +20,18 @@
#
topdir = ../..
libdir = $(topdir)/obj/$(BUILD)/lib
PROGRAM_NAME = test_seeking
INCLUDES = -I../libFLAC/include -I$(topdir)/include
LIBS = -lOggFLAC -lFLAC -L$(HOME)/local/lib -logg -lm
INCLUDES = -I../libFLAC/include -I$(topdir)/include
ifeq ($(DARWIN_BUILD),yes)
EXPLICIT_LIBS = $(libdir)/libOggFLAC.a $(libdir)/libFLAC.a $(OGG_LIB_DIR)/libogg.a -lm
else
LIBS = -lOggFLAC -lFLAC -L$(OGG_LIB_DIR) -logg -lm
endif
SRCS_C = \
main.c
......
......@@ -20,10 +20,14 @@
#
topdir = ../..
libdir = $(topdir)/obj/$(BUILD)/lib
PROGRAM_NAME = test_streams
INCLUDES = -I./include -I$(topdir)/include
LIBS = -lm
INCLUDES = -I./include -I$(topdir)/include
LIBS = -lm
SRCS_C = \
main.c
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment