annotate src/opus-1.3/Makefile.mips @ 69:7aeed7906520

Add Opus sources and macOS builds
author Chris Cannam
date Wed, 23 Jan 2019 13:48:08 +0000
parents
children
rev   line source
Chris@69 1 #################### COMPILE OPTIONS #######################
Chris@69 2
Chris@69 3 # Uncomment this for fixed-point build
Chris@69 4 FIXED_POINT=1
Chris@69 5
Chris@69 6 # It is strongly recommended to uncomment one of these
Chris@69 7 # VAR_ARRAYS: Use C99 variable-length arrays for stack allocation
Chris@69 8 # USE_ALLOCA: Use alloca() for stack allocation
Chris@69 9 # If none is defined, then the fallback is a non-threadsafe global array
Chris@69 10 CFLAGS := -DUSE_ALLOCA $(CFLAGS)
Chris@69 11 #CFLAGS := -DVAR_ARRAYS $(CFLAGS)
Chris@69 12
Chris@69 13 # These options affect performance
Chris@69 14 # HAVE_LRINTF: Use C99 intrinsics to speed up float-to-int conversion
Chris@69 15 #CFLAGS := -DHAVE_LRINTF $(CFLAGS)
Chris@69 16
Chris@69 17 ###################### END OF OPTIONS ######################
Chris@69 18
Chris@69 19 -include package_version
Chris@69 20
Chris@69 21 include silk_sources.mk
Chris@69 22 include celt_sources.mk
Chris@69 23 include opus_sources.mk
Chris@69 24
Chris@69 25 ifdef FIXED_POINT
Chris@69 26 SILK_SOURCES += $(SILK_SOURCES_FIXED)
Chris@69 27 else
Chris@69 28 SILK_SOURCES += $(SILK_SOURCES_FLOAT)
Chris@69 29 OPUS_SOURCES += $(OPUS_SOURCES_FLOAT)
Chris@69 30 endif
Chris@69 31
Chris@69 32 EXESUFFIX =
Chris@69 33 LIBPREFIX = lib
Chris@69 34 LIBSUFFIX = .a
Chris@69 35 OBJSUFFIX = .o
Chris@69 36
Chris@69 37 CC = $(TOOLCHAIN_PREFIX)cc$(TOOLCHAIN_SUFFIX)
Chris@69 38 AR = $(TOOLCHAIN_PREFIX)ar
Chris@69 39 RANLIB = $(TOOLCHAIN_PREFIX)ranlib
Chris@69 40 CP = $(TOOLCHAIN_PREFIX)cp
Chris@69 41
Chris@69 42 cppflags-from-defines = $(addprefix -D,$(1))
Chris@69 43 cppflags-from-includes = $(addprefix -I,$(1))
Chris@69 44 ldflags-from-ldlibdirs = $(addprefix -L,$(1))
Chris@69 45 ldlibs-from-libs = $(addprefix -l,$(1))
Chris@69 46
Chris@69 47 WARNINGS = -Wall -W -Wstrict-prototypes -Wextra -Wcast-align -Wnested-externs -Wshadow
Chris@69 48
Chris@69 49 CFLAGS += -mips32r2 -mno-mips16 -std=gnu99 -O2 -g $(WARNINGS) -DENABLE_ASSERTIONS -DMIPSr1_ASM -DOPUS_BUILD -mdspr2 -march=74kc -mtune=74kc -mmt -mgp32
Chris@69 50
Chris@69 51 CINCLUDES = include silk celt
Chris@69 52
Chris@69 53 ifdef FIXED_POINT
Chris@69 54 CFLAGS += -DFIXED_POINT=1 -DDISABLE_FLOAT_API
Chris@69 55 CINCLUDES += silk/fixed
Chris@69 56 else
Chris@69 57 CINCLUDES += silk/float
Chris@69 58 endif
Chris@69 59
Chris@69 60
Chris@69 61 LIBS = m
Chris@69 62
Chris@69 63 LDLIBDIRS = ./
Chris@69 64
Chris@69 65 CFLAGS += $(call cppflags-from-defines,$(CDEFINES))
Chris@69 66 CFLAGS += $(call cppflags-from-includes,$(CINCLUDES))
Chris@69 67 LDFLAGS += $(call ldflags-from-ldlibdirs,$(LDLIBDIRS))
Chris@69 68 LDLIBS += $(call ldlibs-from-libs,$(LIBS))
Chris@69 69
Chris@69 70 COMPILE.c.cmdline = $(CC) -c $(CFLAGS) -o $@ $<
Chris@69 71 LINK.o = $(CC) $(LDPREFLAGS) $(LDFLAGS)
Chris@69 72 LINK.o.cmdline = $(LINK.o) $^ $(LDLIBS) -o $@$(EXESUFFIX)
Chris@69 73
Chris@69 74 ARCHIVE.cmdline = $(AR) $(ARFLAGS) $@ $^ && $(RANLIB) $@
Chris@69 75
Chris@69 76 %$(OBJSUFFIX):%.c
Chris@69 77 $(COMPILE.c.cmdline)
Chris@69 78
Chris@69 79 %$(OBJSUFFIX):%.cpp
Chris@69 80 $(COMPILE.cpp.cmdline)
Chris@69 81
Chris@69 82 # Directives
Chris@69 83
Chris@69 84
Chris@69 85 # Variable definitions
Chris@69 86 LIB_NAME = opus
Chris@69 87 TARGET = $(LIBPREFIX)$(LIB_NAME)$(LIBSUFFIX)
Chris@69 88
Chris@69 89 SRCS_C = $(SILK_SOURCES) $(CELT_SOURCES) $(OPUS_SOURCES)
Chris@69 90
Chris@69 91 OBJS := $(patsubst %.c,%$(OBJSUFFIX),$(SRCS_C))
Chris@69 92
Chris@69 93 OPUSDEMO_SRCS_C = src/opus_demo.c
Chris@69 94 OPUSDEMO_OBJS := $(patsubst %.c,%$(OBJSUFFIX),$(OPUSDEMO_SRCS_C))
Chris@69 95
Chris@69 96 TESTOPUSAPI_SRCS_C = tests/test_opus_api.c
Chris@69 97 TESTOPUSAPI_OBJS := $(patsubst %.c,%$(OBJSUFFIX),$(TESTOPUSAPI_SRCS_C))
Chris@69 98
Chris@69 99 TESTOPUSDECODE_SRCS_C = tests/test_opus_decode.c
Chris@69 100 TESTOPUSDECODE_OBJS := $(patsubst %.c,%$(OBJSUFFIX),$(TESTOPUSDECODE_SRCS_C))
Chris@69 101
Chris@69 102 TESTOPUSENCODE_SRCS_C = tests/test_opus_encode.c tests/opus_encode_regressions.c
Chris@69 103 TESTOPUSENCODE_OBJS := $(patsubst %.c,%$(OBJSUFFIX),$(TESTOPUSENCODE_SRCS_C))
Chris@69 104
Chris@69 105 TESTOPUSPADDING_SRCS_C = tests/test_opus_padding.c
Chris@69 106 TESTOPUSPADDING_OBJS := $(patsubst %.c,%$(OBJSUFFIX),$(TESTOPUSPADDING_SRCS_C))
Chris@69 107
Chris@69 108 OPUSCOMPARE_SRCS_C = src/opus_compare.c
Chris@69 109 OPUSCOMPARE_OBJS := $(patsubst %.c,%$(OBJSUFFIX),$(OPUSCOMPARE_SRCS_C))
Chris@69 110
Chris@69 111 TESTS := test_opus_api test_opus_decode test_opus_encode test_opus_padding
Chris@69 112
Chris@69 113 # Rules
Chris@69 114 all: lib opus_demo opus_compare $(TESTS)
Chris@69 115
Chris@69 116 lib: $(TARGET)
Chris@69 117
Chris@69 118 check: all
Chris@69 119 for test in $(TESTS); do ./$$test; done
Chris@69 120
Chris@69 121 $(TARGET): $(OBJS)
Chris@69 122 $(ARCHIVE.cmdline)
Chris@69 123
Chris@69 124 opus_demo$(EXESUFFIX): $(OPUSDEMO_OBJS) $(TARGET)
Chris@69 125 $(LINK.o.cmdline)
Chris@69 126
Chris@69 127 test_opus_api$(EXESUFFIX): $(TESTOPUSAPI_OBJS) $(TARGET)
Chris@69 128 $(LINK.o.cmdline)
Chris@69 129
Chris@69 130 test_opus_decode$(EXESUFFIX): $(TESTOPUSDECODE_OBJS) $(TARGET)
Chris@69 131 $(LINK.o.cmdline)
Chris@69 132
Chris@69 133 test_opus_encode$(EXESUFFIX): $(TESTOPUSENCODE_OBJS) $(TARGET)
Chris@69 134 $(LINK.o.cmdline)
Chris@69 135
Chris@69 136 test_opus_padding$(EXESUFFIX): $(TESTOPUSPADDING_OBJS) $(TARGET)
Chris@69 137 $(LINK.o.cmdline)
Chris@69 138
Chris@69 139 opus_compare$(EXESUFFIX): $(OPUSCOMPARE_OBJS)
Chris@69 140 $(LINK.o.cmdline)
Chris@69 141
Chris@69 142 celt/celt.o: CFLAGS += -DPACKAGE_VERSION='$(PACKAGE_VERSION)'
Chris@69 143 celt/celt.o: package_version
Chris@69 144
Chris@69 145 package_version: force
Chris@69 146 @if [ -x ./update_version ]; then \
Chris@69 147 ./update_version || true; \
Chris@69 148 elif [ ! -e ./package_version ]; then \
Chris@69 149 echo 'PACKAGE_VERSION="unknown"' > ./package_version; \
Chris@69 150 fi
Chris@69 151
Chris@69 152 force:
Chris@69 153
Chris@69 154 clean:
Chris@69 155 rm -f opus_demo$(EXESUFFIX) opus_compare$(EXESUFFIX) $(TARGET) \
Chris@69 156 test_opus_api$(EXESUFFIX) test_opus_decode$(EXESUFFIX) \
Chris@69 157 test_opus_encode$(EXESUFFIX) test_opus_padding$(EXESUFFIX) \
Chris@69 158 $(OBJS) $(OPUSDEMO_OBJS) $(OPUSCOMPARE_OBJS) $(TESTOPUSAPI_OBJS) \
Chris@69 159 $(TESTOPUSDECODE_OBJS) $(TESTOPUSENCODE_OBJS) $(TESTOPUSPADDING_OBJS)
Chris@69 160
Chris@69 161 .PHONY: all lib clean force check