Separate library install into static and shared installation.
[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)/libavutil -I$(SRC_PATH)/libavcodec -DHAVE_AV_CONFIG_H -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE
10
11 #FIXME: This should be in configure/config.mak
12 ifeq ($(CONFIG_WIN32),yes)
13 LDFLAGS=-Wl,--output-def,$(@:.dll=.def),--out-implib,lib$(SLIBNAME:$(SLIBSUF)=.dll.a)
14 endif
15
16 OBJS= utils.o cutils.o os_support.o allformats.o
17 PPOBJS=
18
19 # demuxers
20 OBJS+=mpeg.o mpegts.o mpegtsenc.o ffm.o crc.o img.o img2.o raw.o rm.o \
21 avienc.o avidec.o wav.o mmf.o swf.o au.o gif.o mov.o mpjpeg.o dv.o \
22 yuv4mpeg.o 4xm.o flvdec.o psxstr.o idroq.o ipmovie.o \
23 nut.o wc3movie.o mp3.o westwood.o segafilm.o idcin.o flic.o \
24 sierravmd.o matroska.o sol.o electronicarts.o nsvdec.o asf.o \
25 ogg2.o oggparsevorbis.o oggparsetheora.o oggparseflac.o daud.o aiff.o \
26 voc.o
27
28 # muxers
29 ifeq ($(CONFIG_MUXERS),yes)
30 OBJS+= flvenc.o movenc.o asf-enc.o adtsenc.o
31 endif
32
33
34 AMROBJS=
35 ifeq ($(AMR_NB),yes)
36 AMROBJS= amr.o
37 endif
38 ifeq ($(AMR_NB_FIXED),yes)
39 AMROBJS= amr.o
40 endif
41 ifeq ($(AMR_WB),yes)
42 AMROBJS= amr.o
43 endif
44 OBJS+= $(AMROBJS)
45
46 # image formats
47 OBJS+= pnm.o yuv.o png.o jpeg.o gifdec.o sgi.o
48 OBJS+= framehook.o
49
50 ifeq ($(CONFIG_VIDEO4LINUX),yes)
51 OBJS+= grab.o
52 endif
53
54 ifeq ($(CONFIG_VIDEO4LINUX2),yes)
55 OBJS+= v4l2.o
56 endif
57
58 ifeq ($(CONFIG_BKTR),yes)
59 OBJS+= grab_bktr.o
60 endif
61
62 ifeq ($(CONFIG_DV1394),yes)
63 OBJS+= dv1394.o
64 endif
65
66 ifeq ($(CONFIG_DC1394),yes)
67 OBJS+= dc1394.o
68 endif
69
70 ifeq ($(CONFIG_AUDIO_OSS),yes)
71 OBJS+= audio.o
72 endif
73
74 EXTRALIBS += -L../libavutil -lavutil$(BUILDSUF)
75
76 ifeq ($(CONFIG_AUDIO_BEOS),yes)
77 PPOBJS+= beosaudio.o
78 endif
79
80 # protocols I/O
81 OBJS+= avio.o aviobuf.o
82
83 ifeq ($(CONFIG_PROTOCOLS),yes)
84 OBJS+= file.o
85 ifeq ($(CONFIG_NETWORK),yes)
86 OBJS+= udp.o tcp.o http.o rtsp.o rtp.o rtpproto.o
87 # BeOS and Darwin network stuff
88 ifeq ($(NEED_INET_ATON),yes)
89 OBJS+= barpainet.o
90 endif
91 endif
92 endif
93
94 ifeq ($(CONFIG_LIBOGG),yes)
95 OBJS+= ogg.o
96 endif
97
98 ifeq ($(TARGET_ARCH_SPARC64),yes)
99 CFLAGS+= -mcpu=ultrasparc -mtune=ultrasparc
100 endif
101
102 NAME=avformat
103 ifeq ($(BUILD_SHARED),yes)
104 LIBVERSION=$(LAVFVERSION)
105 LIBMAJOR=$(LAVFMAJOR)
106 AVCLIBS+=-lavcodec$(BUILDSUF) -L../libavcodec -lavutil$(BUILDSUF) -L../libavutil
107 endif
108
109 SRCS := $(OBJS:.o=.c) $(PPOBJS:.o=.cpp)
110
111 all: $(LIB) $(SLIBNAME)
112
113 $(LIB): $(OBJS) $(PPOBJS)
114 rm -f $@
115 $(AR) rc $@ $(OBJS) $(PPOBJS)
116 $(RANLIB) $@
117
118 $(SLIBNAME): $(OBJS)
119 $(CC) $(SHFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(PPOBJS) $(AVCLIBS) $(EXTRALIBS)
120 ifeq ($(CONFIG_WIN32),yes)
121 -lib /machine:i386 /def:$(@:.dll=.def)
122 endif
123
124 depend: $(SRCS)
125 $(CC) -MM $(CFLAGS) $^ 1>.depend
126
127
128 install-lib-shared: $(SLIBNAME)
129 ifeq ($(CONFIG_WIN32),yes)
130 install $(INSTALLSTRIP) -m 755 $(SLIBNAME) "$(prefix)"
131 else
132 install $(INSTALLSTRIP) -m 755 $(SLIBNAME) \
133 $(libdir)/$(SLIBNAME_WITH_VERSION)
134 ln -sf $(SLIBNAME_WITH_VERSION) \
135 $(libdir)/$(SLIBNAME_WITH_MAJOR)
136 ln -sf $(SLIBNAME_WITH_VERSION) \
137 $(libdir)/$(SLIBNAME)
138 endif
139
140 install-lib-static: $(LIB)
141 install -m 644 $(LIB) "$(libdir)"
142
143 install-headers:
144 mkdir -p "$(prefix)/include/ffmpeg"
145 install -m 644 $(SRC_PATH)/libavformat/avformat.h $(SRC_PATH)/libavformat/avio.h \
146 $(SRC_PATH)/libavformat/rtp.h $(SRC_PATH)/libavformat/rtsp.h \
147 $(SRC_PATH)/libavformat/rtspcodes.h \
148 "$(prefix)/include/ffmpeg"
149 install -d "$(libdir)/pkgconfig"
150 install -m 644 ../libavformat.pc "$(libdir)/pkgconfig"
151
152 %.o: %.c
153 $(CC) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $<
154
155 # BeOS: remove -Wall to get rid of all the "multibyte constant" warnings
156 %.o: %.cpp
157 g++ $(subst -Wall,,$(CFLAGS)) -c -o $@ $<
158
159 clean:
160 rm -f *.o *.d *~ *.a *.lib *.so *.dylib *.dll \
161 *.lib *.def *.dll.a *.exp
162
163 distclean: clean
164 rm -f .depend
165
166 #
167 # include dependency files if they exist
168 #
169 ifneq ($(wildcard .depend),)
170 include .depend
171 endif