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