]> git.sesse.net Git - vlc/blob - Makefile
* DirectX enhancements by Gildas Bazin, such as software rendering.
[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 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 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 #
68 # Generated header
69 #
70 H_OBJ :=        src/misc/modules_builtin.h
71
72 #
73 # Other lists of files
74 #
75 C_DEP := $(C_OBJ:%.o=.dep/%.d)
76 CPP_DEP := $(CPP_OBJ:%.o=.dep/%.dpp)
77
78 #
79 # Translate plugin names
80 #
81 ifneq (,$(PLUGINS))
82 PLUGIN_OBJ := $(shell for i in $(PLUGINS) ; do echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.*/\('$$i'\) .*@lib/\1.so@' -e 's@^ .*@@' ; done)
83 endif
84 ifneq (,$(BUILTINS))
85 BUILTIN_OBJ := $(shell for i in $(BUILTINS) ; do echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.*/\('$$i'\) .*@lib/\1.a@' -e 's@^ .*@@' ; done)
86 endif
87
88 # All symbols must be exported
89 export
90
91 ###############################################################################
92 # Targets
93 ###############################################################################
94
95 #
96 # Virtual targets
97 #
98 all: vlc ${ALIASES} plugins vlc.app
99
100 clean: libdvdcss-clean plugins-clean vlc-clean
101         rm -f src/*/*.o extras/*/*.o
102         rm -f lib/*.so lib/*.so.* lib/*.a
103
104 libdvdcss-clean:
105         cd extras/libdvdcss && $(MAKE) clean
106
107 plugins-clean:
108         for dir in $(PLUGINS_DIR) ; do \
109                 ( cd plugins/$${dir} && $(MAKE) clean ) ; done
110         rm -f plugins/*/*.o plugins/*/*.moc plugins/*/*.bak
111
112 vlc-clean:
113         rm -f $(C_OBJ) $(CPP_OBJ)
114         rm -f vlc gnome-vlc gvlc kvlc qvlc
115         rm -Rf vlc.app
116
117 distclean: clean
118         rm -f **/*.o **/*~ *.log
119         rm -f Makefile.opts
120         rm -f include/defs.h include/config.h include/modules_builtin.h
121         rm -f src/misc/modules_builtin.h
122         rm -f config*status config*cache config*log
123         rm -f gmon.out core build-stamp
124         rm -Rf .dep
125         rm -f .gdb_history
126
127 install: libdvdcss-install vlc-install plugins-install
128
129 vlc-install:
130         mkdir -p $(DESTDIR)$(bindir)
131         $(INSTALL) vlc $(DESTDIR)$(bindir)
132 ifneq (,$(ALIASES))
133         for alias in $(ALIASES) ; do if test $$alias ; then rm -f $(DESTDIR)$(bindir)/$$alias && ln -s vlc $(DESTDIR)$(bindir)/$$alias ; fi ; done
134 endif
135         mkdir -p $(DESTDIR)$(datadir)/videolan
136         $(INSTALL) -m 644 share/*.psf $(DESTDIR)$(datadir)/videolan
137         $(INSTALL) -m 644 share/*.png $(DESTDIR)$(datadir)/videolan
138         $(INSTALL) -m 644 share/*.xpm $(DESTDIR)$(datadir)/videolan
139
140 plugins-install:
141         mkdir -p $(DESTDIR)$(libdir)/videolan/vlc
142 ifneq (,$(PLUGINS))
143         $(INSTALL) -m 644 $(PLUGINS:%=lib/%.so) $(DESTDIR)$(libdir)/videolan/vlc
144 endif
145
146 libdvdcss-install:
147         cd extras/libdvdcss && $(MAKE) install
148
149 show:
150         @echo CC: $(CC)
151         @echo CFLAGS: $(CFLAGS)
152         @echo DCFLAGS: $(DCFLAGS)
153         @echo LCFLAGS: $(LCFLAGS)
154         @echo C_OBJ: $(C_OBJ)
155         @echo CPP_OBJ: $(CPP_OBJ)
156         @echo objects: $(objects)
157         @echo cppobjects: $(cppobjects)
158         @echo PLUGIN_OBJ: $(PLUGIN_OBJ)
159         @echo BUILTIN_OBJ: $(BUILTIN_OBJ)
160
161
162 # ugliest of all, but I have no time to do it -- sam
163 snapshot: Makefile.opts
164         rm -Rf /tmp/vlc-${PROGRAM_VERSION}* /tmp/vlc-${PROGRAM_VERSION}nocss*
165         # copy archive in /tmp
166         find -type d | grep -v CVS | grep -v '\.dep' | while read i ; \
167                 do mkdir -p /tmp/vlc-${PROGRAM_VERSION}/$$i ; \
168         done
169         find debian -mindepth 1 -maxdepth 1 -type d | \
170                 while read i ; do rm -Rf /tmp/vlc-${PROGRAM_VERSION}/$$i ; done
171         # .c .h .in .cpp .glade
172         find include src plugins -type f -name '*.[chig]*' | while read i ; \
173                 do cp $$i /tmp/vlc-${PROGRAM_VERSION}/$$i ; done
174         # Makefiles
175         find . plugins -type f -name Makefile | while read i ; \
176                 do cp $$i /tmp/vlc-${PROGRAM_VERSION}/$$i ; done
177         # extra files
178         cp -a extras/* /tmp/vlc-${PROGRAM_VERSION}/extras
179         cp -a doc/* /tmp/vlc-${PROGRAM_VERSION}/doc
180         find /tmp/vlc-${PROGRAM_VERSION}/extras \
181                 /tmp/vlc-${PROGRAM_VERSION}/doc \
182                 -type d -name CVS | while read i ; \
183                         do rm -Rf $$i ; \
184                 done
185         # copy misc files
186         cp vlc.spec AUTHORS COPYING ChangeLog INSTALL README TODO todo.pl \
187                 Makefile.opts.in Makefile.dep Makefile.modules \
188                 configure configure.in install-sh config.sub config.guess \
189                         /tmp/vlc-${PROGRAM_VERSION}/
190         for file in control control-css vlc-gtk.menu vlc.copyright vlc.docs \
191                 changelog changelog-css rules rules-css vlc.dirs vlc.desktop \
192                 gvlc.desktop gnome-vlc.desktop vlc.menu ; do \
193                         cp debian/$$file /tmp/vlc-${PROGRAM_VERSION}/debian/ ; \
194                 done
195         for file in default8x16.psf default8x9.psf vlc_beos.rsrc vlc.icns ; do \
196                 cp share/$$file /tmp/vlc-${PROGRAM_VERSION}/share/ ; done
197         for icon in vlc gvlc qvlc gnome-vlc kvlc ; do \
198                 cp share/$$icon.xpm share/$$icon.png \
199                         /tmp/vlc-${PROGRAM_VERSION}/share/ ; done
200
201         # make distclean
202         (cd /tmp/vlc-${PROGRAM_VERSION} ; ./configure ; make distclean )
203
204         # build css-enabled archives
205         (cd /tmp ; tar cf vlc-${PROGRAM_VERSION}.tar vlc-${PROGRAM_VERSION} ; \
206                 bzip2 -f -9 < vlc-${PROGRAM_VERSION}.tar \
207                         > vlc-${PROGRAM_VERSION}.tar.bz2 ; \
208                 gzip -f -9 vlc-${PROGRAM_VERSION}.tar )
209         mv /tmp/vlc-${PROGRAM_VERSION}.tar.gz \
210                 /tmp/vlc-${PROGRAM_VERSION}.tar.bz2 ..
211
212         # clean up
213         rm -Rf /tmp/vlc-${PROGRAM_VERSION}*
214
215 .PHONY: vlc.app
216 vlc.app:
217 ifneq (,$(findstring darwin,$(SYS)))
218         rm -Rf vlc.app
219         mkdir -p vlc.app/Contents/Resources
220         mkdir -p vlc.app/Contents/MacOS/lib
221         mkdir -p vlc.app/Contents/MacOS/share
222         $(INSTALL) -m 644 extras/MacOSX_app/Contents/Info.plist vlc.app/Contents/
223         $(INSTALL) -m 644 extras/MacOSX_app/Contents/PkgInfo vlc.app/Contents/
224         $(INSTALL) vlc vlc.app/Contents/MacOS/
225         $(INSTALL) share/vlc.icns vlc.app/Contents/Resources/
226 ifneq (,$(PLUGINS))
227         $(INSTALL) $(PLUGINS:%=lib/%.so) vlc.app/Contents/MacOS/lib
228 endif
229         $(INSTALL) -m 644 share/*.psf vlc.app/Contents/MacOS/share
230 endif
231
232 FORCE:
233
234 #
235 # GTK/Gnome aliases - don't add too many aliases which could bloat
236 # the namespace
237 #
238 gnome-vlc gvlc kvlc qvlc: vlc
239         rm -f $@ && ln -s vlc $@
240
241 #
242 # Generic rules (see below)
243 #
244 $(C_DEP): %.d: FORCE
245         @$(MAKE) -s --no-print-directory -f Makefile.dep $@
246
247 $(CPP_DEP): %.dpp: FORCE
248         @$(MAKE) -s --no-print-directory -f Makefile.dep $@
249
250 $(H_OBJ): Makefile.opts Makefile.dep Makefile
251         rm -f $@ && cp $@.in $@
252 ifneq (,$(BUILTINS))
253         for i in $(BUILTINS) ; do \
254                 echo "int module_"$$i"_InitModule( module_t* );" >> $@ ; \
255                 echo "int module_"$$i"_ActivateModule( module_t* );" >> $@ ; \
256                 echo "int module_"$$i"_DeactivateModule( module_t* );" >> $@ ; \
257         done
258 endif
259 ifneq (,$(BUILTINS))
260         echo "" >> $@ ;
261         printf "#define ALLOCATE_ALL_BUILTINS() do { " >> $@ ;
262         for i in $(BUILTINS) ; do \
263                 printf "ALLOCATE_BUILTIN("$$i"); " >> $@ ; \
264         done
265         echo "} while( 0 );" >> $@ ;
266 endif
267         echo "" >> $@ ;
268
269 $(C_OBJ): %.o: Makefile.opts Makefile.dep Makefile
270 $(C_OBJ): %.o: .dep/%.d
271 $(C_OBJ): %.o: %.c
272         $(CC) $(CFLAGS) -c -o $@ $<
273
274 $(CPP_OBJ): %.o: Makefile.opts Makefile.dep Makefile
275 $(CPP_OBJ): %.o: .dep/%.dpp
276 $(CPP_OBJ): %.o: %.cpp
277         $(CC) $(CFLAGS) -c -o $@ $<
278
279 #
280 # Main application target
281 #
282 vlc: Makefile.opts Makefile.dep Makefile $(H_OBJ) $(C_OBJ) $(CPP_OBJ) $(BUILTIN_OBJ)
283         $(CC) $(CFLAGS) -o $@ $(C_OBJ) $(CPP_OBJ) $(BUILTIN_OBJ) $(LCFLAGS) $(LIB)
284 ifeq ($(SYS),beos)
285         xres -o $@ ./share/vlc_beos.rsrc
286         mimeset -f $@
287 endif
288
289 #
290 # Plugins target
291 #
292 plugins: Makefile.modules Makefile.opts Makefile.dep Makefile $(PLUGIN_OBJ)
293 $(PLUGIN_OBJ): FORCE
294         cd $(shell echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.* \([^/]*/\)'$(@:lib/%.so=%)' .*@plugins/\1@' -e 's@^ .*@@') && $(MAKE) $(@:%=../../%)
295
296 #
297 # Built-in modules target
298 #
299 builtins: Makefile.modules Makefile.opts Makefile.dep Makefile $(BUILTIN_OBJ)
300 $(BUILTIN_OBJ): FORCE
301         cd $(shell echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.* \([^/]*/\)'$(@:lib/%.a=%)' .*@plugins/\1@' -e 's@^ .*@@') && $(MAKE) $(@:%=../../%)
302
303 #
304 # libdvdcss target
305 #
306 libdvdcss:
307         cd extras/libdvdcss && $(MAKE)
308