Makefile 7.5 KB
Newer Older
1 2
#
# libavcodec Makefile
F
Fabrice Bellard 已提交
3
# (c) 2000-2003 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
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 25
      qdrw.o xl.o rangecoder.o png.o pnm.o qpeg.o vc9.o h263.o h261.o \
      msmpeg4.o h263dec.o svq1.o rv10.o wmadec.o indeo3.o
26

27
AMROBJS=
28
ifeq ($(AMR_NB),yes)
Z
Zdenek Kabelac 已提交
29
ifeq ($(AMR_NB_FIXED),yes)
30
AMROBJS= amr.o
Z
Zdenek Kabelac 已提交
31 32 33 34
AMREXTRALIBS+= amr/*.o
AMRLIBS=amrlibs
CLEANAMR=cleanamr
else
35 36
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 已提交
37 38
CLEANAMR=cleanamrfloat
endif
39 40
endif

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

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

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

53
ifeq ($(AMR_WB),yes)
54 55
AMROBJS= amr.o
OBJS+= amrwb_float/dec_acelp.o amrwb_float/dec_dtx.o amrwb_float/dec_gain.o \
56 57 58 59 60 61
		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
62
OBJS+= $(AMROBJS)
63
CLEANAMRWB=cleanamrwbfloat
64
ASM_OBJS=
F
Fabrice Bellard 已提交
65

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

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

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

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

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

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

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

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

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

121 122 123 124 125
ifeq ($(CONFIG_VORBIS),yes)
OBJS += oggvorbis.o
EXTRALIBS += -lvorbis -lvorbisenc
endif

126 127 128 129 130
ifeq ($(TARGET_GPROF),yes)
CFLAGS+=-p
LDFLAGS+=-p
endif

F
Fabrice Bellard 已提交
131
# i386 mmx specific stuff
132
ifeq ($(TARGET_MMX),yes)
F
Fabrice Bellard 已提交
133
OBJS += i386/fdct_mmx.o i386/cputest.o \
F
Fabrice Bellard 已提交
134
	i386/dsputil_mmx.o i386/mpegvideo_mmx.o \
Z
Zdenek Kabelac 已提交
135
	i386/idct_mmx.o i386/motion_est_mmx.o \
136 137
	i386/simple_idct_mmx.o i386/fft_sse.o i386/vp3dsp_mmx.o \
	i386/vp3dsp_sse2.o
138 139
ifdef TARGET_BUILTIN_VECTOR
i386/fft_sse.o: CFLAGS+= -msse
Z
Zdenek Kabelac 已提交
140
depend: CFLAGS+= -msse
141
endif
F
Fabrice Bellard 已提交
142 143
endif

F
Fabrice Bellard 已提交
144 145
# armv4l specific stuff
ifeq ($(TARGET_ARCH_ARMV4L),yes)
146
ASM_OBJS += armv4l/jrevdct_arm.o armv4l/simple_idct_arm.o
147
OBJS += armv4l/dsputil_arm.o armv4l/mpegvideo_arm.o
F
Fabrice Bellard 已提交
148 149
endif

F
Fabrice Bellard 已提交
150 151 152 153 154 155 156
# 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

157 158
# alpha specific stuff
ifeq ($(TARGET_ARCH_ALPHA),yes)
159 160
OBJS += alpha/dsputil_alpha.o alpha/mpegvideo_alpha.o \
	alpha/simple_idct_alpha.o alpha/motion_est_alpha.o
161
ASM_OBJS += alpha/dsputil_alpha_asm.o alpha/motion_est_mvi_asm.o
162
CFLAGS += -fforce-addr -freduce-all-givs
163 164
endif

165
ifeq ($(TARGET_ARCH_POWERPC),yes)
166
OBJS += ppc/dsputil_ppc.o ppc/mpegvideo_ppc.o
167 168
endif

169
ifeq ($(TARGET_MMI),yes)
170
OBJS += ps2/dsputil_mmi.o ps2/idct_mmi.o ps2/mpegvideo_mmi.o
171 172
endif

173
ifeq ($(TARGET_ALTIVEC),yes)
174
OBJS += ppc/dsputil_altivec.o ppc/mpegvideo_altivec.o ppc/idct_altivec.o \
175 176
        ppc/fft_altivec.o ppc/gmc_altivec.o ppc/fdct_altivec.o \
        ppc/dsputil_h264_altivec.o
177 178
endif

179 180 181 182
ifeq ($(TARGET_ARCH_SH4),yes)
OBJS+= sh4/idct_sh4.o sh4/dsputil_sh4.o sh4/dsputil_align.o
endif

183
ifeq ($(TARGET_ARCH_SPARC),yes)
184
OBJS+=sparc/dsputil_vis.o
185 186 187 188
sparc/%.o: sparc/%.c
	$(CC) -mcpu=ultrasparc -mtune=ultrasparc $(CFLAGS) -c -o $@ $< 
endif
ifeq ($(TARGET_ARCH_SPARC64),yes)
189 190 191
CFLAGS+= -mcpu=ultrasparc -mtune=ultrasparc
endif

192
SRCS := $(OBJS:.o=.c) $(ASM_OBJS:.o=.S)
F
Fabrice Bellard 已提交
193
OBJS := $(OBJS) $(ASM_OBJS)
194

195
LIB= $(LIBPREF)avcodec$(LIBSUF)
N
Nick Kurshev 已提交
196
ifeq ($(BUILD_SHARED),yes)
197
SLIB= $(SLIBPREF)avcodec$(SLIBSUF)
N
Nick Kurshev 已提交
198
endif
199
TESTS= imgresample-test dct-test motion-test fft-test
F
Fabrice Bellard 已提交
200

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

Z
Zdenek Kabelac 已提交
203 204 205
amrlibs:
	$(MAKE) -C amr spclib fipoplib

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

Z
Zdenek Kabelac 已提交
208
$(LIB): $(OBJS) $(AMRLIBS)
F
Fabrice Bellard 已提交
209
	rm -f $@
Z
Zdenek Kabelac 已提交
210
	$(AR) rc $@ $(OBJS) $(AMREXTRALIBS)
M
Michael Niedermayer 已提交
211
	$(RANLIB) $@
F
Fabrice Bellard 已提交
212

213
$(SLIB): $(OBJS)
214
ifeq ($(CONFIG_PP),yes)
215
	$(MAKE) -C libpostproc
216
endif
F
Fabrice Bellard 已提交
217 218 219 220
ifeq ($(CONFIG_WIN32),yes)
	$(CC) $(SHFLAGS) -Wl,--output-def,$(@:.dll=.def) -o $@ $(OBJS) $(EXTRALIBS) $(AMREXTRALIBS)
	-lib /machine:i386 /def:$(@:.dll=.def)
else
221
	$(CC) $(SHFLAGS) -o $@ $(OBJS) $(EXTRALIBS) $(AMREXTRALIBS) $(LDFLAGS)
F
Fabrice Bellard 已提交
222
endif
F
Fabrice Bellard 已提交
223 224 225

dsputil.o: dsputil.c dsputil.h

226 227 228
libpostproc/libpostproc.a:
	$(MAKE) -C libpostproc

F
Fabrice Bellard 已提交
229 230 231
%.o: %.c
	$(CC) $(CFLAGS) -c -o $@ $< 

F
Fabrice Bellard 已提交
232 233 234
%.o: %.S
	$(CC) $(CFLAGS) -c -o $@ $<

235
depend: $(SRCS)
236
	$(CC) -MM $(CFLAGS) $^ 1>.depend
237

238 239
dep:	depend

Z
Zdenek Kabelac 已提交
240
clean: $(CLEANAMR)
241
	rm -f *.o *.d *~ .depend $(LIB) $(SLIB) *.so i386/*.o i386/*~ \
F
Fabrice Bellard 已提交
242
	   armv4l/*.o armv4l/*~ \
F
Fabrice Bellard 已提交
243
	   mlib/*.o mlib/*~ \
244
	   alpha/*.o alpha/*~ \
245
	   ppc/*.o ppc/*~ \
246
	   ps2/*.o ps2/*~ \
247
	   sh4/*.o sh4/*~ \
248
	   sparc/*.o sparc/*~ \
Z
Zdenek Kabelac 已提交
249 250
	   liba52/*.o liba52/*~ \
	   apiexample $(TESTS)
Z
Zdenek Kabelac 已提交
251
	$(MAKE) -C libpostproc clean
F
Fabrice Bellard 已提交
252

253
distclean: clean
254 255
	rm -f Makefile.bak .depend

Z
Zdenek Kabelac 已提交
256 257 258 259 260 261
cleanamr:
	$(MAKE) -C amr clean

cleanamrfloat:
	rm -f amr_float/*.o

262 263 264
cleanamrwbfloat:
	$(MAKE) -C amrwb_float -f makefile.gcc clean

F
Fabrice Bellard 已提交
265 266
# api example program
apiexample: apiexample.c $(LIB)
M
Michael Niedermayer 已提交
267
	$(CC) $(CFLAGS) -o $@ $< $(LIB) $(EXTRALIBS) -lm
F
Fabrice Bellard 已提交
268

N
Nick Kurshev 已提交
269 270 271 272
# cpuid test
cpuid_test: i386/cputest.c
	$(CC) $(CFLAGS) -D__TEST__ -o $@ $<

F
Fabrice Bellard 已提交
273 274 275
# testing progs

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

F
Fabrice Bellard 已提交
278
dct-test: dct-test.o fdctref.o $(LIB)
279
	$(CC) -o $@ $^ -lm
280

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

284
fft-test: fft-test.o $(LIB)
285 286
	$(CC) -o $@ $^ -lm

N
Nick Kurshev 已提交
287
ifeq ($(BUILD_SHARED),yes)
F
Fabrice Bellard 已提交
288 289
install: all install-headers
ifeq ($(CONFIG_WIN32),yes)
290
	install $(INSTALLSTRIP) -m 755 $(SLIB) "$(prefix)"
F
Fabrice Bellard 已提交
291
else
292
	install -d $(prefix)/lib
293
	install $(INSTALLSTRIP) -m 755 $(SLIB) $(prefix)/lib/libavcodec-$(VERSION).so
294 295
	ln -sf libavcodec-$(VERSION).so $(prefix)/lib/libavcodec.so
	ldconfig || true
F
Fabrice Bellard 已提交
296
endif
297
ifeq ($(CONFIG_PP),yes)
298
	$(MAKE) -C libpostproc $@
299
endif
F
Fabrice Bellard 已提交
300 301
else
install:
N
Nick Kurshev 已提交
302
endif
303

F
Fabrice Bellard 已提交
304
installlib: all install-headers
305
	install -m 644 $(LIB) "$(prefix)/lib"
F
Fabrice Bellard 已提交
306 307 308

install-headers:
	mkdir -p "$(prefix)/include/ffmpeg"
309 310 311
	install -m 644 $(SRC_PATH)/libavcodec/avcodec.h \
	               $(SRC_PATH)/libavcodec/common.h \
	               $(SRC_PATH)/libavcodec/rational.h \
F
Fabrice Bellard 已提交
312
                "$(prefix)/include/ffmpeg"
313

314 315 316 317 318 319
#
# include dependency files if they exist
#
ifneq ($(wildcard .depend),)
include .depend
endif