]> git.sesse.net Git - vlc/blob - Makefile
* Fixed the BeOS compile typo.
[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
44 INPUT =         src/input/input.o \
45                 src/input/input_ext-dec.o \
46                 src/input/input_ext-intf.o \
47                 src/input/input_dec.o \
48                 src/input/input_programs.o \
49                 src/input/input_netlist.o \
50                 src/input/input_clock.o \
51                 src/input/mpeg_system.o
52
53 AUDIO_OUTPUT =  src/audio_output/audio_output.o \
54                 src/audio_output/aout_ext-dec.o \
55                 src/audio_output/aout_u8.o \
56                 src/audio_output/aout_s8.o \
57                 src/audio_output/aout_u16.o \
58                 src/audio_output/aout_s16.o \
59                 src/audio_output/aout_spdif.o
60
61 VIDEO_OUTPUT =  src/video_output/video_output.o \
62                 src/video_output/video_text.o \
63                 src/video_output/video_spu.o \
64                 src/video_output/video_yuv.o
65
66 AC3_DECODER =   src/ac3_decoder/ac3_decoder_thread.o \
67                 src/ac3_decoder/ac3_decoder.o \
68                 src/ac3_decoder/ac3_parse.o \
69                 src/ac3_decoder/ac3_exponent.o \
70                 src/ac3_decoder/ac3_bit_allocate.o \
71                 src/ac3_decoder/ac3_mantissa.o \
72                 src/ac3_decoder/ac3_rematrix.o \
73                 src/ac3_decoder/ac3_imdct.o
74
75 AC3_SPDIF =     src/ac3_spdif/ac3_spdif.o \
76                 src/ac3_spdif/ac3_iec958.o
77
78 LPCM_DECODER =  src/lpcm_decoder/lpcm_decoder_thread.o \
79                 src/lpcm_decoder/lpcm_decoder.o
80
81 AUDIO_DECODER = src/audio_decoder/audio_decoder.o \
82                 src/audio_decoder/adec_generic.o \
83                 src/audio_decoder/adec_layer1.o \
84                 src/audio_decoder/adec_layer2.o \
85                 src/audio_decoder/adec_math.o
86
87 SPU_DECODER =   src/spu_decoder/spu_decoder.o
88
89 #GEN_DECODER =  src/generic_decoder/generic_decoder.o
90
91 VIDEO_PARSER =  src/video_parser/video_parser.o \
92                 src/video_parser/vpar_headers.o \
93                 src/video_parser/vpar_blocks.o \
94                 src/video_parser/vpar_synchro.o \
95                 src/video_parser/video_fifo.o
96
97 VIDEO_DECODER = src/video_decoder/video_decoder.o
98
99 MISC =          src/misc/mtime.o \
100                 src/misc/tests.o \
101                 src/misc/modules.o \
102                 src/misc/netutils.o
103
104 C_OBJ =         $(INTERFACE) \
105                 $(INPUT) \
106                 $(VIDEO_OUTPUT) \
107                 $(AUDIO_OUTPUT) \
108                 $(AC3_DECODER) \
109                 $(AC3_SPDIF) \
110                 $(LPCM_DECODER) \
111                 $(AUDIO_DECODER) \
112                 $(SPU_DECODER) \
113                 $(GEN_DECODER) \
114                 $(VIDEO_PARSER) \
115                 $(VIDEO_DECODER) \
116                 $(MISC)
117
118 #
119 # Misc Objects
120
121 ifeq ($(GETOPT),1)
122 C_OBJ += extras/GNUgetopt/getopt.o extras/GNUgetopt/getopt1.o 
123 endif
124
125 ifeq ($(SYS),beos)
126 CPP_OBJ =       src/misc/beos_specific.o
127 endif
128
129 ifneq (,$(findstring darwin,$(SYS)))
130 C_OBJ +=        src/misc/darwin_specific.o
131 endif
132
133 #
134 # Generated header
135 #
136 H_OBJ =         include/modules_builtin.h
137
138 #
139 # Other lists of files
140 #
141 C_DEP := $(C_OBJ:%.o=.dep/%.d)
142 CPP_DEP := $(CPP_OBJ:%.o=.dep/%.dpp)
143
144 #
145 # Translate plugin names
146 #
147 ifneq (,$(PLUGINS))
148 PLUGIN_OBJ := $(shell for i in $(PLUGINS) ; do echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.*/\('$$i'\) .*@lib/\1.so@' -e 's@^ .*@@' ; done)
149 endif
150 ifneq (,$(BUILTINS))
151 BUILTIN_OBJ := $(shell for i in $(BUILTINS) ; do echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.*/\('$$i'\) .*@lib/\1.a@' -e 's@^ .*@@' ; done)
152 endif
153
154 # All symbols must be exported
155 export
156
157 ###############################################################################
158 # Targets
159 ###############################################################################
160
161 #
162 # Virtual targets
163 #
164 all: vlc ${ALIASES} plugins vlc.app
165
166 clean:
167         for dir in $(PLUGINS_DIR) ; do \
168                 ( cd plugins/$${dir} && $(MAKE) clean ) ; done
169         rm -f plugins/*/*.o plugins/*/*.moc plugins/*/*.bak
170         rm -f $(C_OBJ) $(CPP_OBJ)
171         rm -f src/*/*.o extras/*/*.o
172         rm -f lib/*.so lib/*.a vlc gnome-vlc gvlc kvlc qvlc
173         rm -Rf vlc.app
174
175 distclean: clean
176         rm -f **/*.o **/*~ *.log
177         rm -f Makefile.opts
178         rm -f include/defs.h include/config.h include/modules_builtin.h
179         rm -f config*status config*cache config*log
180         rm -f gmon.out core build-stamp
181         rm -Rf .dep
182         rm -f .gdb_history
183
184 install:
185         mkdir -p $(DESTDIR)$(bindir)
186         $(INSTALL) vlc $(DESTDIR)$(bindir)
187 ifneq (,$(ALIASES))
188         for alias in $(ALIASES) ; do if test $$alias ; then rm -f $(DESTDIR)$(bindir)/$$alias && ln -s vlc $(DESTDIR)$(bindir)/$$alias ; fi ; done
189 endif
190         mkdir -p $(DESTDIR)$(libdir)/videolan/vlc
191 ifneq (,$(PLUGINS))
192         $(INSTALL) -m 644 $(PLUGINS:%=lib/%.so) $(DESTDIR)$(libdir)/videolan/vlc
193 endif
194         mkdir -p $(DESTDIR)$(datadir)/videolan
195         $(INSTALL) -m 644 share/*.psf $(DESTDIR)$(datadir)/videolan
196         $(INSTALL) -m 644 share/*.png $(DESTDIR)$(datadir)/videolan
197         $(INSTALL) -m 644 share/*.xpm $(DESTDIR)$(datadir)/videolan
198
199 show:
200         @echo CC: $(CC)
201         @echo CFLAGS: $(CFLAGS)
202         @echo DCFLAGS: $(DCFLAGS)
203         @echo LCFLAGS: $(LCFLAGS)
204         @echo C_OBJ: $(C_OBJ)
205         @echo CPP_OBJ: $(CPP_OBJ)
206         @echo objects: $(objects)
207         @echo cppobjects: $(cppobjects)
208         @echo PLUGIN_OBJ: $(PLUGIN_OBJ)
209         @echo BUILTIN_OBJ: $(BUILTIN_OBJ)
210
211
212 # ugliest of all, but I have no time to do it -- sam
213 snapshot: Makefile.opts
214         rm -Rf /tmp/vlc-${PROGRAM_VERSION}* /tmp/vlc-${PROGRAM_VERSION}nocss*
215         # copy archive in /tmp
216         find -type d | grep -v CVS | grep -v '\.dep' | while read i ; \
217                 do mkdir -p /tmp/vlc-${PROGRAM_VERSION}/$$i ; \
218         done
219         find debian -mindepth 1 -maxdepth 1 -type d | \
220                 while read i ; do rm -Rf /tmp/vlc-${PROGRAM_VERSION}/$$i ; done
221         # .c .h .in .cpp .glade
222         find include src plugins -type f -name '*.[chig]*' | while read i ; \
223                 do cp $$i /tmp/vlc-${PROGRAM_VERSION}/$$i ; done
224         # Makefiles
225         find . plugins -type f -name Makefile | while read i ; \
226                 do cp $$i /tmp/vlc-${PROGRAM_VERSION}/$$i ; done
227         # extra files
228         cp -a extras/* /tmp/vlc-${PROGRAM_VERSION}/extras
229         cp -a doc/* /tmp/vlc-${PROGRAM_VERSION}/doc
230         find /tmp/vlc-${PROGRAM_VERSION}/extras \
231                 /tmp/vlc-${PROGRAM_VERSION}/doc \
232                 -type d -name CVS | while read i ; \
233                         do rm -Rf $$i ; \
234                 done
235         # copy misc files
236         cp vlc.spec AUTHORS COPYING ChangeLog INSTALL README TODO todo.pl \
237                 Makefile.opts.in Makefile.dep Makefile.modules \
238                 configure configure.in install-sh config.sub config.guess \
239                         /tmp/vlc-${PROGRAM_VERSION}/
240         for file in control control-css vlc-gtk.menu vlc.copyright vlc.docs \
241                 changelog changelog-css rules rules-css vlc.dirs vlc.desktop \
242                 gvlc.desktop gnome-vlc.desktop vlc.menu ; do \
243                         cp debian/$$file /tmp/vlc-${PROGRAM_VERSION}/debian/ ; \
244                 done
245         for file in default8x16.psf default8x9.psf vlc_beos.rsrc vlc.icns ; do \
246                 cp share/$$file /tmp/vlc-${PROGRAM_VERSION}/share/ ; done
247         for icon in vlc gvlc qvlc gnome-vlc kvlc ; do \
248                 cp share/$$icon.xpm share/$$icon.png \
249                         /tmp/vlc-${PROGRAM_VERSION}/share/ ; done
250
251         # build css-enabled archives
252         (cd /tmp ; tar cf vlc-${PROGRAM_VERSION}.tar vlc-${PROGRAM_VERSION} ; \
253                 bzip2 -f -9 < vlc-${PROGRAM_VERSION}.tar \
254                         > vlc-${PROGRAM_VERSION}.tar.bz2 ; \
255                 gzip -f -9 vlc-${PROGRAM_VERSION}.tar )
256         mv /tmp/vlc-${PROGRAM_VERSION}.tar.gz \
257                 /tmp/vlc-${PROGRAM_VERSION}.tar.bz2 ..
258
259         # clean up
260         rm -Rf /tmp/vlc-${PROGRAM_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:%=lib/%.so) vlc.app/Contents/MacOS/lib
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         echo "" >> $@ ;
307         printf "#define ALLOCATE_ALL_BUILTINS() do { " >> $@ ;
308 ifneq (,$(BUILTINS))
309         for i in $(BUILTINS) ; do \
310                 printf "ALLOCATE_BUILTIN("$$i"); " >> $@ ; \
311         done
312 endif
313         echo "} while( 0 );" >> $@ ;
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 #
327 # Main application target
328 #
329 vlc: Makefile.opts Makefile.dep Makefile $(H_OBJ) $(C_OBJ) $(CPP_OBJ) $(BUILTIN_OBJ)
330         $(CC) $(CFLAGS) -o $@ $(C_OBJ) $(CPP_OBJ) $(BUILTIN_OBJ) $(LCFLAGS) $(LIB)
331 ifeq ($(SYS),beos)
332         rm -f ./lib/_APP_
333         ln -s ../vlc ./lib/_APP_
334         xres -o $@ ./share/vlc_beos.rsrc
335         mimeset -f $@
336 endif
337
338 #
339 # Plugins target
340 #
341 plugins: Makefile.modules Makefile.opts Makefile.dep Makefile $(PLUGIN_OBJ)
342 $(PLUGIN_OBJ): FORCE
343         cd $(shell echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.* \([^/]*/\)'$(@:lib/%.so=%)' .*@plugins/\1@' -e 's@^ .*@@') && $(MAKE) $(@:%=../../%)
344
345 #
346 # Built-in modules target
347 #
348 builtins: Makefile.modules Makefile.opts Makefile.dep Makefile $(BUILTIN_OBJ)
349 $(BUILTIN_OBJ): FORCE
350         cd $(shell echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.* \([^/]*/\)'$(@:lib/%.a=%)' .*@plugins/\1@' -e 's@^ .*@@') && $(MAKE) $(@:%=../../%)
351