annotate src/opusfile-0.9/unix/Makefile @ 79:91c729825bca pa_catalina

Update build for AUDIO_COMPONENT_FIX
author Chris Cannam
date Wed, 30 Oct 2019 12:40:34 +0000
parents 7aeed7906520
children
rev   line source
Chris@69 1 # NOTE: This Makefile requires GNU make
Chris@69 2 # Location to put the targets.
Chris@69 3 TARGETBINDIR = .
Chris@69 4 TESTBINDIR = tests
Chris@69 5 TARGETLIBDIR = .
Chris@69 6 # Name of the targets
Chris@69 7 LIBOPUSFILE_TARGET = libopusfile.a
Chris@69 8 LIBOPUSURL_TARGET = libopusurl.a
Chris@69 9 OPUSFILE_EXAMPLE_TARGET = opusfile_example
Chris@69 10 SEEKING_EXAMPLE_TARGET = seeking_example
Chris@69 11 # Test targets
Chris@69 12 #TODO: tests
Chris@69 13 FOO_TARGET = foo
Chris@69 14 # The command to use to generate dependency information
Chris@69 15 MAKEDEPEND = ${CC} -MM
Chris@69 16 #MAKEDEPEND = makedepend -f- -Y --
Chris@69 17 # Optional features to enable
Chris@69 18 #CFLAGS := $(CFLAGS) -DOP_HAVE_LRINTF
Chris@69 19 CFLAGS := $(CFLAGS) -DOP_ENABLE_HTTP
Chris@69 20 # Extra compilation flags.
Chris@69 21 # You may get speed increases by including flags such as -O2 or -O3 or
Chris@69 22 # -ffast-math, or additional flags, depending on your system and compiler.
Chris@69 23 # The -g flag will generally include debugging information.
Chris@69 24 CFLAGS := -g $(CFLAGS)
Chris@69 25 CFLAGS := -DOP_ENABLE_ASSERTIONS $(CFLAGS)
Chris@69 26 # These are gcc-only, but not actually critical.
Chris@69 27 CFLAGS := -fPIC $(CFLAGS)
Chris@69 28 CFLAGS := -std=c89 -pedantic $(CFLAGS)
Chris@69 29 CFLAGS := -fvisibility=hidden $(CFLAGS)
Chris@69 30 CFLAGS := -Wextra -Wno-parentheses -Wno-long-long $(CFLAGS)
Chris@69 31 CFLAGS := -Wall $(CFLAGS)
Chris@69 32 # The list of pkg-config packages we depend on.
Chris@69 33 PACKAGES := ogg opus
Chris@69 34 ifeq ($(findstring -DOP_ENABLE_HTTP,${CFLAGS}),-DOP_ENABLE_HTTP)
Chris@69 35 PACKAGES += openssl
Chris@69 36 endif
Chris@69 37 # The location of include files.
Chris@69 38 # Modify these to point to your Ogg and Opus include directories if they are
Chris@69 39 # not installed in a standard location.
Chris@69 40 CINCLUDE := `pkg-config --cflags ${PACKAGES}`
Chris@69 41
Chris@69 42 # Libraries to link with, and the location of library files.
Chris@69 43 LIBS := `pkg-config --libs ${PACKAGES}`
Chris@69 44 ifeq ($(findstring -DOP_HAVE_LRINTF,${CFLAGS}),-DOP_HAVE_LRINTF)
Chris@69 45 LIBS := -lm $(LIBS)
Chris@69 46 endif
Chris@69 47
Chris@69 48 # Extras for the MS target
Chris@69 49 ifneq ($(findstring mingw,${CC}),)
Chris@69 50 LIBS += -lwsock32 -lws2_32 -lgdi32 -lcrypt32
Chris@69 51 EXEEXT := .exe
Chris@69 52 endif
Chris@69 53
Chris@69 54 RANLIB ?= ranlib
Chris@69 55
Chris@69 56 #TODO: tests
Chris@69 57 FOO_LIBS =
Chris@69 58
Chris@69 59 # ANYTHING BELOW THIS LINE PROBABLY DOES NOT NEED EDITING
Chris@69 60 CINCLUDE := -I../include ${CINCLUDE}
Chris@69 61 LIBSRCDIR = ../src
Chris@69 62 BINSRCDIR = ../examples
Chris@69 63 TESTSRCDIR = ${LIBSRCDIR}
Chris@69 64 WORKDIR = objs
Chris@69 65
Chris@69 66 # C source file lists
Chris@69 67 LIBOPUSFILE_CSOURCES = \
Chris@69 68 http.c \
Chris@69 69 info.c \
Chris@69 70 internal.c \
Chris@69 71 opusfile.c \
Chris@69 72 stream.c \
Chris@69 73
Chris@69 74 LIBOPUSFILE_CHEADERS = \
Chris@69 75 internal.h \
Chris@69 76
Chris@69 77 LIBOPUSURL_CSOURCES = \
Chris@69 78 internal.c \
Chris@69 79 http.c \
Chris@69 80
Chris@69 81 ifneq ($(findstring mingw,${CC}),)
Chris@69 82 LIBOPUSURL_CSOURCES += wincerts.c
Chris@69 83 endif
Chris@69 84
Chris@69 85 LIBOPUSURL_CHEADERS = \
Chris@69 86 internal.h \
Chris@69 87
Chris@69 88 OPUSFILE_EXAMPLE_CSOURCES = opusfile_example.c
Chris@69 89
Chris@69 90 SEEKING_EXAMPLE_CSOURCES = seeking_example.c
Chris@69 91
Chris@69 92 ifneq ($(findstring mingw,${CC}),)
Chris@69 93 OPUSFILE_EXAMPLE_CSOURCES += win32utf8.c
Chris@69 94 SEEKING_EXAMPLE_CSOURCES += win32utf8.c
Chris@69 95 endif
Chris@69 96
Chris@69 97 FOO_CSOURCES = tests/foo.c
Chris@69 98
Chris@69 99 # Create object file list.
Chris@69 100 LIBOPUSFILE_OBJS:= ${LIBOPUSFILE_CSOURCES:%.c=${WORKDIR}/%.o}
Chris@69 101 LIBOPUSFILE_ASMS:= ${LIBOPUSFILE_OBJS:%.o=%.s}
Chris@69 102 LIBOPUSFILE_DEPS:= ${LIBOPUSFILE_OBJS:%.o=%.d}
Chris@69 103 LIBOPUSURL_OBJS:= ${LIBOPUSURL_CSOURCES:%.c=${WORKDIR}/%.o}
Chris@69 104 LIBOPUSURL_ASMS:= ${LIBOPUSURL_OBJS:%.o=%.s}
Chris@69 105 LIBOPUSURL_DEPS:= ${LIBOPUSURL_OBJS:%.o=%.d}
Chris@69 106 OPUSFILE_EXAMPLE_OBJS:= ${OPUSFILE_EXAMPLE_CSOURCES:%.c=${WORKDIR}/%.o}
Chris@69 107 SEEKING_EXAMPLE_OBJS:= ${SEEKING_EXAMPLE_CSOURCES:%.c=${WORKDIR}/%.o}
Chris@69 108 #TODO: tests
Chris@69 109 FOO_OBJS:= ${FOO_CSOURCES:%.c=${WORKDIR}/%.o}
Chris@69 110 ALL_OBJS:= \
Chris@69 111 ${LIBOPUSFILE_OBJS} \
Chris@69 112 ${LIBOPUSURL_OBJS} \
Chris@69 113 ${OPUSFILE_EXAMPLE_OBJS} \
Chris@69 114 ${SEEKING_EXAMPLE_OBJS} \
Chris@69 115
Chris@69 116 #TODO: tests
Chris@69 117 # ${FOO_OBJS}
Chris@69 118
Chris@69 119 # Create the dependency file list
Chris@69 120 ALL_DEPS:= ${ALL_OBJS:%.o=%.d}
Chris@69 121 # Prepend source path to file names.
Chris@69 122 LIBOPUSFILE_CSOURCES:= ${LIBOPUSFILE_CSOURCES:%=${LIBSRCDIR}/%}
Chris@69 123 LIBOPUSFILE_CHEADERS:= ${LIBOPUSFILE_CHEADERS:%=${LIBSRCDIR}/%}
Chris@69 124 LIBOPUSURL_CSOURCES:= ${LIBOPUSURL_CSOURCES:%=${LIBSRCDIR}/%}
Chris@69 125 LIBOPUSURL_CHEADERS:= ${LIBOPUSURL_CHEADERS:%=${LIBSRCDIR}/%}
Chris@69 126 OPUSFILE_EXAMPLE_CSOURCES:= ${OPUSFILE_EXAMPLE_CSOURCES:%=${BINSRCDIR}/%}
Chris@69 127 SEEKING_EXAMPLE_CSOURCES:= ${SEEKING_EXAMPLE_CSOURCES:%=${BINSRCDIR}/%}
Chris@69 128 #TODO: tests
Chris@69 129 FOO_CSOURCES:= ${FOO_CSOURCES:%=${TESTSRCDIR}/%}
Chris@69 130 ALL_CSOURCES:= \
Chris@69 131 ${LIBOPUSFILE_CSOURCES} \
Chris@69 132 ${LIBOPUSURL_CSOURCES} \
Chris@69 133 ${OPUSFILE_EXAMPLE_CSOURCES} \
Chris@69 134 ${SEEKING_EXAMPLE_CSOURCES} \
Chris@69 135
Chris@69 136 #TODO: tests
Chris@69 137 # ${FOO_CSOURCES} \
Chris@69 138 # Prepand target path to file names.
Chris@69 139 LIBOPUSFILE_TARGET:= ${TARGETLIBDIR}/${LIBOPUSFILE_TARGET}
Chris@69 140 LIBOPUSURL_TARGET:= ${TARGETLIBDIR}/${LIBOPUSURL_TARGET}
Chris@69 141 OPUSFILE_EXAMPLE_TARGET:= ${TARGETBINDIR}/${OPUSFILE_EXAMPLE_TARGET}${EXEEXT}
Chris@69 142 SEEKING_EXAMPLE_TARGET:= ${TARGETBINDIR}/${SEEKING_EXAMPLE_TARGET}${EXEEXT}
Chris@69 143 # Prepend test path to file names.
Chris@69 144 #TODO: tests
Chris@69 145 FOO_TARGET:= ${TESTBINDIR}/${FOO_TARGET}
Chris@69 146 # Complete set of targets
Chris@69 147 ALL_TARGETS:= \
Chris@69 148 ${LIBOPUSFILE_TARGET} \
Chris@69 149 ${LIBOPUSURL_TARGET} \
Chris@69 150 ${OPUSFILE_EXAMPLE_TARGET} \
Chris@69 151 ${SEEKING_EXAMPLE_TARGET} \
Chris@69 152
Chris@69 153 #TODO: tests
Chris@69 154 # ${FOO_TARGET} \
Chris@69 155
Chris@69 156 # Targets:
Chris@69 157 # Everything (default)
Chris@69 158 all: ${ALL_TARGETS}
Chris@69 159
Chris@69 160 # libopusfile
Chris@69 161 ${LIBOPUSFILE_TARGET}: ${LIBOPUSFILE_OBJS}
Chris@69 162 mkdir -p ${TARGETLIBDIR}
Chris@69 163 $(AR) cqs $@ ${LIBOPUSFILE_OBJS}
Chris@69 164 -$(RANLIB) $@
Chris@69 165
Chris@69 166 # libopusurl
Chris@69 167 ${LIBOPUSURL_TARGET}: ${LIBOPUSURL_OBJS}
Chris@69 168 mkdir -p ${TARGETLIBDIR}
Chris@69 169 $(AR) cqs $@ ${LIBOPUSURL_OBJS}
Chris@69 170 -$(RANLIB) $@
Chris@69 171
Chris@69 172 # opusfile_example
Chris@69 173 ${OPUSFILE_EXAMPLE_TARGET}: ${OPUSFILE_EXAMPLE_OBJS} ${LIBOPUSFILE_TARGET} \
Chris@69 174 ${LIBOPUSURL_TARGET}
Chris@69 175 mkdir -p ${TARGETBINDIR}
Chris@69 176 ${CC} ${CFLAGS} ${OPUSFILE_EXAMPLE_OBJS} ${LIBOPUSFILE_TARGET} \
Chris@69 177 ${LIBOPUSURL_TARGET} ${LIBS} -o $@
Chris@69 178
Chris@69 179 # seeking_example
Chris@69 180 ${SEEKING_EXAMPLE_TARGET}: ${SEEKING_EXAMPLE_OBJS} ${LIBOPUSFILE_TARGET} \
Chris@69 181 ${LIBOPUSURL_TARGET}
Chris@69 182 mkdir -p ${TARGETBINDIR}
Chris@69 183 ${CC} ${CFLAGS} ${SEEKING_EXAMPLE_OBJS} ${LIBOPUSFILE_TARGET} \
Chris@69 184 ${LIBOPUSURL_TARGET} ${LIBS} -o $@
Chris@69 185
Chris@69 186 #TODO:
Chris@69 187 #tests: foo
Chris@69 188 #
Chris@69 189 #${FOO_TARGET}: ${FOO_OBJS}
Chris@69 190 # mkdir -p ${TESTBINDIR}
Chris@69 191 # ${CC} ${CFLAGS} ${FOO_OBJS} ${FOO_LIBS} -o $@
Chris@69 192 #
Chris@69 193 #tests-clean:
Chris@69 194 # -rmdir ${TESTBINDIR}
Chris@69 195
Chris@69 196 # Assembly listing
Chris@69 197 ALL_ASM := ${ALL_OBJS:%.o=%.s}
Chris@69 198 asm: ${ALL_ASM}
Chris@69 199
Chris@69 200 # Check that build is complete.
Chris@69 201 check: all
Chris@69 202
Chris@69 203 # Remove all targets.
Chris@69 204 clean:
Chris@69 205 ${RM} ${ALL_ASM} ${ALL_OBJS} ${ALL_DEPS}
Chris@69 206 ${RM} ${ALL_TARGETS}
Chris@69 207 -rmdir ${WORKDIR}
Chris@69 208
Chris@69 209 # Make everything depend on changes in the Makefile
Chris@69 210 # This vpath directive needs to be before any include statements
Chris@69 211 vpath Makefile $(dir $(lastword $(MAKEFILE_LIST)))
Chris@69 212 ${ALL_ASM} ${ALL_OBJS} ${ALL_DEPS} ${ALL_TARGETS} : Makefile
Chris@69 213
Chris@69 214 # Specify which targets are phony for GNU make
Chris@69 215 .PHONY : all clean check
Chris@69 216
Chris@69 217 # Rules
Chris@69 218 ${WORKDIR}/%.d: ${LIBSRCDIR}/%.c
Chris@69 219 mkdir -p ${dir $@}
Chris@69 220 ${MAKEDEPEND} ${CINCLUDE} ${CFLAGS} $< -MT ${@:%.d=%.o} > $@
Chris@69 221 ${MAKEDEPEND} ${CINCLUDE} ${CFLAGS} $< -MT ${@:%.d=%.s} >> $@
Chris@69 222 ${MAKEDEPEND} ${CINCLUDE} ${CFLAGS} $< -MT $@ >> $@
Chris@69 223 ${WORKDIR}/%.s: ${LIBSRCDIR}/%.c
Chris@69 224 mkdir -p ${dir $@}
Chris@69 225 ${CC} ${CINCLUDE} ${CFLAGS} -S -o $@ $<
Chris@69 226 ${WORKDIR}/%.o: ${LIBSRCDIR}/%.c
Chris@69 227 mkdir -p ${dir $@}
Chris@69 228 ${CC} ${CINCLUDE} ${CFLAGS} -c -o $@ $<
Chris@69 229
Chris@69 230 ${WORKDIR}/%.d : ${BINSRCDIR}/%.c
Chris@69 231 mkdir -p ${dir $@}
Chris@69 232 ${MAKEDEPEND} ${CINCLUDE} ${CFLAGS} $< -MT ${@:%.d=%.o} > $@
Chris@69 233 ${WORKDIR}/%.s : ${BINSRCDIR}/%.c ${WORKDIR}/%.o
Chris@69 234 mkdir -p ${dir $@}
Chris@69 235 ${CC} ${CINCLUDE} ${CFLAGS} -S -o $@ $<
Chris@69 236 ${WORKDIR}/%.o : ${BINSRCDIR}/%.c
Chris@69 237 mkdir -p ${dir $@}
Chris@69 238 ${CC} ${CINCLUDE} ${CFLAGS} -c -o $@ $<
Chris@69 239
Chris@69 240 # Include header file dependencies, except when cleaning
Chris@69 241 ifneq ($(MAKECMDGOALS),clean)
Chris@69 242 include ${ALL_DEPS}
Chris@69 243 endif