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