42a26fe070ad7f124a70c1d90e894ed82ca3cd1f
[libav.git] / libavformat / Makefile
1 #
2 # libavformat Makefile
3 # (c) 2000-2003 Fabrice Bellard
4 #
5 include ../config.mak
6
7 VPATH=$(SRC_PATH)/libavformat
8
9 CFLAGS=$(OPTFLAGS) -I.. -I$(SRC_PATH) -I$(SRC_PATH)/libavcodec -DHAVE_AV_CONFIG_H -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE
10
11 OBJS= utils.o cutils.o os_support.o allformats.o
12 PPOBJS=
13
14 # mux and demuxes
15 OBJS+=mpeg.o mpegts.o mpegtsenc.o ffm.o crc.o img.o img2.o raw.o rm.o \
16 avienc.o avidec.o wav.o swf.o au.o gif.o mov.o mpjpeg.o dv.o \
17 yuv4mpeg.o 4xm.o flvenc.o flvdec.o movenc.o psxstr.o idroq.o ipmovie.o \
18 nut.o wc3movie.o mp3.o westwood.o segafilm.o idcin.o flic.o \
19 sierravmd.o matroska.o sol.o electronicarts.o nsvdec.o asf.o asf-enc.o \
20 ogg2.o oggparsevorbis.o oggparsetheora.o oggparseflac.o
21 AMROBJS=
22 ifeq ($(AMR_NB),yes)
23 AMROBJS= amr.o
24 endif
25 ifeq ($(AMR_NB_FIXED),yes)
26 AMROBJS= amr.o
27 endif
28 ifeq ($(AMR_WB),yes)
29 AMROBJS= amr.o
30 endif
31 OBJS+= $(AMROBJS)
32
33 # image formats
34 OBJS+= pnm.o yuv.o png.o jpeg.o gifdec.o sgi.o
35 # file I/O
36 OBJS+= avio.o aviobuf.o file.o
37 OBJS+= framehook.o
38
39 ifeq ($(CONFIG_VIDEO4LINUX),yes)
40 OBJS+= grab.o
41 endif
42
43 ifeq ($(CONFIG_BKTR),yes)
44 OBJS+= grab_bktr.o
45 endif
46
47 ifeq ($(CONFIG_DV1394),yes)
48 OBJS+= dv1394.o
49 endif
50
51 ifeq ($(CONFIG_DC1394),yes)
52 OBJS+= dc1394.o
53 endif
54
55 ifeq ($(CONFIG_AUDIO_OSS),yes)
56 OBJS+= audio.o
57 endif
58
59 ifeq ($(CONFIG_AUDIO_BEOS),yes)
60 PPOBJS+= beosaudio.o
61 EXTRALIBS+=-lbe -lmedia
62 endif
63
64 ifeq ($(CONFIG_NETWORK),yes)
65 OBJS+= udp.o tcp.o http.o rtsp.o rtp.o rtpproto.o
66 # BeOS and Darwin network stuff
67 ifeq ($(NEED_INET_ATON),yes)
68 OBJS+= barpainet.o
69 endif
70 endif
71
72 ifeq ($(CONFIG_LIBOGG),yes)
73 OBJS+= ogg.o
74 endif
75
76 ifeq ($(TARGET_ARCH_SPARC64),yes)
77 CFLAGS+= -mcpu=ultrasparc -mtune=ultrasparc
78 endif
79
80 LIB= $(LIBPREF)avformat$(LIBSUF)
81 ifeq ($(BUILD_SHARED),yes)
82 SLIB= $(SLIBPREF)avformat$(SLIBSUF)
83
84 AVCLIBS+=-lavcodec$(BUILDSUF) -L../libavcodec
85 ifeq ($(CONFIG_MP3LAME),yes)
86 AVCLIBS+=-lmp3lame
87 endif
88 endif
89
90 SRCS := $(OBJS:.o=.c) $(PPOBJS:.o=.cpp)
91
92 all: $(LIB) $(SLIB)
93
94 $(LIB): $(OBJS) $(PPOBJS)
95 rm -f $@
96 $(AR) rc $@ $(OBJS) $(PPOBJS)
97 $(RANLIB) $@
98
99 $(SLIB): $(OBJS)
100 ifeq ($(CONFIG_WIN32),yes)
101 $(CC) $(SHFLAGS) -Wl,--output-def,$(@:.dll=.def) -o $@ $(OBJS) $(PPOBJS) $(AVCLIBS) $(EXTRALIBS)
102 -lib /machine:i386 /def:$(@:.dll=.def)
103 else
104 $(CC) $(SHFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(PPOBJS) $(AVCLIBS) $(EXTRALIBS)
105 endif
106
107 depend: $(SRCS)
108 $(CC) -MM $(CFLAGS) $^ 1>.depend
109
110 ifeq ($(BUILD_SHARED),yes)
111 install: all install-headers
112 ifeq ($(CONFIG_WIN32),yes)
113 install $(INSTALLSTRIP) -m 755 $(SLIB) "$(prefix)"
114 else
115 install -d $(libdir)
116 install $(INSTALLSTRIP) -m 755 $(SLIB) $(libdir)/libavformat-$(VERSION).so
117 ln -sf libavformat-$(VERSION).so $(libdir)/libavformat.so
118 $(LDCONFIG) || true
119 endif
120 else
121 install:
122 endif
123
124 installlib: all install-headers
125 install -m 644 $(LIB) "$(libdir)"
126
127 install-headers:
128 mkdir -p "$(prefix)/include/ffmpeg"
129 install -m 644 $(SRC_PATH)/libavformat/avformat.h $(SRC_PATH)/libavformat/avio.h \
130 $(SRC_PATH)/libavformat/rtp.h $(SRC_PATH)/libavformat/rtsp.h \
131 $(SRC_PATH)/libavformat/rtspcodes.h \
132 "$(prefix)/include/ffmpeg"
133 install -d $(libdir)/pkgconfig
134 install -m 644 ../libavformat.pc $(libdir)/pkgconfig
135
136 %.o: %.c
137 $(CC) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $<
138
139 # BeOS: remove -Wall to get rid of all the "multibyte constant" warnings
140 %.o: %.cpp
141 g++ $(subst -Wall,,$(CFLAGS)) -c -o $@ $<
142
143 distclean clean:
144 rm -f *.o *.d .depend *~ *.a *.so $(LIB)
145
146 #
147 # include dependency files if they exist
148 #
149 ifneq ($(wildcard .depend),)
150 include .depend
151 endif