]> git.sesse.net Git - vlc/blob - Makefile
Elementary Stream input plugin (use it with --input es). Only works with
[vlc] / Makefile
1 ###############################################################################
2 # vlc (VideoLAN Client) main Makefile - (c)1998 VideoLAN
3 ###############################################################################
4
5 -include Makefile.opts
6
7 ###############################################################################
8 # Objects and files
9 ###############################################################################
10
11
12 # All possible plugin directories, needed for make clean
13 #
14 PLUGINS_DIR :=  alsa beos darwin directx dsp dummy dvd esd fb ggi glide gtk downmix idct imdct macosx mga motion mpeg qt sdl text x11 yuv
15
16 #
17 # All possible plugin objects
18 #
19 PLUGINS_TARGETS := alsa/alsa beos/beos darwin/darwin directx/directx dsp/dsp dummy/dummy dummy/null dvd/dvd esd/esd fb/fb ggi/ggi glide/glide gtk/gnome gtk/gtk downmix/downmix downmix/downmixsse downmix/downmix3dn idct/idct idct/idctclassic idct/idctmmx idct/idctmmxext imdct/imdct imdct/imdct3dn imdct/imdctsse macosx/macosx mga/mga motion/motion motion/motionmmx motion/motionmmxext mpeg/es mpeg/ps mpeg/ts qt/qt sdl/sdl text/ncurses text/rc x11/x11 x11/xvideo yuv/yuv yuv/yuvmmx
20
21 #
22 # C Objects
23
24 INTERFACE := main interface intf_msg intf_playlist intf_channels
25 INPUT := input input_ext-dec input_ext-intf input_dec input_programs input_netlist input_clock mpeg_system
26 VIDEO_OUTPUT := video_output video_text video_spu video_yuv
27 AUDIO_OUTPUT := audio_output aout_ext-dec aout_u8 aout_s8 aout_u16 aout_s16 aout_spdif
28 AC3_DECODER := ac3_decoder_thread ac3_decoder ac3_parse ac3_exponent ac3_bit_allocate ac3_mantissa ac3_rematrix ac3_imdct
29 AC3_SPDIF := ac3_spdif ac3_iec958
30 LPCM_DECODER := lpcm_decoder_thread
31 AUDIO_DECODER := audio_decoder adec_generic adec_layer1 adec_layer2 adec_math
32 SPU_DECODER := spu_decoder
33 #GEN_DECODER := generic_decoder
34 VIDEO_PARSER := video_parser vpar_headers vpar_blocks vpar_synchro video_fifo
35 VIDEO_DECODER := video_decoder
36 MISC := mtime tests modules netutils
37
38 C_OBJ :=        $(INTERFACE:%=src/interface/%.o) \
39                 $(INPUT:%=src/input/%.o) \
40                 $(VIDEO_OUTPUT:%=src/video_output/%.o) \
41                 $(AUDIO_OUTPUT:%=src/audio_output/%.o) \
42                 $(AC3_DECODER:%=src/ac3_decoder/%.o) \
43                 $(AC3_SPDIF:%=src/ac3_spdif/%.o) \
44                 $(LPCM_DECODER:%=src/lpcm_decoder/%.o) \
45                 $(AUDIO_DECODER:%=src/audio_decoder/%.o) \
46                 $(SPU_DECODER:%=src/spu_decoder/%.o) \
47                 $(GEN_DECODER:%=src/generic_decoder/%.o) \
48                 $(VIDEO_PARSER:%=src/video_parser/%.o) \
49                 $(VIDEO_DECODER:%=src/video_decoder/%.o) \
50                 $(MISC:%=src/misc/%.o)
51
52 #
53 # Misc Objects
54
55 ifeq ($(GETOPT),1)
56 C_OBJ += extras/GNUgetopt/getopt.o extras/GNUgetopt/getopt1.o 
57 endif
58
59 ifeq ($(SYS),beos)
60 CPP_OBJ :=      src/misc/beos_specific.o
61 endif
62
63 ifneq (,$(findstring darwin,$(SYS)))
64 C_OBJ +=        src/misc/darwin_specific.o
65 endif
66
67 ifneq (,$(findstring mingw32,$(SYS)))
68 RESOURCE_OBJ := share/vlc_win32_rc.o
69 endif
70
71 #
72 # Generated header
73 #
74 H_OBJ :=        src/misc/modules_builtin.h
75
76 #
77 # Other lists of files
78 #
79 C_DEP := $(C_OBJ:%.o=.dep/%.d)
80 CPP_DEP := $(CPP_OBJ:%.o=.dep/%.dpp)
81
82 #
83 # Translate plugin names
84 #
85 ifneq (,$(PLUGINS))
86 PLUGIN_OBJ := $(shell for i in $(PLUGINS) ; do echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.*/\('$$i'\) .*@lib/\1.so@' -e 's@^ .*@@' ; done)
87 endif
88 ifneq (,$(BUILTINS))
89 BUILTIN_OBJ := $(shell for i in $(BUILTINS) ; do echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.*/\('$$i'\) .*@lib/\1.a@' -e 's@^ .*@@' ; done)
90 endif
91
92 # All symbols must be exported
93 export
94
95 ###############################################################################
96 # Targets
97 ###############################################################################
98
99 #
100 # Virtual targets
101 #
102 all: vlc ${ALIASES} plugins vlc.app
103
104 clean: libdvdcss-clean plugins-clean vlc-clean
105         rm -f src/*/*.o extras/*/*.o
106         rm -f lib/*.so lib/*.so.* lib/*.a
107
108 libdvdcss-clean:
109         cd extras/libdvdcss && $(MAKE) clean
110
111 plugins-clean:
112         for dir in $(PLUGINS_DIR) ; do \
113                 ( cd plugins/$${dir} && $(MAKE) clean ) ; done
114         rm -f plugins/*/*.o plugins/*/*.moc plugins/*/*.bak
115
116 vlc-clean:
117         rm -f $(C_OBJ) $(CPP_OBJ)
118         rm -f vlc gnome-vlc gvlc kvlc qvlc
119         rm -Rf vlc.app
120
121 distclean: clean
122         rm -f **/*.o **/*~ *.log
123         rm -f Makefile.opts
124         rm -f include/defs.h include/config.h include/modules_builtin.h
125         rm -f src/misc/modules_builtin.h
126         rm -f config*status config*cache config*log
127         rm -f gmon.out core build-stamp
128         rm -Rf .dep
129         rm -f .gdb_history
130
131 install: libdvdcss-install vlc-install plugins-install
132
133 vlc-install:
134         mkdir -p $(DESTDIR)$(bindir)
135         $(INSTALL) vlc $(DESTDIR)$(bindir)
136 ifneq (,$(ALIASES))
137         for alias in $(ALIASES) ; do if test $$alias ; then rm -f $(DESTDIR)$(bindir)/$$alias && ln -s vlc $(DESTDIR)$(bindir)/$$alias ; fi ; done
138 endif
139         mkdir -p $(DESTDIR)$(datadir)/videolan
140         $(INSTALL) -m 644 share/*.psf $(DESTDIR)$(datadir)/videolan
141         $(INSTALL) -m 644 share/*.png $(DESTDIR)$(datadir)/videolan
142         $(INSTALL) -m 644 share/*.xpm $(DESTDIR)$(datadir)/videolan
143
144 plugins-install:
145         mkdir -p $(DESTDIR)$(libdir)/videolan/vlc
146 ifneq (,$(PLUGINS))
147         $(INSTALL) -m 644 $(PLUGINS:%=lib/%.so) $(DESTDIR)$(libdir)/videolan/vlc
148 endif
149
150 libdvdcss-install:
151         cd extras/libdvdcss && $(MAKE) install
152
153 show:
154         @echo CC: $(CC)
155         @echo CFLAGS: $(CFLAGS)
156         @echo DCFLAGS: $(DCFLAGS)
157         @echo LCFLAGS: $(LCFLAGS)
158         @echo C_OBJ: $(C_OBJ)
159         @echo CPP_OBJ: $(CPP_OBJ)
160         @echo objects: $(objects)
161         @echo cppobjects: $(cppobjects)
162         @echo PLUGIN_OBJ: $(PLUGIN_OBJ)
163         @echo BUILTIN_OBJ: $(BUILTIN_OBJ)
164
165
166 # ugliest of all, but I have no time to do it -- sam
167 snapshot: clean Makefile.opts
168         rm -Rf /tmp/vlc-${PROGRAM_VERSION}* /tmp/vlc-${PROGRAM_VERSION}nocss*
169         # copy archive in /tmp
170         find -type d | grep -v CVS | grep -v '\.dep' | while read i ; \
171                 do mkdir -p /tmp/vlc-${PROGRAM_VERSION}/$$i ; \
172         done
173         find debian -mindepth 1 -maxdepth 1 -type d | \
174                 while read i ; do rm -Rf /tmp/vlc-${PROGRAM_VERSION}/$$i ; done
175         # .c .h .in .cpp .glade
176         find include src plugins -type f -name '*.[chig]*' | while read i ; \
177                 do cp $$i /tmp/vlc-${PROGRAM_VERSION}/$$i ; done
178         # Makefiles
179         find . plugins -type f -name Makefile | while read i ; \
180                 do cp $$i /tmp/vlc-${PROGRAM_VERSION}/$$i ; done
181         # extra files
182         cp -a extras/* /tmp/vlc-${PROGRAM_VERSION}/extras
183         cp -a doc/* /tmp/vlc-${PROGRAM_VERSION}/doc
184         find /tmp/vlc-${PROGRAM_VERSION}/extras \
185                 /tmp/vlc-${PROGRAM_VERSION}/doc \
186                 -type d -name CVS | while read i ; \
187                         do rm -Rf $$i ; \
188                 done
189         # copy misc files
190         cp vlc.spec AUTHORS COPYING ChangeLog INSTALL INSTALL.libdvdcss \
191                 README TODO todo.pl \
192                 Makefile.opts.in Makefile.dep Makefile.modules \
193                 configure configure.in install-sh config.sub config.guess \
194                         /tmp/vlc-${PROGRAM_VERSION}/
195         for file in control control-css vlc-gtk.menu vlc.copyright vlc.docs \
196                 changelog changelog-css rules rules-css vlc.dirs vlc.desktop \
197                 gvlc.desktop gnome-vlc.desktop vlc.menu ; do \
198                         cp debian/$$file /tmp/vlc-${PROGRAM_VERSION}/debian/ ; \
199                 done
200         for file in default8x16.psf default8x9.psf vlc_beos.rsrc vlc.icns ; do \
201                 cp share/$$file /tmp/vlc-${PROGRAM_VERSION}/share/ ; done
202         for icon in vlc gvlc qvlc gnome-vlc kvlc ; do \
203                 cp share/$$icon.xpm share/$$icon.png \
204                         /tmp/vlc-${PROGRAM_VERSION}/share/ ; done
205
206         # build css-enabled archives
207         (cd /tmp ; tar cf vlc-${PROGRAM_VERSION}.tar vlc-${PROGRAM_VERSION} ; \
208                 bzip2 -f -9 < vlc-${PROGRAM_VERSION}.tar \
209                         > vlc-${PROGRAM_VERSION}.tar.bz2 ; \
210                 gzip -f -9 vlc-${PROGRAM_VERSION}.tar )
211         mv /tmp/vlc-${PROGRAM_VERSION}.tar.gz \
212                 /tmp/vlc-${PROGRAM_VERSION}.tar.bz2 ..
213
214         # clean up
215         rm -Rf /tmp/vlc-${PROGRAM_VERSION}*
216
217 libdvdcss-snapshot: clean Makefile.opts
218         rm -Rf /tmp/libdvdcss-${LIBDVDCSS_VERSION}* \
219                 /tmp/libdvdcss-${LIBDVDCSS_VERSION}nocss*
220         # copy archive in /tmp
221         find include extras doc lib -type d | grep -v CVS | grep -v '\.dep' | \
222                 while read i ; do \
223                         mkdir -p /tmp/libdvdcss-${LIBDVDCSS_VERSION}/$$i ; \
224                 done
225         # .c .h .in .cpp .glade
226         find include extras -type f -name '*.[chig]*' | while read i ; \
227                 do cp $$i /tmp/libdvdcss-${LIBDVDCSS_VERSION}/$$i ; done
228         # Makefiles
229         sed -e 's#^install:#install-unused:#' \
230                 -e 's#^clean:#clean-unused:#' \
231                 -e 's#^all:.*#all: libdvdcss#' \
232                 -e 's#^libdvdcss-install:#install:#' \
233                 -e 's#^libdvdcss-clean:#clean:#' \
234                 < Makefile > /tmp/libdvdcss-${LIBDVDCSS_VERSION}/Makefile
235         # extra files
236         cp -a extras/* /tmp/libdvdcss-${LIBDVDCSS_VERSION}/extras
237         cp -a doc/* /tmp/libdvdcss-${LIBDVDCSS_VERSION}/doc
238         find /tmp/libdvdcss-${LIBDVDCSS_VERSION}/extras \
239                 /tmp/libdvdcss-${LIBDVDCSS_VERSION}/doc \
240                 -type d -name CVS | while read i ; \
241                         do rm -Rf $$i ; \
242                 done
243         # copy misc files
244         cp AUTHORS COPYING ChangeLog INSTALL INSTALL.libdvdcss README \
245                 TODO todo.pl Makefile.opts.in Makefile.dep Makefile.modules \
246                 configure configure.in install-sh config.sub config.guess \
247                         /tmp/libdvdcss-${LIBDVDCSS_VERSION}/
248
249         # build css-enabled archives
250         (cd /tmp ; tar cf libdvdcss-${LIBDVDCSS_VERSION}.tar \
251                 libdvdcss-${LIBDVDCSS_VERSION} ; \
252                 bzip2 -f -9 < libdvdcss-${LIBDVDCSS_VERSION}.tar \
253                         > libdvdcss-${LIBDVDCSS_VERSION}.tar.bz2 ; \
254                 gzip -f -9 libdvdcss-${LIBDVDCSS_VERSION}.tar )
255         mv /tmp/libdvdcss-${LIBDVDCSS_VERSION}.tar.gz \
256                 /tmp/libdvdcss-${LIBDVDCSS_VERSION}.tar.bz2 ..
257
258         # clean up
259         rm -Rf /tmp/libdvdcss-${LIBDVDCSS_VERSION}*
260
261 .PHONY: vlc.app
262 vlc.app:
263 ifneq (,$(findstring darwin,$(SYS)))
264         rm -Rf vlc.app
265         mkdir -p vlc.app/Contents/Resources
266         mkdir -p vlc.app/Contents/MacOS/lib
267         mkdir -p vlc.app/Contents/MacOS/share
268         $(INSTALL) -m 644 extras/MacOSX_app/Contents/Info.plist vlc.app/Contents/
269         $(INSTALL) -m 644 extras/MacOSX_app/Contents/PkgInfo vlc.app/Contents/
270         $(INSTALL) vlc vlc.app/Contents/MacOS/
271         $(INSTALL) share/vlc.icns vlc.app/Contents/Resources/
272 ifneq (,$(PLUGINS))
273         $(INSTALL) $(PLUGINS:%=lib/%.so) vlc.app/Contents/MacOS/lib
274 endif
275         $(INSTALL) -m 644 share/*.psf vlc.app/Contents/MacOS/share
276 endif
277
278 FORCE:
279
280 #
281 # GTK/Gnome aliases - don't add too many aliases which could bloat
282 # the namespace
283 #
284 gnome-vlc gvlc kvlc qvlc: vlc
285         rm -f $@ && ln -s vlc $@
286
287 #
288 # Generic rules (see below)
289 #
290 $(C_DEP): %.d: FORCE
291         @$(MAKE) -s --no-print-directory -f Makefile.dep $@
292
293 $(CPP_DEP): %.dpp: FORCE
294         @$(MAKE) -s --no-print-directory -f Makefile.dep $@
295
296 $(H_OBJ): Makefile.opts Makefile.dep Makefile
297         rm -f $@ && cp $@.in $@
298 ifneq (,$(BUILTINS))
299         for i in $(BUILTINS) ; do \
300                 echo "int module_"$$i"_InitModule( module_t* );" >> $@ ; \
301                 echo "int module_"$$i"_ActivateModule( module_t* );" >> $@ ; \
302                 echo "int module_"$$i"_DeactivateModule( module_t* );" >> $@ ; \
303         done
304 endif
305 ifneq (,$(BUILTINS))
306         echo "" >> $@ ;
307         printf "#define ALLOCATE_ALL_BUILTINS() do { " >> $@ ;
308         for i in $(BUILTINS) ; do \
309                 printf "ALLOCATE_BUILTIN("$$i"); " >> $@ ; \
310         done
311         echo "} while( 0 );" >> $@ ;
312 endif
313         echo "" >> $@ ;
314
315 $(C_OBJ): %.o: Makefile.opts Makefile.dep Makefile
316 $(C_OBJ): %.o: .dep/%.d
317 $(C_OBJ): %.o: %.c
318         $(CC) $(CFLAGS) -c -o $@ $<
319
320 $(CPP_OBJ): %.o: Makefile.opts Makefile.dep Makefile
321 $(CPP_OBJ): %.o: .dep/%.dpp
322 $(CPP_OBJ): %.o: %.cpp
323         $(CC) $(CFLAGS) -c -o $@ $<
324
325 $(RESOURCE_OBJ): %.o: Makefile.dep Makefile
326 ifneq (,(findstring mingw32,$(SYS)))
327 $(RESOURCE_OBJ): %.o: %.rc
328         $(WINDRES) -i $< -o $@
329 endif
330
331 #
332 # Main application target
333 #
334 vlc: Makefile.opts Makefile.dep Makefile $(H_OBJ) $(C_OBJ) $(CPP_OBJ) $(BUILTIN_OBJ) $(RESOURCE_OBJ)
335         $(CC) $(CFLAGS) -o $@ $(C_OBJ) $(CPP_OBJ) $(BUILTIN_OBJ) $(RESOURCE_OBJ) $(LCFLAGS) $(LIB)
336 ifeq ($(SYS),beos)
337         xres -o $@ ./share/vlc_beos.rsrc
338         mimeset -f $@
339 endif
340
341 #
342 # Plugins target
343 #
344 plugins: Makefile.modules Makefile.opts Makefile.dep Makefile $(PLUGIN_OBJ)
345 $(PLUGIN_OBJ): FORCE
346         cd $(shell echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.* \([^/]*/\)'$(@:lib/%.so=%)' .*@plugins/\1@' -e 's@^ .*@@') && $(MAKE) $(@:%=../../%)
347
348 #
349 # Built-in modules target
350 #
351 builtins: Makefile.modules Makefile.opts Makefile.dep Makefile $(BUILTIN_OBJ)
352 $(BUILTIN_OBJ): FORCE
353         cd $(shell echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.* \([^/]*/\)'$(@:lib/%.a=%)' .*@plugins/\1@' -e 's@^ .*@@') && $(MAKE) $(@:%=../../%)
354
355 #
356 # libdvdcss target
357 #
358 libdvdcss:
359         cd extras/libdvdcss && $(MAKE)
360