]> git.sesse.net Git - ffmpeg/blob - libavcodec/Makefile
Put double-quotes around the install path in the "install-headers" section
[ffmpeg] / libavcodec / Makefile
1 #
2 # libavcodec Makefile
3 # (c) 2000-2005 Fabrice Bellard
4 #
5 include ../config.mak
6
7 VPATH=$(SRC_PATH)/libavcodec
8
9 # NOTE: -I.. is needed to include config.h
10 CFLAGS=$(OPTFLAGS) -DHAVE_AV_CONFIG_H -I.. -I$(SRC_PATH)/libavutil -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE $(AMR_CFLAGS)
11
12 OBJS= bitstream.o utils.o mem.o allcodecs.o \
13       mpegvideo.o jrevdct.o jfdctfst.o jfdctint.o\
14       mpegaudio.o ac3enc.o mjpeg.o resample.o resample2.o dsputil.o \
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 error_resilience.o \
18       fft.o mdct.o raw.o golomb.o cabac.o\
19       dpcm.o adx.o faandct.o parser.o g726.o \
20       vp3dsp.o h264idct.o rangecoder.o pnm.o h263.o msmpeg4.o h263dec.o dvdsub.o dvbsub.o dvbsubdec.o\
21       opt.o
22
23 ifeq ($(CONFIG_AASC_DECODER),yes)
24     OBJS+= aasc.o
25 endif
26 ifeq ($(CONFIG_ALAC_DECODER),yes)
27     OBJS+= alac.o
28 endif
29 ifneq ($(CONFIG_ASV1_DECODER)$(CONFIG_ASV1_ENCODER)$(CONFIG_ASV2_DECODER)$(CONFIG_ASV2_ENCODER),)
30     OBJS+= asv1.o
31 endif
32 ifeq ($(CONFIG_CINEPAK_DECODER),yes)
33     OBJS+= cinepak.o
34 endif
35 ifneq ($(CONFIG_CLJR_DECODER)$(CONFIG_CLJR_ENCODER),)
36     OBJS+= cljr.o
37 endif
38 ifeq ($(CONFIG_CYUV_DECODER),yes)
39     OBJS+= cyuv.o
40 endif
41 ifneq ($(CONFIG_DVVIDEO_DECODER)$(CONFIG_DVVIDEO_ENCODER),)
42     OBJS+= dv.o
43 endif
44 ifeq ($(CONFIG_EIGHTBPS_DECODER),yes)
45     OBJS+= 8bps.o
46 endif
47 ifneq ($(CONFIG_FFV1_DECODER)$(CONFIG_FFV1_ENCODER),)
48     OBJS+= ffv1.o
49 endif
50 ifeq ($(CONFIG_FLAC_DECODER),yes)
51     OBJS+= flac.o
52 endif
53 ifeq ($(CONFIG_FLIC_DECODER),yes)
54     OBJS+= flicvideo.o
55 endif
56 ifeq ($(CONFIG_FOURXM_DECODER),yes)
57     OBJS+= 4xm.o
58 endif
59 ifeq ($(CONFIG_FRAPS_DECODER),yes)
60     OBJS+= fraps.o
61 endif
62 ifneq ($(CONFIG_H261_DECODER)$(CONFIG_H261_ENCODER),)
63     OBJS+= h261.o
64 endif
65 ifneq ($(CONFIG_H264_DECODER)$(CONFIG_SVQ3_DECODER),)
66     OBJS+= h264.o
67 endif
68 ifneq ($(CONFIG_HUFFYUV_DECODER)$(CONFIG_HUFFYUV_ENCODER)$(CONFIG_FFVHUFF_DECODER)$(CONFIG_FFVHUFF_ENCODER),)
69     OBJS+= huffyuv.o
70 endif
71 ifeq ($(CONFIG_IDCIN_DECODER),yes)
72     OBJS+= idcinvideo.o
73 endif
74 ifeq ($(CONFIG_INDEO2_DECODER),yes)
75     OBJS+= indeo2.o
76 endif
77 ifeq ($(CONFIG_INDEO3_DECODER),yes)
78     OBJS+= indeo3.o
79 endif
80 ifeq ($(CONFIG_INTERPLAY_VIDEO_DECODER),yes)
81     OBJS+= interplayvideo.o
82 endif
83 ifneq ($(CONFIG_MSZH_DECODER)$(CONFIG_ZLIB_DECODER)$(CONFIG_ZLIB_ENCODER),)
84     OBJS+= lcl.o
85 endif
86 ifeq ($(CONFIG_LOCO_DECODER),yes)
87     OBJS+= loco.o
88 endif
89 ifneq ($(CONFIG_MACE3_DECODER)$(CONFIG_MACE6_DECODER),)
90     OBJS+= mace.o
91 endif
92 ifeq ($(CONFIG_MSRLE_DECODER),yes)
93     OBJS+= msrle.o
94 endif
95 ifeq ($(CONFIG_MSVIDEO1_DECODER),yes)
96     OBJS+= msvideo1.o
97 endif
98 ifneq ($(CONFIG_PNG_DECODER)$(CONFIG_PNG_ENCODER),)
99     OBJS+= png.o
100 endif
101 ifeq ($(CONFIG_QDM2_DECODER),yes)
102     OBJS+= qdm2.o
103 endif
104 ifeq ($(CONFIG_QDRAW_DECODER),yes)
105     OBJS+= qdrw.o
106 endif
107 ifeq ($(CONFIG_QPEG_DECODER),yes)
108     OBJS+= qpeg.o
109 endif
110 ifeq ($(CONFIG_QTRLE_DECODER),yes)
111     OBJS+= qtrle.o
112 endif
113 ifeq ($(CONFIG_RA_144_DECODER),yes)
114     OBJS+= ra144.o
115 endif
116 ifeq ($(CONFIG_RA_288_DECODER),yes)
117     OBJS+= ra288.o
118 endif
119 ifeq ($(CONFIG_ROQ_DECODER),yes)
120     OBJS+= roqvideo.o
121 endif
122 ifeq ($(CONFIG_RPZA_DECODER),yes)
123     OBJS+= rpza.o
124 endif
125 ifneq ($(CONFIG_RV10_DECODER)$(CONFIG_RV20_DECODER)$(CONFIG_RV10_ENCODER)$(CONFIG_RV20_ENCODER),)
126     OBJS+= rv10.o
127 endif
128 ifeq ($(CONFIG_SHORTEN_DECODER),yes)
129     OBJS+= shorten.o
130 endif
131 ifeq ($(CONFIG_SMC_DECODER),yes)
132     OBJS+= smc.o
133 endif
134 ifneq ($(CONFIG_SNOW_DECODER)$(CONFIG_SNOW_ENCODER),)
135     OBJS+= snow.o
136 endif
137 ifneq ($(CONFIG_SONIC_DECODER)$(CONFIG_SONIC_ENCODER)$(CONFIG_SONIC_LS_ENCODER),)
138     OBJS+= sonic.o
139 endif
140 ifneq ($(CONFIG_SVQ1_DECODER)$(CONFIG_SVQ1_ENCODER),)
141     OBJS+= svq1.o
142 endif
143 ifeq ($(CONFIG_TRUEMOTION1_DECODER),yes)
144     OBJS+= truemotion1.o
145 endif
146 ifeq ($(CONFIG_TRUEMOTION2_DECODER),yes)
147     OBJS+= truemotion2.o
148 endif
149 ifeq ($(CONFIG_TSCC_DECODER),yes)
150     OBJS+= tscc.o
151 endif
152 ifeq ($(CONFIG_ULTI_DECODER),yes)
153     OBJS+= ulti.o
154 endif
155 ifneq ($(CONFIG_VC9_DECODER)$(CONFIG_WMV3_DECODER),)
156     OBJS+= vc9.o
157 endif
158 ifneq ($(CONFIG_VCR1_DECODER)$(CONFIG_VCR1_ENCODER),)
159     OBJS+= vcr1.o
160 endif
161 ifneq ($(CONFIG_VMDVIDEO_DECODER)$(CONFIG_VMDAUDIO_DECODER),)
162     OBJS+= vmdav.o
163 endif
164 ifeq ($(CONFIG_VORBIS_DECODER),yes)
165     OBJS+= vorbis.o
166 endif
167 ifneq ($(CONFIG_VP3_DECODER)$(CONFIG_THEORA_DECODER),)
168     OBJS+= vp3.o
169 endif
170 ifeq ($(CONFIG_VQA_DECODER),yes)
171     OBJS+= vqavideo.o
172 endif
173 ifneq ($(CONFIG_WMAV1_DECODER)$(CONFIG_WMAV2_DECODER),)
174     OBJS+= wmadec.o
175 endif
176 ifeq ($(CONFIG_WNV1_DECODER),yes)
177     OBJS+= wnv1.o
178 endif
179 ifeq ($(CONFIG_WS_SND1_DECODER),yes)
180     OBJS+= ws-snd1.o
181 endif
182 ifneq ($(CONFIG_XAN_WC3_DECODER)$(CONFIG_XAN_WC4_DECODER),)
183     OBJS+= xan.o
184 endif
185 ifeq ($(CONFIG_XL_DECODER),yes)
186     OBJS+= xl.o
187 endif
188       
189       
190 AMROBJS=
191 ifeq ($(AMR_NB),yes)
192 ifeq ($(AMR_NB_FIXED),yes)
193 AMROBJS= amr.o
194 AMREXTRALIBS+= amr/*.o
195 AMRLIBS=amrlibs
196 CLEANAMR=cleanamr
197 else
198 AMROBJS= amr.o
199 OBJS+= amr_float/sp_dec.o amr_float/sp_enc.o amr_float/interf_dec.o amr_float/interf_enc.o
200 CLEANAMR=cleanamrfloat
201 endif
202 endif
203
204 ifeq ($(HAVE_PTHREADS),yes)
205 OBJS+= pthread.o
206 endif
207
208 ifeq ($(HAVE_W32THREADS),yes)
209 OBJS+= w32thread.o
210 endif
211
212 ifeq ($(HAVE_BEOSTHREADS),yes)
213 OBJS+= beosthread.o
214 endif
215
216 ifeq ($(AMR_WB),yes)
217 AMROBJS= amr.o
218 OBJS+= amrwb_float/dec_acelp.o amrwb_float/dec_dtx.o amrwb_float/dec_gain.o \
219                 amrwb_float/dec_if.o amrwb_float/dec_lpc.o amrwb_float/dec_main.o \
220                 amrwb_float/dec_rom.o amrwb_float/dec_util.o amrwb_float/enc_acelp.o \
221                 amrwb_float/enc_dtx.o amrwb_float/enc_gain.o amrwb_float/enc_if.o \
222                 amrwb_float/enc_lpc.o amrwb_float/enc_main.o amrwb_float/enc_rom.o \
223                 amrwb_float/enc_util.o amrwb_float/if_rom.o
224 endif
225 OBJS+= $(AMROBJS)
226 CLEANAMRWB=cleanamrwbfloat
227 ASM_OBJS=
228
229 ifeq ($(HAVE_XVMC_ACCEL),yes)
230 OBJS+= xvmcvideo.o
231 endif
232
233 # currently using liba52 for ac3 decoding
234 ifeq ($(CONFIG_AC3),yes)
235 OBJS+= a52dec.o
236
237 # using builtin liba52 or runtime linked liba52.so.0
238 ifneq ($(CONFIG_A52BIN),yes)
239 OBJS+= liba52/bit_allocate.o liba52/bitstream.o liba52/downmix.o \
240         liba52/imdct.o  liba52/parse.o liba52/crc.o liba52/resample.o
241 endif
242 endif
243
244 EXTRALIBS += -L../libavutil -lavutil$(BUILDSUF)
245
246 # currently using libdts for dts decoding
247 ifeq ($(CONFIG_DTS),yes)
248 OBJS+= dtsdec.o
249 CFLAGS += $(DTS_INC)
250 endif
251
252 ifeq ($(CONFIG_FAAD),yes)
253 OBJS+= faad.o
254 endif
255
256 ifeq ($(CONFIG_FAAC),yes)
257 OBJS+= faac.o
258 endif
259
260 ifeq ($(CONFIG_XVID),yes)
261 OBJS+= xvidff.o
262 endif
263
264 ifeq ($(CONFIG_X264),yes)
265 OBJS+= x264.o
266 endif
267
268 ifeq ($(CONFIG_PP),yes)
269 ifeq ($(SHARED_PP),yes)
270 EXTRALIBS += -Llibpostproc -lpostproc$(BUILDSUF)
271 else
272 # LIBS += libpostproc/libpostproc.a ... should be fixed
273 OBJS += libpostproc/postprocess.o
274 endif
275 endif
276
277 ifeq ($(CONFIG_MP3LAME),yes)
278 OBJS += mp3lameaudio.o
279 endif
280
281 ifeq ($(CONFIG_LIBOGG),yes)
282 ifeq ($(CONFIG_LIBVORBIS),yes)
283 OBJS += oggvorbis.o
284 endif
285 ifeq ($(CONFIG_LIBTHEORA), yes)
286 OBJS += oggtheora.o
287 endif
288 endif
289
290 ifeq ($(CONFIG_LIBGSM),yes)
291 OBJS += libgsm.o
292 endif
293
294 ifeq ($(TARGET_GPROF),yes)
295 CFLAGS+=-p
296 LDFLAGS+=-p
297 endif
298
299 # i386 mmx specific stuff
300 ifeq ($(TARGET_MMX),yes)
301 OBJS += i386/fdct_mmx.o i386/cputest.o \
302         i386/dsputil_mmx.o i386/mpegvideo_mmx.o \
303         i386/idct_mmx.o i386/motion_est_mmx.o \
304         i386/simple_idct_mmx.o i386/fft_sse.o i386/vp3dsp_mmx.o \
305         i386/vp3dsp_sse2.o
306 ifeq ($(CONFIG_GPL),yes)
307 OBJS += i386/idct_mmx_xvid.o
308 endif
309 ifdef TARGET_BUILTIN_VECTOR
310 i386/fft_sse.o: CFLAGS+= -msse
311 depend: CFLAGS+= -msse
312 endif
313 endif
314
315 # armv4l specific stuff
316 ifeq ($(TARGET_ARCH_ARMV4L),yes)
317 ASM_OBJS += armv4l/jrevdct_arm.o armv4l/simple_idct_arm.o armv4l/dsputil_arm_s.o
318 OBJS += armv4l/dsputil_arm.o armv4l/mpegvideo_arm.o
319 ifeq ($(TARGET_IWMMXT),yes)
320 OBJS += armv4l/dsputil_iwmmxt.o armv4l/mpegvideo_iwmmxt.o
321 endif
322 endif
323
324 # sun mediaLib specific stuff
325 # currently only works when libavcodec is used in mplayer
326 ifeq ($(HAVE_MLIB),yes)
327 OBJS += mlib/dsputil_mlib.o
328 CFLAGS += $(MLIB_INC)
329 endif
330
331 # Intel IPP specific stuff
332 # currently only works when libavcodec is used in mplayer
333 ifeq ($(HAVE_IPP),yes)
334 CFLAGS += $(IPP_INC)
335 endif
336
337 # alpha specific stuff
338 ifeq ($(TARGET_ARCH_ALPHA),yes)
339 OBJS += alpha/dsputil_alpha.o alpha/mpegvideo_alpha.o \
340         alpha/simple_idct_alpha.o alpha/motion_est_alpha.o
341 ASM_OBJS += alpha/dsputil_alpha_asm.o alpha/motion_est_mvi_asm.o
342 CFLAGS += -fforce-addr
343 endif
344
345 ifeq ($(TARGET_ARCH_POWERPC),yes)
346 OBJS += ppc/dsputil_ppc.o ppc/mpegvideo_ppc.o
347 endif
348
349 ifeq ($(TARGET_MMI),yes)
350 OBJS += ps2/dsputil_mmi.o ps2/idct_mmi.o ps2/mpegvideo_mmi.o
351 endif
352
353 ifeq ($(TARGET_ALTIVEC),yes)
354 OBJS += ppc/dsputil_altivec.o ppc/mpegvideo_altivec.o ppc/idct_altivec.o \
355         ppc/fft_altivec.o ppc/gmc_altivec.o ppc/fdct_altivec.o \
356         ppc/dsputil_h264_altivec.o
357 endif
358
359 ifeq ($(TARGET_ARCH_SH4),yes)
360 OBJS+= sh4/idct_sh4.o sh4/dsputil_sh4.o sh4/dsputil_align.o
361 endif
362
363 ifeq ($(TARGET_ARCH_SPARC),yes)
364 OBJS+=sparc/dsputil_vis.o
365 sparc/%.o: sparc/%.c
366         $(CC) -mcpu=ultrasparc -mtune=ultrasparc $(CFLAGS) -c -o $@ $< 
367 endif
368 ifeq ($(TARGET_ARCH_SPARC64),yes)
369 CFLAGS+= -mcpu=ultrasparc -mtune=ultrasparc
370 endif
371
372 # Darwin specific stuff
373 ifeq ($(CONFIG_DARWIN),yes)
374 SHFLAGS += -Wl,-install_name,$(libdir)/$(SLIBPREF)avcodec$(SLIBSUF),-current_version,$(SPPVERSION),-compatibility_version,$(SPPVERSION)
375 endif
376
377 SRCS := $(OBJS:.o=.c) $(ASM_OBJS:.o=.S)
378 OBJS := $(OBJS) $(ASM_OBJS)
379
380 LIB= $(LIBPREF)avcodec$(LIBSUF)
381 LIBAVUTIL= $(SRC_PATH)/libavutil/$(LIBPREF)avutil$(LIBSUF)
382 ifeq ($(BUILD_SHARED),yes)
383 SLIBNAME= $(SLIBPREF)avcodec$(SLIBSUF)
384 endif
385 TESTS= imgresample-test dct-test motion-test fft-test
386
387 all: $(LIB) $(SLIBNAME)
388
389 amrlibs:
390         $(MAKE) -C amr spclib fipoplib
391
392 tests: apiexample cpuid_test $(TESTS)
393
394 $(LIB): $(OBJS) $(AMRLIBS)
395         rm -f $@
396         $(AR) rc $@ $(OBJS) $(AMREXTRALIBS)
397         $(RANLIB) $@
398
399 $(SLIBNAME): $(OBJS)
400 ifeq ($(CONFIG_PP),yes)
401         $(MAKE) -C libpostproc
402 endif
403 ifeq ($(CONFIG_WIN32),yes)
404         $(CC) $(SHFLAGS) -Wl,--output-def,$(@:.dll=.def) -o $@ $(OBJS) $(EXTRALIBS) $(AMREXTRALIBS)
405         -lib /machine:i386 /def:$(@:.dll=.def)
406 else
407         $(CC) $(SHFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(EXTRALIBS) $(AMREXTRALIBS)
408 endif
409
410 dsputil.o: dsputil.c dsputil.h
411
412 libpostproc/libpostproc.a:
413         $(MAKE) -C libpostproc
414
415 %.o: %.c
416         $(CC) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $< 
417
418 %.o: %.S
419         $(CC) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $<
420
421 depend: $(SRCS)
422         $(CC) -MM $(CFLAGS) $^ 1>.depend
423
424 dep:    depend
425
426 clean: $(CLEANAMR)
427         rm -f *.o *.d *~ .depend $(LIB) $(SLIBNAME) *$(SLIBSUF) i386/*.o i386/*~ \
428            armv4l/*.o armv4l/*~ \
429            mlib/*.o mlib/*~ \
430            alpha/*.o alpha/*~ \
431            ppc/*.o ppc/*~ \
432            ps2/*.o ps2/*~ \
433            sh4/*.o sh4/*~ \
434            sparc/*.o sparc/*~ \
435            liba52/*.o liba52/*~ \
436            apiexample $(TESTS)
437         $(MAKE) -C libpostproc clean
438
439 distclean: clean
440         rm -f Makefile.bak .depend
441
442 cleanamr:
443         $(MAKE) -C amr clean
444
445 cleanamrfloat:
446         rm -f amr_float/*.o
447
448 cleanamrwbfloat:
449         $(MAKE) -C amrwb_float -f makefile.gcc clean
450
451 # api example program
452 apiexample: apiexample.c $(LIB)
453         $(CC) $(CFLAGS) -o $@ $< $(LIB) $(LIBAVUTIL) $(EXTRALIBS) -lm
454
455 # cpuid test
456 cpuid_test: i386/cputest.c
457         $(CC) $(CFLAGS) -D__TEST__ -o $@ $<
458
459 # testing progs
460
461 imgresample-test: imgresample.c
462         $(CC) $(CFLAGS) -DTEST -o $@ $^ -lm
463
464 dct-test: dct-test.o fdctref.o $(LIB)
465         $(CC) -o $@ $^ -lm $(LIBAVUTIL)
466
467 motion-test: motion_test.o $(LIB)
468         $(CC) -o $@ $^ -lm
469
470 fft-test: fft-test.o $(LIB)
471         $(CC) -o $@ $^ $(LIBAVUTIL) -lm
472
473 ifeq ($(BUILD_SHARED),yes)
474 install: all install-headers
475 ifeq ($(CONFIG_WIN32),yes)
476         install $(INSTALLSTRIP) -m 755 $(SLIBNAME) "$(prefix)"
477 else
478         install -d $(libdir)
479         install $(INSTALLSTRIP) -m 755 $(SLIBNAME) $(libdir)/libavcodec-$(VERSION)$(SLIBSUF)
480         ln -sf libavcodec-$(VERSION)$(SLIBSUF) $(libdir)/libavcodec$(SLIBSUF)
481         $(LDCONFIG) || true
482 endif
483 ifeq ($(CONFIG_PP),yes)
484         $(MAKE) -C libpostproc $@
485 endif
486 else
487 install:
488 endif
489
490 installlib: all install-headers
491         install -m 644 $(LIB) "$(libdir)"
492
493 install-headers:
494         mkdir -p "$(prefix)/include/ffmpeg"
495         install -m 644 $(SRC_PATH)/libavcodec/avcodec.h \
496                 "$(prefix)/include/ffmpeg"
497         install -d "$(libdir)/pkgconfig"
498         install -m 644 ../libavcodec.pc "$(libdir)/pkgconfig"
499
500 #
501 # include dependency files if they exist
502 #
503 ifneq ($(wildcard .depend),)
504 include .depend
505 endif