1 ################################################################################
2 # vlc (VideoLAN Client) main makefile
4 ################################################################################
5 # This makefile is the main makefile for the VideoLAN client.
6 ################################################################################
8 ################################################################################
10 ################################################################################
12 # Debugging mode on or off (set to 1 to activate)
17 SNAPSHOTDIR=vlc-@VLC_VERSION@
21 #----------------- do not change anything below this line ----------------------
23 ################################################################################
24 # Configuration pre-processing
25 ################################################################################
27 # PROGRAM_OPTIONS is an identification string of the compilation options
28 PROGRAM_OPTIONS = $(SYS) $(ARCH)
30 PROGRAM_OPTIONS += DEBUG
34 # PROGRAM_BUILD is a complete identification of the build
35 # ( we can't use fancy options with date since OSes like Solaris
36 # or FreeBSD have strange date implementations )
37 PROGRAM_BUILD = `date` $(USER)
38 # XXX: beos does not support hostname
39 #PROGRAM_BUILD = `date` $(USER)@`hostname`
41 # DEFINE will contain some of the constants definitions decided in Makefile,
42 # including SYS_xx. It will be passed to C compiler.
43 DEFINE += -DSYS_$(shell echo $(SYS) | sed 's/-.*//' | tr a-z A-Z)
45 ################################################################################
46 # Tuning and other variables - do not change anything except if you know
47 # exactly what you are doing
48 ################################################################################
51 # C headers directories
53 INCLUDE += -Iinclude -I/usr/local/include -I/usr/X11R6/include
63 ifneq (,$(findstring bsd,$(SYS)))
64 LIB += -pthread -lgnugetopt
65 LIB += -L/usr/local/lib
68 ifneq (,$(findstring linux,$(SYS)))
73 LIB += -lbe -lroot -lgame
79 # C compiler flags: compilation
81 CCFLAGS += $(DEFINE) $(INCLUDE)
83 CCFLAGS += -D_REENTRANT
84 CCFLAGS += -D_GNU_SOURCE
86 # flags needed for clean beos compilation
87 CCFLAGS += -Wno-multichar -Wno-ctor-dtor-privacy -Woverloaded-virtual
89 # Optimizations : don't compile debug versions with them
92 CCFLAGS += -ffast-math -funroll-loops -fargument-noalias-global
93 CCFLAGS += -fomit-frame-pointer
95 # Optimizations for x86 familiy
96 ifneq (,$(findstring 86,$(ARCH)))
97 CCFLAGS += -malign-double
98 #CCFLAGS += -march=pentium
99 # Eventual Pentium Pro optimizations
100 ifneq (,$(findstring pentiumpro,$(ARCH)))
102 CCFLAGS += -march=pentiumpro
105 # Eventual MMX optimizations for x86
106 ifneq (,$(findstring mmx,$(ARCH)))
111 # Optimizations for PowerPC
112 ifneq (,$(findstring ppc,$(ARCH)))
113 CCFLAGS += -mcpu=604e -mmultiple -mhard-float -mstring
116 # Optimizations for Sparc
117 ifneq (,$(findstring sparc,$(ARCH)))
118 CCFLAGS += -mhard-float
121 # End of optimizations
125 # C compiler flags: dependancies
127 DCFLAGS += $(INCLUDE)
131 # C compiler flags: linking
138 # Additionnal debugging flags
141 # Debugging and profiling support
146 #################################################################################
148 #################################################################################
153 interface_obj = interface/main.o \
154 interface/interface.o \
155 interface/intf_msg.o \
156 interface/intf_cmd.o \
157 interface/intf_ctrl.o \
158 interface/intf_console.o
160 input_obj = input/input_vlan.o \
162 input/input_netlist.o \
163 input/input_network.o \
169 audio_output_obj = audio_output/audio_output.o
171 video_output_obj = video_output/video_output.o \
172 video_output/video_text.o \
173 video_output/video_spu.o \
174 video_output/video_yuv.o
176 ac3_decoder_obj = ac3_decoder/ac3_decoder_thread.o \
177 ac3_decoder/ac3_decoder.o \
178 ac3_decoder/ac3_parse.o \
179 ac3_decoder/ac3_exponent.o \
180 ac3_decoder/ac3_bit_allocate.o \
181 ac3_decoder/ac3_mantissa.o \
182 ac3_decoder/ac3_rematrix.o \
183 ac3_decoder/ac3_imdct.o \
184 ac3_decoder/ac3_downmix.o
186 lpcm_decoder_obj = lpcm_decoder/lpcm_decoder_thread.o \
187 lpcm_decoder/lpcm_decoder.o
189 audio_decoder_obj = audio_decoder/audio_decoder_thread.o \
190 audio_decoder/audio_decoder.o \
191 audio_decoder/audio_math.o
193 spu_decoder_obj = spu_decoder/spu_decoder.o
195 #??generic_decoder_obj = generic_decoder/generic_decoder.o
196 # remeber to add it to OBJ
198 video_parser_obj = video_parser/video_parser.o \
199 video_parser/vpar_headers.o \
200 video_parser/vpar_blocks.o \
201 video_parser/vpar_synchro.o \
202 video_parser/video_fifo.o
204 video_decoder_obj = video_decoder/video_decoder.o \
205 video_decoder/vdec_motion.o \
206 video_decoder/vdec_motion_inner.o \
207 video_decoder/vdec_idct.o
209 misc_obj = misc/mtime.o \
217 C_OBJ = $(interface_obj) \
219 $(audio_output_obj) \
220 $(video_output_obj) \
222 $(lpcm_decoder_obj) \
223 $(audio_decoder_obj) \
225 $(generic_decoder_obj) \
226 $(video_parser_obj) \
227 $(video_decoder_obj) \
232 CPP_OBJ = misc/beos_specific.o
238 ifneq (,$(findstring 86,$(ARCH)))
239 ifneq (,$(findstring mmx,$(ARCH)))
240 ASM_OBJ = video_decoder/vdec_idctmmx.o \
241 video_output/video_yuv_mmx.o
248 PLUGINS := $(PLUGINS:%=lib/%.so)
250 PLUGIN_BEOS = plugins/beos/beos.o \
251 plugins/beos/aout_beos.o \
252 plugins/beos/intf_beos.o \
253 plugins/beos/vout_beos.o
255 PLUGIN_DSP = plugins/dsp/dsp.o \
256 plugins/dsp/aout_dsp.o \
258 PLUGIN_DUMMY = plugins/dummy/dummy.o \
259 plugins/dummy/aout_dummy.o \
260 plugins/dummy/intf_dummy.o \
261 plugins/dummy/vout_dummy.o
263 PLUGIN_ESD = plugins/esd/esd.o \
264 plugins/esd/aout_esd.o
266 PLUGIN_FB = plugins/fb/fb.o \
267 plugins/fb/intf_fb.o \
270 PLUGIN_GGI = plugins/ggi/ggi.o \
271 plugins/ggi/intf_ggi.o \
272 plugins/ggi/vout_ggi.o
274 PLUGIN_GLIDE = plugins/glide/glide.o \
275 plugins/glide/intf_glide.o \
276 plugins/glide/vout_glide.o
278 PLUGIN_GNOME = plugins/gnome/gnome.o \
279 plugins/gnome/intf_gnome.o \
280 plugins/gnome/intf_gnome_callbacks.o \
281 plugins/gnome/intf_gnome_interface.o \
282 plugins/gnome/intf_gnome_support.o \
283 plugins/gnome/vout_gnome.o
285 PLUGIN_MGA = plugins/mga/mga.o \
286 plugins/mga/intf_mga.o \
287 plugins/mga/vout_mga.o
289 PLUGIN_X11 = plugins/x11/x11.o \
290 plugins/x11/intf_x11.o \
291 plugins/x11/vout_x11.o
293 PLUGIN_YUV = plugins/yuv/yuv.o \
294 plugins/yuv/video_yuv.o \
295 plugins/yuv/video_yuv8.o \
296 plugins/yuv/video_yuv15.o \
297 plugins/yuv/video_yuv16.o \
298 plugins/yuv/video_yuv24.o \
299 plugins/yuv/video_yuv32.o
301 PLUGIN_YUVMMX = plugins/yuvmmx/yuvmmx.o \
302 plugins/yuvmmx/video_yuv.o \
303 plugins/yuvmmx/video_yuv8.o \
304 plugins/yuvmmx/video_yuv15.o \
305 plugins/yuvmmx/video_yuv16.o \
306 plugins/yuvmmx/video_yuv24.o \
307 plugins/yuvmmx/video_yuv32.o
309 PLUGIN_OBJ = $(PLUGIN_BEOS) $(PLUGIN_DSP) $(PLUGIN_DUMMY) $(PLUGIN_ESD) \
310 $(PLUGIN_FB) $(PLUGIN_GGI) $(PLUGIN_GLIDE) $(PLUGIN_GNOME) \
311 $(PLUGIN_MGA) $(PLUGIN_X11) $(PLUGIN_YUV) $(PLUGIN_YUVMMX)
313 # Other lists of files
315 C_OBJ := $(C_OBJ:%.o=src/%.o)
316 CPP_OBJ := $(CPP_OBJ:%.o=src/%.o)
317 ASM_OBJ := $(ASM_OBJ:%.o=src/%.o)
318 sources_c := $(C_OBJ:%.o=%.c)
319 dependancies := $(sources_c:%.c=.dep/%.d)
321 # All symbols must be exported
324 ################################################################################
326 ################################################################################
331 all: vlc @ALIASES@ plugins
334 rm -f $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ) $(PLUGIN_OBJ)
335 rm -f vlc @ALIASES@ lib/*.so
338 rm -f src/*/*.o plugins/*/*.o **/*~ *.log
339 rm -f Makefile include/defs.h include/config.h
340 rm -f config.status config.cache config.log
341 rm -f gmon.out core build-stamp
345 $(INSTALL) vlc $(prefix)/bin
346 mkdir -p $(prefix)/lib/videolan/vlc
347 mkdir -p $(prefix)/share/videolan
348 $(INSTALL) -m 644 $(PLUGINS) $(prefix)/lib/videolan/vlc
349 $(INSTALL) -m 644 share/*.psf $(prefix)/share/videolan
350 $(INSTALL) -m 644 share/*.png $(prefix)/share/videolan
354 @echo CCFLAGS: $(CCFLAGS)
355 @echo DCFLAGS: $(DCFLAGS)
356 @echo LCFLAGS: $(CCFLAGS)
358 # ugliest of all, but I have no time to do it -- sam
360 rm -rf /tmp/${SNAPSHOTDIR}
361 mkdir /tmp/${SNAPSHOTDIR}
362 cp -r * /tmp/${SNAPSHOTDIR}
363 (cd /tmp/${SNAPSHOTDIR} ; \
365 find . -type d -name CVS | xargs rm -rf ; \
366 find . -type f -name '.*.swp' | xargs rm -f ; \
368 tar czvf ${SNAPSHOTDIR}.tar.gz ${SNAPSHOTDIR} )
369 rm -rf /tmp/${SNAPSHOTDIR}
370 mv /tmp/${SNAPSHOTDIR}.tar.gz ..
371 @echo "Sources are in ../${SNAPSHOTDIR}.tar.gz"
378 vlc: $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ)
380 $(CC) $(CCFLAGS) $(LCFLAGS) $(CFLAGS) -Xlinker -soname=_APP_ -o $@ $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ)
381 rm -f ./plugins/_APP_
382 ln -s ../vlc ./plugins/_APP_
384 $(CC) $(CCFLAGS) $(LCFLAGS) $(CFLAGS) --export-dynamic -rdynamic -o $@ $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ)
387 gvlc xvlc fbvlc ggivlc glidevlc: vlc
388 rm -f $@ && ln -s vlc $@
393 # Generic rules (see below)
395 $(dependancies): %.d: FORCE
396 @$(MAKE) -s --no-print-directory -f Makefile.dep $@
398 $(C_OBJ): %.o: Makefile.dep
399 $(C_OBJ): %.o: .dep/%.d
401 $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
403 $(CPP_OBJ): %.o: %.cpp
404 $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
406 $(ASM_OBJ): %.o: Makefile.dep
408 $(CC) $(CFLAGS) -c -o $@ $<
410 #$(PLUGIN_OBJ): %.so: Makefile.dep
411 #$(PLUGIN_OBJ): %.so: .dep/%.d
413 lib/beos.so: $(PLUGIN_BEOS)
414 $(CC) $(CCFLAGS) $(CFLAGS) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_
415 $(PLUGIN_BEOS): %.o: %.cpp
416 $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
418 lib/esd.so: $(PLUGIN_ESD)
419 ifneq (,$(findstring bsd,$(SYS)))
420 ld -shared -lesd -o $@ $^
422 ld -shared -laudiofile -lesd -o $@ $^
424 $(PLUGIN_ESD): %.o: %.c
425 $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
427 lib/dsp.so: $(PLUGIN_DSP)
429 $(PLUGIN_DSP): %.o: %.c
430 $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
432 lib/dummy.so: $(PLUGIN_DUMMY)
434 $(PLUGIN_DUMMY): %.o: %.c
435 $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
437 lib/fb.so: $(PLUGIN_FB)
439 $(PLUGIN_FB): %.o: %.c
440 $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
442 lib/x11.so: $(PLUGIN_X11)
443 ld -shared -L/usr/X11R6/lib -lX11 -lXext -o $@ $^
444 $(PLUGIN_X11): %.o: %.c
445 $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
447 lib/mga.so: $(PLUGIN_MGA)
448 ld -shared -L/usr/X11R6/lib -lX11 -lXext -o $@ $^
449 $(PLUGIN_MGA): %.o: %.c
450 $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
452 lib/gnome.so: $(PLUGIN_GNOME)
453 ld -shared `gnome-config --libs gnomeui | sed 's,-rdynamic,,'` -o $@ $^
454 $(PLUGIN_GNOME): %.o: %.c
455 $(CC) $(CCFLAGS) $(CFLAGS) `gnome-config --cflags gnomeui` -c -o $@ $<
457 lib/glide.so: $(PLUGIN_GLIDE)
458 ld -shared -lglide2x -o $@ $^
459 $(PLUGIN_GLIDE): %.o: %.c
460 $(CC) $(CCFLAGS) $(CFLAGS) -I/usr/include/glide -c -o $@ $<
462 lib/ggi.so: $(PLUGIN_GGI)
463 ld -shared -lggi -o $@ $^
464 $(PLUGIN_GGI): %.o: %.c
465 $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
467 lib/yuv.so: $(PLUGIN_YUV)
469 $(PLUGIN_YUV): %.o: %.c
470 $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
472 lib/yuvmmx.so: $(PLUGIN_YUVMMX)
474 $(PLUGIN_YUVMMX): %.o: %.c
475 $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
477 ################################################################################
478 # Note on generic rules and dependancies
479 ################################################################################
481 # Note on dependancies: each .c file is associated with a .d file, which
482 # depends of it. The .o file associated with a .c file depends of the .d, of the
483 # .c itself, and of Makefile. The .d files are stored in a separate .dep/
485 # The dep directory should be ignored by CVS.
487 # Note on inclusions: depending of the target, the dependancies files must
488 # or must not be included. The problem is that if we ask make to include a file,
489 # and this file does not exist, it is made before it can be included. In a
490 # general way, a .d file should be included if and only if the corresponding .o
491 # needs to be re-made.
493 # Two makefiles are used: the main one (this one) has regular generic rules,
494 # except for .o files, for which it calls the object Makefile. Dependancies
495 # are not included in this file.
496 # The object Makefile known how to make a .o from a .c, and includes
497 # dependancies for the target, but only those required.