Makefile 6.7 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= common.o utils.o mem.o allcodecs.o \
M
Michael Niedermayer 已提交
13
      mpegvideo.o jrevdct.o jfdctfst.o jfdctint.o\
14
      mpegaudio.o ac3enc.o mjpeg.o resample.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
24 25

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

37 38 39 40
ifeq ($(HAVE_PTHREADS),yes)
OBJS+= pthread.o
endif

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

45 46 47 48 49 50 51 52 53
ifeq ($(AMR_WB),yes)
OBJS+= amr.o amrwb_float/dec_acelp.o amrwb_float/dec_dtx.o amrwb_float/dec_gain.o \
		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
CLEANAMRWB=cleanamrwbfloat
54
ASM_OBJS=
F
Fabrice Bellard 已提交
55

M
Michael Niedermayer 已提交
56 57
# codecs which are patented in some non free countries like the us
ifeq ($(CONFIG_RISKY),yes)
58
OBJS+= h263.o msmpeg4.o h263dec.o svq1.o rv10.o wmadec.o indeo3.o
M
Michael Niedermayer 已提交
59 60
endif

61 62 63 64
ifeq ($(HAVE_XVMC_ACCEL),yes)
OBJS+= xvmcvideo.o
endif

Z
Zdenek Kabelac 已提交
65
# currently using liba52 for ac3 decoding
66
ifeq ($(CONFIG_AC3),yes)
Z
Zdenek Kabelac 已提交
67 68 69
OBJS+= a52dec.o

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

76 77
ifeq ($(CONFIG_FAAD),yes)
OBJS+= faad.o
Z
Zdenek Kabelac 已提交
78 79 80 81 82
ifeq ($(CONFIG_FAADBIN),yes)
# no libs needed
else
EXTRALIBS += -lfaad
endif
83 84
endif

85 86 87 88 89
ifeq ($(CONFIG_FAAC),yes)
OBJS+= faac.o
EXTRALIBS += -lfaac
endif

90 91 92 93 94 95 96 97 98
ifeq ($(CONFIG_PP),yes)
ifeq ($(SHARED_PP),yes)
EXTRALIBS += -lpostproc
else
# LIBS += libpostproc/libpostproc.a ... should be fixed
OBJS += libpostproc/postprocess.o
endif
endif

99 100
ifeq ($(CONFIG_MP3LAME),yes)
OBJS += mp3lameaudio.o
Z
Zdenek Kabelac 已提交
101
EXTRALIBS += -lmp3lame
102 103
endif

104 105 106 107 108
ifeq ($(CONFIG_VORBIS),yes)
OBJS += oggvorbis.o
EXTRALIBS += -lvorbis -lvorbisenc
endif

109 110 111 112 113
ifeq ($(TARGET_GPROF),yes)
CFLAGS+=-p
LDFLAGS+=-p
endif

F
Fabrice Bellard 已提交
114
# i386 mmx specific stuff
115
ifeq ($(TARGET_MMX),yes)
F
Fabrice Bellard 已提交
116
OBJS += i386/fdct_mmx.o i386/cputest.o \
F
Fabrice Bellard 已提交
117
	i386/dsputil_mmx.o i386/mpegvideo_mmx.o \
Z
Zdenek Kabelac 已提交
118
	i386/idct_mmx.o i386/motion_est_mmx.o \
119
	i386/simple_idct_mmx.o i386/fft_sse.o i386/vp3dsp_mmx.o
120 121 122
ifdef TARGET_BUILTIN_VECTOR
i386/fft_sse.o: CFLAGS+= -msse
endif
F
Fabrice Bellard 已提交
123 124
endif

F
Fabrice Bellard 已提交
125 126
# armv4l specific stuff
ifeq ($(TARGET_ARCH_ARMV4L),yes)
127
ASM_OBJS += armv4l/jrevdct_arm.o armv4l/simple_idct_arm.o
128
OBJS += armv4l/dsputil_arm.o armv4l/mpegvideo_arm.o
F
Fabrice Bellard 已提交
129 130
endif

F
Fabrice Bellard 已提交
131 132 133 134 135 136 137
# 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

138 139
# alpha specific stuff
ifeq ($(TARGET_ARCH_ALPHA),yes)
140 141
OBJS += alpha/dsputil_alpha.o alpha/mpegvideo_alpha.o \
	alpha/simple_idct_alpha.o alpha/motion_est_alpha.o
142
ASM_OBJS += alpha/dsputil_alpha_asm.o alpha/motion_est_mvi_asm.o
143
CFLAGS += -fforce-addr -freduce-all-givs
144 145
endif

146
ifeq ($(TARGET_ARCH_POWERPC),yes)
147
OBJS += ppc/dsputil_ppc.o ppc/mpegvideo_ppc.o
148 149
endif

150
ifeq ($(TARGET_MMI),yes)
151
OBJS += ps2/dsputil_mmi.o ps2/idct_mmi.o ps2/mpegvideo_mmi.o
152 153
endif

154
ifeq ($(TARGET_ALTIVEC),yes)
155
OBJS += ppc/dsputil_altivec.o ppc/mpegvideo_altivec.o ppc/idct_altivec.o \
156
        ppc/fft_altivec.o ppc/gmc_altivec.o ppc/fdct_altivec.o
157 158
endif

159 160 161 162 163
ifeq ($(TARGET_ARCH_SH4),yes)
OBJS+= sh4/idct_sh4.o sh4/dsputil_sh4.o sh4/dsputil_align.o
endif


164
SRCS := $(OBJS:.o=.c) $(ASM_OBJS:.o=.S)
F
Fabrice Bellard 已提交
165
OBJS := $(OBJS) $(ASM_OBJS)
166

167
LIB= $(LIBPREF)avcodec$(LIBSUF)
N
Nick Kurshev 已提交
168
ifeq ($(BUILD_SHARED),yes)
169
SLIB= $(SLIBPREF)avcodec$(SLIBSUF)
N
Nick Kurshev 已提交
170
endif
171
TESTS= imgresample-test dct-test motion-test fft-test
F
Fabrice Bellard 已提交
172

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

Z
Zdenek Kabelac 已提交
175 176 177
amrlibs:
	$(MAKE) -C amr spclib fipoplib

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

Z
Zdenek Kabelac 已提交
180
$(LIB): $(OBJS) $(AMRLIBS)
F
Fabrice Bellard 已提交
181
	rm -f $@
Z
Zdenek Kabelac 已提交
182
	$(AR) rc $@ $(OBJS) $(AMREXTRALIBS)
M
Michael Niedermayer 已提交
183
	$(RANLIB) $@
F
Fabrice Bellard 已提交
184

185
$(SLIB): $(OBJS)
F
Fabrice Bellard 已提交
186 187 188 189
ifeq ($(CONFIG_WIN32),yes)
	$(CC) $(SHFLAGS) -Wl,--output-def,$(@:.dll=.def) -o $@ $(OBJS) $(EXTRALIBS) $(AMREXTRALIBS)
	-lib /machine:i386 /def:$(@:.dll=.def)
else
Z
Zdenek Kabelac 已提交
190
	$(CC) $(SHFLAGS) -o $@ $(OBJS) $(EXTRALIBS) $(AMREXTRALIBS)
F
Fabrice Bellard 已提交
191
endif
F
Fabrice Bellard 已提交
192 193 194

dsputil.o: dsputil.c dsputil.h

195 196 197
libpostproc/libpostproc.a:
	$(MAKE) -C libpostproc

F
Fabrice Bellard 已提交
198 199 200
%.o: %.c
	$(CC) $(CFLAGS) -c -o $@ $< 

F
Fabrice Bellard 已提交
201 202 203
%.o: %.S
	$(CC) $(CFLAGS) -c -o $@ $<

204
depend: $(SRCS)
205
	$(CC) -MM $(CFLAGS) $^ 1>.depend
206

207 208
dep:	depend

Z
Zdenek Kabelac 已提交
209
clean: $(CLEANAMR)
210
	rm -f *.o *.d *~ .depend $(LIB) $(SLIB) *.so i386/*.o i386/*~ \
F
Fabrice Bellard 已提交
211
	   armv4l/*.o armv4l/*~ \
F
Fabrice Bellard 已提交
212
	   mlib/*.o mlib/*~ \
213
	   alpha/*.o alpha/*~ \
214
	   ppc/*.o ppc/*~ \
215
	   ps2/*.o ps2/*~ \
216
	   sh4/*.o sh4/*~ \
Z
Zdenek Kabelac 已提交
217 218
	   liba52/*.o liba52/*~ \
	   apiexample $(TESTS)
Z
Zdenek Kabelac 已提交
219
	$(MAKE) -C libpostproc clean
F
Fabrice Bellard 已提交
220

221
distclean: clean
222 223
	rm -f Makefile.bak .depend

Z
Zdenek Kabelac 已提交
224 225 226 227 228 229
cleanamr:
	$(MAKE) -C amr clean

cleanamrfloat:
	rm -f amr_float/*.o

230 231 232
cleanamrwbfloat:
	$(MAKE) -C amrwb_float -f makefile.gcc clean

F
Fabrice Bellard 已提交
233 234
# api example program
apiexample: apiexample.c $(LIB)
M
Michael Niedermayer 已提交
235
	$(CC) $(CFLAGS) -o $@ $< $(LIB) $(EXTRALIBS) -lm
F
Fabrice Bellard 已提交
236

N
Nick Kurshev 已提交
237 238 239 240
# cpuid test
cpuid_test: i386/cputest.c
	$(CC) $(CFLAGS) -D__TEST__ -o $@ $<

F
Fabrice Bellard 已提交
241 242 243
# testing progs

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

F
Fabrice Bellard 已提交
246
dct-test: dct-test.o fdctref.o $(LIB)
247
	$(CC) -o $@ $^ -lm
248

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

252
fft-test: fft-test.o $(LIB)
253 254
	$(CC) -o $@ $^ -lm

N
Nick Kurshev 已提交
255
ifeq ($(BUILD_SHARED),yes)
F
Fabrice Bellard 已提交
256 257 258 259
install: all install-headers
ifeq ($(CONFIG_WIN32),yes)
	install -s -m 755 $(SLIB) "$(prefix)"
else
260
	install -d $(prefix)/lib
F
Fabrice Bellard 已提交
261
	install -s -m 755 $(SLIB) $(prefix)/lib/libavcodec-$(VERSION).so
262 263
	ln -sf libavcodec-$(VERSION).so $(prefix)/lib/libavcodec.so
	ldconfig || true
F
Fabrice Bellard 已提交
264 265 266
endif
else
install:
N
Nick Kurshev 已提交
267
endif
268

F
Fabrice Bellard 已提交
269
installlib: all install-headers
270
	install -m 644 $(LIB) $(prefix)/lib
F
Fabrice Bellard 已提交
271 272 273

install-headers:
	mkdir -p "$(prefix)/include/ffmpeg"
274 275 276
	install -m 644 $(SRC_PATH)/libavcodec/avcodec.h \
	               $(SRC_PATH)/libavcodec/common.h \
	               $(SRC_PATH)/libavcodec/rational.h \
F
Fabrice Bellard 已提交
277
                "$(prefix)/include/ffmpeg"
278

279 280 281 282 283 284
#
# include dependency files if they exist
#
ifneq ($(wildcard .depend),)
include .depend
endif