]> git.sesse.net Git - vlc/blob - Makefile
8183e1f85b90cae585e4820371ebf97eee8300bd
[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 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 dsp/dsp dummy/dummy \
26                 dvd/dvd esd/esd fb/fb ggi/ggi glide/glide gtk/gnome gtk/gtk \
27                 downmix/downmix downmix/downmixsse downmix/downmix3dn \
28                 idct/idct idct/idctclassic idct/idctmmx idct/idctmmxext \
29                 imdct/imdct imdct/imdct3dn imdct/imdctsse \
30                 macosx/macosx mga/mga \
31                 motion/motion motion/motionmmx motion/motionmmxext \
32                 mpeg/es mpeg/ps mpeg/ts null/null qt/qt sdl/sdl \
33                 text/ncurses text/rc x11/x11 x11/xvideo yuv/yuv yuv/yuvmmx
34
35 #
36 # C Objects
37
38 INTERFACE =     src/interface/main.o \
39                 src/interface/interface.o \
40                 src/interface/intf_msg.o \
41                 src/interface/intf_playlist.o \
42                 src/interface/intf_channels.o \
43                 src/interface/intf_urldecode.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 =         include/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 config*status config*cache config*log
181         rm -f gmon.out core build-stamp
182         rm -Rf .dep
183         rm -f .gdb_history
184
185 install:
186         mkdir -p $(DESTDIR)$(bindir)
187         $(INSTALL) vlc $(DESTDIR)$(bindir)
188 ifneq (,$(ALIASES))
189         for alias in $(ALIASES) ; do if test $$alias ; then rm -f $(DESTDIR)$(bindir)/$$alias && ln -s vlc $(DESTDIR)$(bindir)/$$alias ; fi ; done
190 endif
191         mkdir -p $(DESTDIR)$(libdir)/videolan/vlc
192 ifneq (,$(PLUGINS))
193         $(INSTALL) -m 644 $(PLUGINS:%=lib/%.so) $(DESTDIR)$(libdir)/videolan/vlc
194 endif
195         mkdir -p $(DESTDIR)$(datadir)/videolan
196         $(INSTALL) -m 644 share/*.psf $(DESTDIR)$(datadir)/videolan
197         $(INSTALL) -m 644 share/*.png $(DESTDIR)$(datadir)/videolan
198         $(INSTALL) -m 644 share/*.xpm $(DESTDIR)$(datadir)/videolan
199
200 show:
201         @echo CC: $(CC)
202         @echo CFLAGS: $(CFLAGS)
203         @echo DCFLAGS: $(DCFLAGS)
204         @echo LCFLAGS: $(LCFLAGS)
205         @echo C_OBJ: $(C_OBJ)
206         @echo CPP_OBJ: $(CPP_OBJ)
207         @echo objects: $(objects)
208         @echo cppobjects: $(cppobjects)
209         @echo PLUGIN_OBJ: $(PLUGIN_OBJ)
210         @echo BUILTIN_OBJ: $(BUILTIN_OBJ)
211
212
213 # ugliest of all, but I have no time to do it -- sam
214 snapshot: Makefile.opts
215         rm -Rf /tmp/vlc-${PROGRAM_VERSION}* /tmp/vlc-${PROGRAM_VERSION}nocss*
216         # copy archive in /tmp
217         find -type d | grep -v CVS | grep -v '\.dep' | while read i ; \
218                 do mkdir -p /tmp/vlc-${PROGRAM_VERSION}/$$i ; \
219         done
220         find debian -mindepth 1 -maxdepth 1 -type d | \
221                 while read i ; do rm -Rf /tmp/vlc-${PROGRAM_VERSION}/$$i ; done
222         # .c .h .in .cpp .glade
223         find include src plugins -type f -name '*.[chig]*' | while read i ; \
224                 do cp $$i /tmp/vlc-${PROGRAM_VERSION}/$$i ; done
225         # Makefiles
226         find . plugins -type f -name Makefile | while read i ; \
227                 do cp $$i /tmp/vlc-${PROGRAM_VERSION}/$$i ; done
228         # extra files
229         cp -a extras/* /tmp/vlc-${PROGRAM_VERSION}/extras
230         cp -a doc/* /tmp/vlc-${PROGRAM_VERSION}/doc
231         find /tmp/vlc-${PROGRAM_VERSION}/extras \
232                 /tmp/vlc-${PROGRAM_VERSION}/doc \
233                 -type d -name CVS | while read i ; \
234                         do rm -Rf $$i ; \
235                 done
236         # copy misc files
237         cp vlc.spec AUTHORS COPYING ChangeLog INSTALL README TODO todo.pl \
238                 Makefile.opts.in Makefile.dep Makefile.modules \
239                 configure configure.in install-sh config.sub config.guess \
240                         /tmp/vlc-${PROGRAM_VERSION}/
241         for file in control control-css vlc-gtk.menu vlc.copyright vlc.docs \
242                 changelog changelog-css rules rules-css vlc.dirs vlc.desktop \
243                 gvlc.desktop gnome-vlc.desktop vlc.menu ; do \
244                         cp debian/$$file /tmp/vlc-${PROGRAM_VERSION}/debian/ ; \
245                 done
246         for file in default8x16.psf default8x9.psf vlc_beos.rsrc vlc.icns ; do \
247                 cp share/$$file /tmp/vlc-${PROGRAM_VERSION}/share/ ; done
248         for icon in vlc gvlc qvlc gnome-vlc kvlc ; do \
249                 cp share/$$icon.xpm share/$$icon.png \
250                         /tmp/vlc-${PROGRAM_VERSION}/share/ ; done
251
252         # build css-enabled archives
253         (cd /tmp ; tar cf vlc-${PROGRAM_VERSION}.tar vlc-${PROGRAM_VERSION} ; \
254                 bzip2 -f -9 < vlc-${PROGRAM_VERSION}.tar \
255                         > vlc-${PROGRAM_VERSION}.tar.bz2 ; \
256                 gzip -f -9 vlc-${PROGRAM_VERSION}.tar )
257         mv /tmp/vlc-${PROGRAM_VERSION}.tar.gz \
258                 /tmp/vlc-${PROGRAM_VERSION}.tar.bz2 ..
259
260         # clean up
261         rm -Rf /tmp/vlc-${PROGRAM_VERSION}*
262
263 .PHONY: vlc.app
264 vlc.app:
265 ifneq (,$(findstring darwin,$(SYS)))
266         rm -Rf vlc.app
267         mkdir -p vlc.app/Contents/Resources
268         mkdir -p vlc.app/Contents/MacOS/lib
269         mkdir -p vlc.app/Contents/MacOS/share
270         $(INSTALL) -m 644 extras/MacOSX_app/Contents/Info.plist vlc.app/Contents/
271         $(INSTALL) -m 644 extras/MacOSX_app/Contents/PkgInfo vlc.app/Contents/
272         $(INSTALL) vlc vlc.app/Contents/MacOS/
273         $(INSTALL) share/vlc.icns vlc.app/Contents/Resources/
274 ifneq (,$(PLUGINS))
275         $(INSTALL) $(PLUGINS:%=lib/%.so) vlc.app/Contents/MacOS/lib
276 endif
277         $(INSTALL) -m 644 share/*.psf vlc.app/Contents/MacOS/share
278 endif
279
280 FORCE:
281
282 #
283 # GTK/Gnome aliases - don't add too many aliases which could bloat
284 # the namespace
285 #
286 gnome-vlc gvlc kvlc qvlc: vlc
287         rm -f $@ && ln -s vlc $@
288
289 #
290 # Generic rules (see below)
291 #
292 $(C_DEP): %.d: FORCE
293         @$(MAKE) -s --no-print-directory -f Makefile.dep $@
294
295 $(CPP_DEP): %.dpp: FORCE
296         @$(MAKE) -s --no-print-directory -f Makefile.dep $@
297
298 $(H_OBJ): Makefile.opts Makefile.dep Makefile
299         rm -f $@ && cp $@.in $@
300 ifneq (,$(BUILTINS))
301         for i in $(BUILTINS) ; do \
302                 echo "int module_"$$i"_InitModule( module_t* );" >> $@ ; \
303                 echo "int module_"$$i"_ActivateModule( module_t* );" >> $@ ; \
304                 echo "int module_"$$i"_DeactivateModule( module_t* );" >> $@ ; \
305         done
306 endif
307         echo "" >> $@ ;
308         printf "#define ALLOCATE_ALL_BUILTINS() do { " >> $@ ;
309 ifneq (,$(BUILTINS))
310         for i in $(BUILTINS) ; do \
311                 printf "ALLOCATE_BUILTIN("$$i"); " >> $@ ; \
312         done
313 endif
314         echo "} while( 0 );" >> $@ ;
315         echo "" >> $@ ;
316
317 $(C_OBJ): %.o: Makefile.opts Makefile.dep Makefile
318 $(C_OBJ): %.o: .dep/%.d
319 $(C_OBJ): %.o: %.c
320         $(CC) $(CFLAGS) -c -o $@ $<
321
322 $(CPP_OBJ): %.o: Makefile.opts Makefile.dep Makefile
323 $(CPP_OBJ): %.o: .dep/%.dpp
324 $(CPP_OBJ): %.o: %.cpp
325         $(CC) $(CFLAGS) -c -o $@ $<
326
327 #
328 # Main application target
329 #
330 vlc: Makefile.opts Makefile.dep Makefile $(H_OBJ) $(C_OBJ) $(CPP_OBJ) $(BUILTIN_OBJ)
331         $(CC) $(CFLAGS) -o $@ $(C_OBJ) $(CPP_OBJ) $(BUILTIN_OBJ) $(LCFLAGS)
332 ifeq ($(SYS),beos)
333         rm -f ./lib/_APP_
334         ln -s ../vlc ./lib/_APP_
335         xres -o $@ ./share/vlc_beos.rsrc
336         mimeset -f $@
337 endif
338
339 #
340 # Plugins target
341 #
342 plugins: Makefile.modules Makefile.opts Makefile.dep Makefile $(PLUGIN_OBJ)
343 $(PLUGIN_OBJ): FORCE
344         cd $(shell echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.* \([^/]*/\)'$(@:lib/%.so=%)' .*@plugins/\1@' -e 's@^ .*@@') && $(MAKE) $(@:%=../../%)
345
346 #
347 # Built-in modules target
348 #
349 builtins: Makefile.modules Makefile.opts Makefile.dep Makefile $(BUILTIN_OBJ)
350 $(BUILTIN_OBJ): FORCE
351         cd $(shell echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.* \([^/]*/\)'$(@:lib/%.a=%)' .*@plugins/\1@' -e 's@^ .*@@') && $(MAKE) $(@:%=../../%)
352