Makefile 7.7 KB
Newer Older
1 2
#
# libavcodec Makefile
3
# (c) 2000-2005 Fabrice Bellard
4
#
5 6
include ../config.mak

7 8
VPATH=$(SRC_PATH)/libavcodec

F
Fabrice Bellard 已提交
9
# NOTE: -I.. is needed to include config.h
10
CFLAGS=$(OPTFLAGS) -DHAVE_AV_CONFIG_H -I.. -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE $(AMR_CFLAGS)
F
Fabrice Bellard 已提交
11

12
OBJS= bitstream.o utils.o mem.o allcodecs.o \
M
Michael Niedermayer 已提交
13
      mpegvideo.o jrevdct.o jfdctfst.o jfdctint.o\
M
100l  
Michael Niedermayer 已提交
14
      mpegaudio.o ac3enc.o mjpeg.o resample.o resample2.o dsputil.o \
M
Michael Niedermayer 已提交
15
      motion_est.o imgconvert.o imgresample.o \
16
      mpeg12.o mpegaudiodec.o pcm.o simple_idct.o \
17
      ratecontrol.o adpcm.o eval.o dv.o error_resilience.o \
18
      fft.o mdct.o mace.o huffyuv.o cyuv.o opts.o raw.o h264.o golomb.o \
19
      vp3.o asv1.o 4xm.o cabac.o ffv1.o ra144.o ra288.o vcr1.o cljr.o \
20
      roqvideo.o dpcm.o interplayvideo.o xan.o rpza.o cinepak.o msrle.o \
M
Mike Melanson 已提交
21
      msvideo1.o vqavideo.o idcinvideo.o adx.o rational.o faandct.o 8bps.o \
M
Michael Niedermayer 已提交
22
      smc.o parser.o flicvideo.o truemotion1.o vmdav.o lcl.o qtrle.o g726.o \
23
      flac.o vp3dsp.o integer.o snow.o tscc.o sonic.o ulti.o h264idct.o \
24
      qdrw.o xl.o rangecoder.o png.o pnm.o qpeg.o vc9.o h263.o h261.o \
25 26
      msmpeg4.o h263dec.o svq1.o rv10.o wmadec.o indeo3.o shorten.o loco.o \
      alac.o
27

28
AMROBJS=
29
ifeq ($(AMR_NB),yes)
Z
Zdenek Kabelac 已提交
30
ifeq ($(AMR_NB_FIXED),yes)
31
AMROBJS= amr.o
Z
Zdenek Kabelac 已提交
32 33 34 35
AMREXTRALIBS+= amr/*.o
AMRLIBS=amrlibs
CLEANAMR=cleanamr
else
36 37
AMROBJS= amr.o
OBJS+= amr_float/sp_dec.o amr_float/sp_enc.o amr_float/interf_dec.o amr_float/interf_enc.o
Z
Zdenek Kabelac 已提交
38 39
CLEANAMR=cleanamrfloat
endif
40 41
endif

42 43 44 45
ifeq ($(HAVE_PTHREADS),yes)
OBJS+= pthread.o
endif

46 47 48 49
ifeq ($(HAVE_W32THREADS),yes)
OBJS+= w32thread.o
endif

50 51 52 53
ifeq ($(HAVE_BEOSTHREADS),yes)
OBJS+= beosthread.o
endif

54
ifeq ($(AMR_WB),yes)
55 56
AMROBJS= amr.o
OBJS+= amrwb_float/dec_acelp.o amrwb_float/dec_dtx.o amrwb_float/dec_gain.o \
57 58 59 60 61 62
		amrwb_float/dec_if.o amrwb_float/dec_lpc.o amrwb_float/dec_main.o \
		amrwb_float/dec_rom.o amrwb_float/dec_util.o amrwb_float/enc_acelp.o \
		amrwb_float/enc_dtx.o amrwb_float/enc_gain.o amrwb_float/enc_if.o \
		amrwb_float/enc_lpc.o amrwb_float/enc_main.o amrwb_float/enc_rom.o \
		amrwb_float/enc_util.o amrwb_float/if_rom.o
endif
63
OBJS+= $(AMROBJS)
64
CLEANAMRWB=cleanamrwbfloat
65
ASM_OBJS=
F
Fabrice Bellard 已提交
66

67 68 69 70
ifeq ($(HAVE_XVMC_ACCEL),yes)
OBJS+= xvmcvideo.o
endif

Z
Zdenek Kabelac 已提交
71
# currently using liba52 for ac3 decoding
72
ifeq ($(CONFIG_AC3),yes)
Z
Zdenek Kabelac 已提交
73 74 75
OBJS+= a52dec.o

# using builtin liba52 or runtime linked liba52.so.0
F
Fabrice Bellard 已提交
76
ifneq ($(CONFIG_A52BIN),yes)
Z
Zdenek Kabelac 已提交
77
OBJS+= liba52/bit_allocate.o liba52/bitstream.o liba52/downmix.o \
A
Arpi 已提交
78
	liba52/imdct.o  liba52/parse.o liba52/crc.o liba52/resample.o
79
endif
F
Fabrice Bellard 已提交
80
endif
F
Fabrice Bellard 已提交
81

82 83 84
# currently using libdts for dts decoding
ifeq ($(CONFIG_DTS),yes)
OBJS+= dtsdec.o
85 86
CFLAGS += $(DTS_INC)
EXTRALIBS += -ldts
87 88
endif

89 90
ifeq ($(CONFIG_FAAD),yes)
OBJS+= faad.o
Z
Zdenek Kabelac 已提交
91 92 93 94 95
ifeq ($(CONFIG_FAADBIN),yes)
# no libs needed
else
EXTRALIBS += -lfaad
endif
96 97
endif

98 99 100 101 102
ifeq ($(CONFIG_FAAC),yes)
OBJS+= faac.o
EXTRALIBS += -lfaac
endif

103 104 105 106 107
ifeq ($(CONFIG_XVID),yes)
OBJS+= xvidff.o
EXTRALIBS += -lxvidcore
endif

108 109
ifeq ($(CONFIG_PP),yes)
ifeq ($(SHARED_PP),yes)
110
EXTRALIBS += -L$(VPATH)/libpostproc -lpostproc
111 112 113 114 115 116
else
# LIBS += libpostproc/libpostproc.a ... should be fixed
OBJS += libpostproc/postprocess.o
endif
endif

117 118
ifeq ($(CONFIG_MP3LAME),yes)
OBJS += mp3lameaudio.o
Z
Zdenek Kabelac 已提交
119
EXTRALIBS += -lmp3lame
120 121
endif

N
Nilesh Bansal 已提交
122 123 124
ifeq ($(CONFIG_LIBOGG),yes)
EXTRALIBS += -logg
ifeq ($(CONFIG_LIBVORBIS),yes)
125 126 127
OBJS += oggvorbis.o
EXTRALIBS += -lvorbis -lvorbisenc
endif
N
Nilesh Bansal 已提交
128 129 130 131 132
ifeq ($(CONFIG_LIBTHEORA), yes)
OBJS += oggtheora.o
EXTRALIBS += -ltheora
endif
endif
133

134 135 136 137 138
ifeq ($(TARGET_GPROF),yes)
CFLAGS+=-p
LDFLAGS+=-p
endif

F
Fabrice Bellard 已提交
139
# i386 mmx specific stuff
140
ifeq ($(TARGET_MMX),yes)
F
Fabrice Bellard 已提交
141
OBJS += i386/fdct_mmx.o i386/cputest.o \
F
Fabrice Bellard 已提交
142
	i386/dsputil_mmx.o i386/mpegvideo_mmx.o \
Z
Zdenek Kabelac 已提交
143
	i386/idct_mmx.o i386/motion_est_mmx.o \
144 145
	i386/simple_idct_mmx.o i386/fft_sse.o i386/vp3dsp_mmx.o \
	i386/vp3dsp_sse2.o
146 147
ifdef TARGET_BUILTIN_VECTOR
i386/fft_sse.o: CFLAGS+= -msse
Z
Zdenek Kabelac 已提交
148
depend: CFLAGS+= -msse
149
endif
F
Fabrice Bellard 已提交
150 151
endif

F
Fabrice Bellard 已提交
152 153
# armv4l specific stuff
ifeq ($(TARGET_ARCH_ARMV4L),yes)
154
ASM_OBJS += armv4l/jrevdct_arm.o armv4l/simple_idct_arm.o
155
OBJS += armv4l/dsputil_arm.o armv4l/mpegvideo_arm.o
F
Fabrice Bellard 已提交
156 157
endif

F
Fabrice Bellard 已提交
158 159 160 161 162 163 164
# sun mediaLib specific stuff
# currently only works when libavcodec is used in mplayer
ifeq ($(HAVE_MLIB),yes)
OBJS += mlib/dsputil_mlib.o
CFLAGS += $(MLIB_INC)
endif

165 166
# alpha specific stuff
ifeq ($(TARGET_ARCH_ALPHA),yes)
167 168
OBJS += alpha/dsputil_alpha.o alpha/mpegvideo_alpha.o \
	alpha/simple_idct_alpha.o alpha/motion_est_alpha.o
169
ASM_OBJS += alpha/dsputil_alpha_asm.o alpha/motion_est_mvi_asm.o
170
CFLAGS += -fforce-addr -freduce-all-givs
171 172
endif

173
ifeq ($(TARGET_ARCH_POWERPC),yes)
174
OBJS += ppc/dsputil_ppc.o ppc/mpegvideo_ppc.o
175 176
endif

177
ifeq ($(TARGET_MMI),yes)
178
OBJS += ps2/dsputil_mmi.o ps2/idct_mmi.o ps2/mpegvideo_mmi.o
179 180
endif

181
ifeq ($(TARGET_ALTIVEC),yes)
182
OBJS += ppc/dsputil_altivec.o ppc/mpegvideo_altivec.o ppc/idct_altivec.o \
183 184
        ppc/fft_altivec.o ppc/gmc_altivec.o ppc/fdct_altivec.o \
        ppc/dsputil_h264_altivec.o
185 186
endif

187 188 189 190
ifeq ($(TARGET_ARCH_SH4),yes)
OBJS+= sh4/idct_sh4.o sh4/dsputil_sh4.o sh4/dsputil_align.o
endif

191
ifeq ($(TARGET_ARCH_SPARC),yes)
192
OBJS+=sparc/dsputil_vis.o
193 194 195 196
sparc/%.o: sparc/%.c
	$(CC) -mcpu=ultrasparc -mtune=ultrasparc $(CFLAGS) -c -o $@ $< 
endif
ifeq ($(TARGET_ARCH_SPARC64),yes)
197 198 199
CFLAGS+= -mcpu=ultrasparc -mtune=ultrasparc
endif

200
SRCS := $(OBJS:.o=.c) $(ASM_OBJS:.o=.S)
F
Fabrice Bellard 已提交
201
OBJS := $(OBJS) $(ASM_OBJS)
202

203
LIB= $(LIBPREF)avcodec$(LIBSUF)
N
Nick Kurshev 已提交
204
ifeq ($(BUILD_SHARED),yes)
205
SLIB= $(SLIBPREF)avcodec$(SLIBSUF)
N
Nick Kurshev 已提交
206
endif
207
TESTS= imgresample-test dct-test motion-test fft-test
F
Fabrice Bellard 已提交
208

N
Nick Kurshev 已提交
209
all: $(LIB) $(SLIB)
F
Fabrice Bellard 已提交
210

Z
Zdenek Kabelac 已提交
211 212 213
amrlibs:
	$(MAKE) -C amr spclib fipoplib

N
Nick Kurshev 已提交
214
tests: apiexample cpuid_test $(TESTS)
F
Fabrice Bellard 已提交
215

Z
Zdenek Kabelac 已提交
216
$(LIB): $(OBJS) $(AMRLIBS)
F
Fabrice Bellard 已提交
217
	rm -f $@
Z
Zdenek Kabelac 已提交
218
	$(AR) rc $@ $(OBJS) $(AMREXTRALIBS)
M
Michael Niedermayer 已提交
219
	$(RANLIB) $@
F
Fabrice Bellard 已提交
220

221
$(SLIB): $(OBJS)
222
ifeq ($(CONFIG_PP),yes)
223
	$(MAKE) -C libpostproc
224
endif
F
Fabrice Bellard 已提交
225 226 227 228
ifeq ($(CONFIG_WIN32),yes)
	$(CC) $(SHFLAGS) -Wl,--output-def,$(@:.dll=.def) -o $@ $(OBJS) $(EXTRALIBS) $(AMREXTRALIBS)
	-lib /machine:i386 /def:$(@:.dll=.def)
else
229
	$(CC) $(SHFLAGS) -o $@ $(OBJS) $(EXTRALIBS) $(AMREXTRALIBS) $(LDFLAGS)
F
Fabrice Bellard 已提交
230
endif
F
Fabrice Bellard 已提交
231 232 233

dsputil.o: dsputil.c dsputil.h

234 235 236
libpostproc/libpostproc.a:
	$(MAKE) -C libpostproc

F
Fabrice Bellard 已提交
237 238 239
%.o: %.c
	$(CC) $(CFLAGS) -c -o $@ $< 

F
Fabrice Bellard 已提交
240 241 242
%.o: %.S
	$(CC) $(CFLAGS) -c -o $@ $<

243
depend: $(SRCS)
244
	$(CC) -MM $(CFLAGS) $^ 1>.depend
245

246 247
dep:	depend

Z
Zdenek Kabelac 已提交
248
clean: $(CLEANAMR)
249
	rm -f *.o *.d *~ .depend $(LIB) $(SLIB) *.so i386/*.o i386/*~ \
F
Fabrice Bellard 已提交
250
	   armv4l/*.o armv4l/*~ \
F
Fabrice Bellard 已提交
251
	   mlib/*.o mlib/*~ \
252
	   alpha/*.o alpha/*~ \
253
	   ppc/*.o ppc/*~ \
254
	   ps2/*.o ps2/*~ \
255
	   sh4/*.o sh4/*~ \
256
	   sparc/*.o sparc/*~ \
Z
Zdenek Kabelac 已提交
257 258
	   liba52/*.o liba52/*~ \
	   apiexample $(TESTS)
Z
Zdenek Kabelac 已提交
259
	$(MAKE) -C libpostproc clean
F
Fabrice Bellard 已提交
260

261
distclean: clean
262 263
	rm -f Makefile.bak .depend

Z
Zdenek Kabelac 已提交
264 265 266 267 268 269
cleanamr:
	$(MAKE) -C amr clean

cleanamrfloat:
	rm -f amr_float/*.o

270 271 272
cleanamrwbfloat:
	$(MAKE) -C amrwb_float -f makefile.gcc clean

F
Fabrice Bellard 已提交
273 274
# api example program
apiexample: apiexample.c $(LIB)
M
Michael Niedermayer 已提交
275
	$(CC) $(CFLAGS) -o $@ $< $(LIB) $(EXTRALIBS) -lm
F
Fabrice Bellard 已提交
276

N
Nick Kurshev 已提交
277 278 279 280
# cpuid test
cpuid_test: i386/cputest.c
	$(CC) $(CFLAGS) -D__TEST__ -o $@ $<

F
Fabrice Bellard 已提交
281 282 283
# testing progs

imgresample-test: imgresample.c
M
Michael Niedermayer 已提交
284
	$(CC) $(CFLAGS) -DTEST -o $@ $^ -lm
F
Fabrice Bellard 已提交
285

F
Fabrice Bellard 已提交
286
dct-test: dct-test.o fdctref.o $(LIB)
287
	$(CC) -o $@ $^ -lm
288

F
Fabrice Bellard 已提交
289
motion-test: motion_test.o $(LIB)
M
Michael Niedermayer 已提交
290
	$(CC) -o $@ $^ -lm
F
Fabrice Bellard 已提交
291

292
fft-test: fft-test.o $(LIB)
293 294
	$(CC) -o $@ $^ -lm

N
Nick Kurshev 已提交
295
ifeq ($(BUILD_SHARED),yes)
F
Fabrice Bellard 已提交
296 297
install: all install-headers
ifeq ($(CONFIG_WIN32),yes)
298
	install $(INSTALLSTRIP) -m 755 $(SLIB) "$(prefix)"
F
Fabrice Bellard 已提交
299
else
300
	install -d $(prefix)/lib
301
	install $(INSTALLSTRIP) -m 755 $(SLIB) $(prefix)/lib/libavcodec-$(VERSION).so
302 303
	ln -sf libavcodec-$(VERSION).so $(prefix)/lib/libavcodec.so
	ldconfig || true
F
Fabrice Bellard 已提交
304
endif
305
ifeq ($(CONFIG_PP),yes)
306
	$(MAKE) -C libpostproc $@
307
endif
F
Fabrice Bellard 已提交
308 309
else
install:
N
Nick Kurshev 已提交
310
endif
311

F
Fabrice Bellard 已提交
312
installlib: all install-headers
313
	install -m 644 $(LIB) "$(prefix)/lib"
F
Fabrice Bellard 已提交
314 315 316

install-headers:
	mkdir -p "$(prefix)/include/ffmpeg"
317 318 319
	install -m 644 $(SRC_PATH)/libavcodec/avcodec.h \
	               $(SRC_PATH)/libavcodec/common.h \
	               $(SRC_PATH)/libavcodec/rational.h \
F
Fabrice Bellard 已提交
320
                "$(prefix)/include/ffmpeg"
321

322 323 324 325 326 327
#
# include dependency files if they exist
#
ifneq ($(wildcard .depend),)
include .depend
endif