install libav(codec|format).pc/libpostproc.pc for pkg-config (original patch from...
[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_DV1394),yes)
44 OBJS+= dv1394.o
45 endif
46
47 ifeq ($(CONFIG_DC1394),yes)
48 OBJS+= dc1394.o
49 endif
50
51 ifeq ($(CONFIG_AUDIO_OSS),yes)
52 OBJS+= audio.o
53 endif
54
55 ifeq ($(CONFIG_AUDIO_BEOS),yes)
56 PPOBJS+= beosaudio.o
57 EXTRALIBS+=-lbe -lmedia
58 endif
59
60 ifeq ($(CONFIG_NETWORK),yes)
61 OBJS+= udp.o tcp.o http.o rtsp.o rtp.o rtpproto.o
62 # BeOS and Darwin network stuff
63 ifeq ($(NEED_INET_ATON),yes)
64 OBJS+= barpainet.o
65 endif
66 endif
67
68 ifeq ($(CONFIG_LIBOGG),yes)
69 OBJS+= ogg.o
70 endif
71
72 ifeq ($(TARGET_ARCH_SPARC64),yes)
73 CFLAGS+= -mcpu=ultrasparc -mtune=ultrasparc
74 endif
75
76 LIB= $(LIBPREF)avformat$(LIBSUF)
77 ifeq ($(BUILD_SHARED),yes)
78 SLIB= $(SLIBPREF)avformat$(SLIBSUF)
79
80 AVCLIBS+=-lavcodec$(BUILDSUF) -L../libavcodec
81 ifeq ($(CONFIG_MP3LAME),yes)
82 AVCLIBS+=-lmp3lame
83 endif
84 endif
85
86 SRCS := $(OBJS:.o=.c) $(PPOBJS:.o=.cpp)
87
88 all: $(LIB) $(SLIB)
89
90 $(LIB): $(OBJS) $(PPOBJS)
91 rm -f $@
92 $(AR) rc $@ $(OBJS) $(PPOBJS)
93 $(RANLIB) $@
94
95 $(SLIB): $(OBJS)
96 ifeq ($(CONFIG_WIN32),yes)
97 $(CC) $(SHFLAGS) -Wl,--output-def,$(@:.dll=.def) -o $@ $(OBJS) $(PPOBJS) $(AVCLIBS) $(EXTRALIBS)
98 -lib /machine:i386 /def:$(@:.dll=.def)
99 else
100 $(CC) $(SHFLAGS) -o $@ $(OBJS) $(PPOBJS) $(AVCLIBS) $(EXTRALIBS)
101 endif
102
103 depend: $(SRCS)
104 $(CC) -MM $(CFLAGS) $^ 1>.depend
105
106 ifeq ($(BUILD_SHARED),yes)
107 install: all install-headers
108 ifeq ($(CONFIG_WIN32),yes)
109 install $(INSTALLSTRIP) -m 755 $(SLIB) "$(prefix)"
110 else
111 install -d $(libdir)
112 install $(INSTALLSTRIP) -m 755 $(SLIB) $(libdir)/libavformat-$(VERSION).so
113 ln -sf libavformat-$(VERSION).so $(libdir)/libavformat.so
114 ldconfig || true
115 endif
116 else
117 install:
118 endif
119
120 installlib: all install-headers
121 install -m 644 $(LIB) "$(libdir)"
122
123 install-headers:
124 mkdir -p "$(prefix)/include/ffmpeg"
125 install -m 644 $(SRC_PATH)/libavformat/avformat.h $(SRC_PATH)/libavformat/avio.h \
126 $(SRC_PATH)/libavformat/rtp.h $(SRC_PATH)/libavformat/rtsp.h \
127 $(SRC_PATH)/libavformat/rtspcodes.h \
128 "$(prefix)/include/ffmpeg"
129 install -d $(libdir)/pkgconfig
130 install -m 644 ../libavformat.pc $(libdir)/pkgconfig
131
132 %.o: %.c
133 $(CC) $(CFLAGS) -c -o $@ $<
134
135 # BeOS: remove -Wall to get rid of all the "multibyte constant" warnings
136 %.o: %.cpp
137 g++ $(subst -Wall,,$(CFLAGS)) -c -o $@ $<
138
139 distclean clean:
140 rm -f *.o *.d .depend *~ *.a *.so $(LIB)
141
142 #
143 # include dependency files if they exist
144 #
145 ifneq ($(wildcard .depend),)
146 include .depend
147 endif