]> git.sesse.net Git - vlc/blob - Makefile
Reactivated SDL parachute in non-debug mode (memory leak otherwise).
[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 #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'\) .*@plugins/\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'\) .*@plugins/\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         rm -f plugins/*.so plugins/*.so.* plugins/*.a
108
109 libdvdcss-clean:
110         cd extras/libdvdcss && $(MAKE) clean
111
112 plugins-clean:
113         for dir in $(PLUGINS_DIR) ; do \
114                 ( cd plugins/$${dir} && $(MAKE) clean ) ; done
115         rm -f plugins/*/*.o plugins/*/*.moc plugins/*/*.bak
116
117 vlc-clean:
118         rm -f $(C_OBJ) $(CPP_OBJ)
119         rm -f vlc gnome-vlc gvlc kvlc qvlc
120         rm -Rf vlc.app
121
122 distclean: clean
123         rm -f **/*.o **/*~ *.log
124         rm -f Makefile.opts
125         rm -f include/defs.h include/config.h include/modules_builtin.h
126         rm -f src/misc/modules_builtin.h
127         rm -f config*status config*cache config*log
128         rm -f gmon.out core build-stamp
129         rm -Rf .dep
130         rm -f .gdb_history
131
132 install: libdvdcss-install vlc-install plugins-install
133
134 vlc-install:
135         mkdir -p $(DESTDIR)$(bindir)
136         $(INSTALL) vlc $(DESTDIR)$(bindir)
137 ifneq (,$(ALIASES))
138         for alias in $(ALIASES) ; do if test $$alias ; then rm -f $(DESTDIR)$(bindir)/$$alias && ln -s vlc $(DESTDIR)$(bindir)/$$alias ; fi ; done
139 endif
140         mkdir -p $(DESTDIR)$(datadir)/videolan
141         $(INSTALL) -m 644 share/*.psf $(DESTDIR)$(datadir)/videolan
142         $(INSTALL) -m 644 share/*.png $(DESTDIR)$(datadir)/videolan
143         $(INSTALL) -m 644 share/*.xpm $(DESTDIR)$(datadir)/videolan
144
145 plugins-install:
146         mkdir -p $(DESTDIR)$(libdir)/videolan/vlc
147 ifneq (,$(PLUGINS))
148         $(INSTALL) -m 644 $(PLUGINS:%=plugins/%.so) $(DESTDIR)$(libdir)/videolan/vlc
149 endif
150
151 libdvdcss-install:
152         cd extras/libdvdcss && $(MAKE) install
153
154 show:
155         @echo CC: $(CC)
156         @echo CFLAGS: $(CFLAGS)
157         @echo DCFLAGS: $(DCFLAGS)
158         @echo LCFLAGS: $(LCFLAGS)
159         @echo C_OBJ: $(C_OBJ)
160         @echo CPP_OBJ: $(CPP_OBJ)
161         @echo objects: $(objects)
162         @echo cppobjects: $(cppobjects)
163         @echo PLUGIN_OBJ: $(PLUGIN_OBJ)
164         @echo BUILTIN_OBJ: $(BUILTIN_OBJ)
165
166
167 # ugliest of all, but I have no time to do it -- sam
168 snapshot: clean Makefile.opts
169         rm -Rf /tmp/vlc-${PROGRAM_VERSION}* /tmp/vlc-${PROGRAM_VERSION}nocss*
170         # copy archive in /tmp
171         find -type d | grep -v CVS | grep -v '\.dep' | while read i ; \
172                 do mkdir -p /tmp/vlc-${PROGRAM_VERSION}/$$i ; \
173         done
174         find debian -mindepth 1 -maxdepth 1 -type d | \
175                 while read i ; do rm -Rf /tmp/vlc-${PROGRAM_VERSION}/$$i ; done
176         # .c .h .in .cpp .glade
177         find include src plugins -type f -name '*.[chig]*' | while read i ; \
178                 do cp $$i /tmp/vlc-${PROGRAM_VERSION}/$$i ; done
179         # Makefiles
180         find . plugins -type f -name Makefile | while read i ; \
181                 do cp $$i /tmp/vlc-${PROGRAM_VERSION}/$$i ; done
182         # extra files
183         cp -a extras/* /tmp/vlc-${PROGRAM_VERSION}/extras
184         cp -a doc/* /tmp/vlc-${PROGRAM_VERSION}/doc
185         find /tmp/vlc-${PROGRAM_VERSION}/extras \
186                 /tmp/vlc-${PROGRAM_VERSION}/doc \
187                 -type d -name CVS | while read i ; \
188                         do rm -Rf $$i ; \
189                 done
190         # copy misc files
191         cp vlc.spec AUTHORS COPYING ChangeLog INSTALL INSTALL.libdvdcss \
192                 README TODO todo.pl \
193                 Makefile.opts.in Makefile.dep Makefile.modules \
194                 configure configure.in install-sh config.sub config.guess \
195                         /tmp/vlc-${PROGRAM_VERSION}/
196         for file in control control-css vlc-gtk.menu vlc.copyright vlc.docs \
197                 changelog changelog-css rules rules-css vlc.dirs vlc.desktop \
198                 gvlc.desktop gnome-vlc.desktop vlc.menu ; do \
199                         cp debian/$$file /tmp/vlc-${PROGRAM_VERSION}/debian/ ; \
200                 done
201         for file in default8x16.psf default8x9.psf vlc_beos.rsrc vlc.icns ; do \
202                 cp share/$$file /tmp/vlc-${PROGRAM_VERSION}/share/ ; done
203         for icon in vlc gvlc qvlc gnome-vlc kvlc ; do \
204                 cp share/$$icon.xpm share/$$icon.png \
205                         /tmp/vlc-${PROGRAM_VERSION}/share/ ; done
206
207         # build css-enabled archives
208         (cd /tmp ; tar cf vlc-${PROGRAM_VERSION}.tar vlc-${PROGRAM_VERSION} ; \
209                 bzip2 -f -9 < vlc-${PROGRAM_VERSION}.tar \
210                         > vlc-${PROGRAM_VERSION}.tar.bz2 ; \
211                 gzip -f -9 vlc-${PROGRAM_VERSION}.tar )
212         mv /tmp/vlc-${PROGRAM_VERSION}.tar.gz \
213                 /tmp/vlc-${PROGRAM_VERSION}.tar.bz2 ..
214
215         # clean up
216         rm -Rf /tmp/vlc-${PROGRAM_VERSION}*
217
218 libdvdcss-snapshot: clean Makefile.opts
219         rm -Rf /tmp/libdvdcss-${LIBDVDCSS_VERSION}* \
220                 /tmp/libdvdcss-${LIBDVDCSS_VERSION}nocss*
221         # copy archive in /tmp
222         find include extras doc lib -type d | grep -v CVS | grep -v '\.dep' | \
223                 while read i ; do \
224                         mkdir -p /tmp/libdvdcss-${LIBDVDCSS_VERSION}/$$i ; \
225                 done
226         # .c .h .in .cpp .glade
227         find include extras -type f -name '*.[chig]*' | while read i ; \
228                 do cp $$i /tmp/libdvdcss-${LIBDVDCSS_VERSION}/$$i ; done
229         # Makefiles
230         sed -e 's#^install:#install-unused:#' \
231                 -e 's#^clean:#clean-unused:#' \
232                 -e 's#^all:.*#all: libdvdcss#' \
233                 -e 's#^libdvdcss-install:#install:#' \
234                 -e 's#^libdvdcss-clean:#clean:#' \
235                 < Makefile > /tmp/libdvdcss-${LIBDVDCSS_VERSION}/Makefile
236         # extra files
237         cp -a extras/* /tmp/libdvdcss-${LIBDVDCSS_VERSION}/extras
238         cp -a doc/* /tmp/libdvdcss-${LIBDVDCSS_VERSION}/doc
239         find /tmp/libdvdcss-${LIBDVDCSS_VERSION}/extras \
240                 /tmp/libdvdcss-${LIBDVDCSS_VERSION}/doc \
241                 -type d -name CVS | while read i ; \
242                         do rm -Rf $$i ; \
243                 done
244         # copy misc files
245         cp AUTHORS COPYING ChangeLog INSTALL INSTALL.libdvdcss README \
246                 TODO todo.pl Makefile.opts.in Makefile.dep Makefile.modules \
247                 configure configure.in install-sh config.sub config.guess \
248                         /tmp/libdvdcss-${LIBDVDCSS_VERSION}/
249
250         # build css-enabled archives
251         (cd /tmp ; tar cf libdvdcss-${LIBDVDCSS_VERSION}.tar \
252                 libdvdcss-${LIBDVDCSS_VERSION} ; \
253                 bzip2 -f -9 < libdvdcss-${LIBDVDCSS_VERSION}.tar \
254                         > libdvdcss-${LIBDVDCSS_VERSION}.tar.bz2 ; \
255                 gzip -f -9 libdvdcss-${LIBDVDCSS_VERSION}.tar )
256         mv /tmp/libdvdcss-${LIBDVDCSS_VERSION}.tar.gz \
257                 /tmp/libdvdcss-${LIBDVDCSS_VERSION}.tar.bz2 ..
258
259         # clean up
260         rm -Rf /tmp/libdvdcss-${LIBDVDCSS_VERSION}*
261
262 .PHONY: vlc.app
263 vlc.app:
264 ifneq (,$(findstring darwin,$(SYS)))
265         rm -Rf vlc.app
266         mkdir -p vlc.app/Contents/Resources
267         mkdir -p vlc.app/Contents/MacOS/lib
268         mkdir -p vlc.app/Contents/MacOS/share
269         $(INSTALL) -m 644 extras/MacOSX_app/Contents/Info.plist vlc.app/Contents/
270         $(INSTALL) -m 644 extras/MacOSX_app/Contents/PkgInfo vlc.app/Contents/
271         $(INSTALL) vlc vlc.app/Contents/MacOS/
272         $(INSTALL) share/vlc.icns vlc.app/Contents/Resources/
273 ifneq (,$(PLUGINS))
274         $(INSTALL) $(PLUGINS:%=plugins/%.so) vlc.app/Contents/MacOS/plugins
275 endif
276         $(INSTALL) -m 644 share/*.psf vlc.app/Contents/MacOS/share
277 endif
278
279 FORCE:
280
281 #
282 # GTK/Gnome aliases - don't add too many aliases which could bloat
283 # the namespace
284 #
285 gnome-vlc gvlc kvlc qvlc: vlc
286         rm -f $@ && ln -s vlc $@
287
288 #
289 # Generic rules (see below)
290 #
291 $(C_DEP): %.d: FORCE
292         @$(MAKE) -s --no-print-directory -f Makefile.dep $@
293
294 $(CPP_DEP): %.dpp: FORCE
295         @$(MAKE) -s --no-print-directory -f Makefile.dep $@
296
297 $(H_OBJ): Makefile.opts Makefile.dep Makefile
298         rm -f $@ && cp $@.in $@
299 ifneq (,$(BUILTINS))
300         for i in $(BUILTINS) ; do \
301                 echo "int module_"$$i"_InitModule( module_t* );" >> $@ ; \
302                 echo "int module_"$$i"_ActivateModule( module_t* );" >> $@ ; \
303                 echo "int module_"$$i"_DeactivateModule( module_t* );" >> $@ ; \
304         done
305 endif
306 ifneq (,$(BUILTINS))
307         echo "" >> $@ ;
308         printf "#define ALLOCATE_ALL_BUILTINS() do { " >> $@ ;
309         for i in $(BUILTINS) ; do \
310                 printf "ALLOCATE_BUILTIN("$$i"); " >> $@ ; \
311         done
312         echo "} while( 0 );" >> $@ ;
313 endif
314         echo "" >> $@ ;
315
316 $(C_OBJ): %.o: Makefile.opts Makefile.dep Makefile
317 $(C_OBJ): %.o: .dep/%.d
318 $(C_OBJ): %.o: %.c
319         $(CC) $(CFLAGS) -c -o $@ $<
320
321 $(CPP_OBJ): %.o: Makefile.opts Makefile.dep Makefile
322 $(CPP_OBJ): %.o: .dep/%.dpp
323 $(CPP_OBJ): %.o: %.cpp
324         $(CC) $(CFLAGS) -c -o $@ $<
325
326 $(RESOURCE_OBJ): %.o: Makefile.dep Makefile
327 ifneq (,(findstring mingw32,$(SYS)))
328 $(RESOURCE_OBJ): %.o: %.rc
329         $(WINDRES) -i $< -o $@
330 endif
331
332 #
333 # Main application target
334 #
335 vlc: Makefile.opts Makefile.dep Makefile $(H_OBJ) $(C_OBJ) $(CPP_OBJ) $(BUILTIN_OBJ) $(RESOURCE_OBJ)
336         $(CC) $(CFLAGS) -o $@ $(C_OBJ) $(CPP_OBJ) $(BUILTIN_OBJ) $(RESOURCE_OBJ) $(LCFLAGS) $(LIB)
337 ifeq ($(SYS),beos)
338         xres -o $@ ./share/vlc_beos.rsrc
339         mimeset -f $@
340 endif
341
342 #
343 # Plugins target
344 #
345 plugins: Makefile.modules Makefile.opts Makefile.dep Makefile $(PLUGIN_OBJ)
346 $(PLUGIN_OBJ): FORCE
347         cd $(shell echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.* \([^/]*/\)'$(@:plugins/%.so=%)' .*@plugins/\1@' -e 's@^ .*@@') && $(MAKE) $(@:%=../../%)
348
349 #
350 # Built-in modules target
351 #
352 builtins: Makefile.modules Makefile.opts Makefile.dep Makefile $(BUILTIN_OBJ)
353 $(BUILTIN_OBJ): FORCE
354         cd $(shell echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.* \([^/]*/\)'$(@:plugins/%.a=%)' .*@plugins/\1@' -e 's@^ .*@@') && $(MAKE) $(@:%=../../%)
355
356 #
357 # libdvdcss target
358 #
359 libdvdcss:
360         cd extras/libdvdcss && $(MAKE)
361