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
150 #################################################################################
152 #################################################################################
157 interface_obj = interface/main.o \
158 interface/interface.o \
159 interface/intf_msg.o \
160 interface/intf_cmd.o \
161 interface/intf_ctrl.o \
162 interface/intf_console.o
164 input_obj = input/input_vlan.o \
166 input/input_netlist.o \
167 input/input_network.o \
173 audio_output_obj = audio_output/audio_output.o
175 video_output_obj = video_output/video_output.o \
176 video_output/video_text.o \
177 video_output/video_spu.o \
178 video_output/video_yuv.o
180 ac3_decoder_obj = ac3_decoder/ac3_decoder_thread.o \
181 ac3_decoder/ac3_decoder.o \
182 ac3_decoder/ac3_parse.o \
183 ac3_decoder/ac3_exponent.o \
184 ac3_decoder/ac3_bit_allocate.o \
185 ac3_decoder/ac3_mantissa.o \
186 ac3_decoder/ac3_rematrix.o \
187 ac3_decoder/ac3_imdct.o \
188 ac3_decoder/ac3_downmix.o
190 lpcm_decoder_obj = lpcm_decoder/lpcm_decoder_thread.o \
191 lpcm_decoder/lpcm_decoder.o
193 audio_decoder_obj = audio_decoder/audio_decoder_thread.o \
194 audio_decoder/audio_decoder.o \
195 audio_decoder/audio_math.o
197 spu_decoder_obj = spu_decoder/spu_decoder.o
199 #??generic_decoder_obj = generic_decoder/generic_decoder.o
200 # remeber to add it to OBJ
202 video_parser_obj = video_parser/video_parser.o \
203 video_parser/vpar_headers.o \
204 video_parser/vpar_blocks.o \
205 video_parser/vpar_synchro.o \
206 video_parser/video_fifo.o
208 video_decoder_obj = video_decoder/video_decoder.o \
209 video_decoder/vdec_motion.o \
210 video_decoder/vdec_motion_inner.o \
211 video_decoder/vdec_idct.o
213 misc_obj = misc/mtime.o \
222 C_OBJ = $(interface_obj) \
224 $(audio_output_obj) \
225 $(video_output_obj) \
227 $(lpcm_decoder_obj) \
228 $(audio_decoder_obj) \
230 $(generic_decoder_obj) \
231 $(video_parser_obj) \
232 $(video_decoder_obj) \
237 CPP_OBJ = misc/beos_specific.o
243 ifneq (,$(findstring 86,$(ARCH)))
244 ifneq (,$(findstring mmx,$(ARCH)))
245 ASM_OBJ = video_decoder/vdec_idctmmx.o \
246 video_output/video_yuv_mmx.o
253 PLUGINS := $(PLUGINS:%=lib/%.so)
255 PLUGIN_BEOS = plugins/beos/beos.o \
256 plugins/beos/aout_beos.o \
257 plugins/beos/intf_beos.o \
258 plugins/beos/vout_beos.o
260 PLUGIN_DSP = plugins/dsp/dsp.o \
261 plugins/dsp/aout_dsp.o \
263 PLUGIN_DUMMY = plugins/dummy/dummy.o \
264 plugins/dummy/aout_dummy.o \
265 plugins/dummy/intf_dummy.o \
266 plugins/dummy/vout_dummy.o
268 PLUGIN_ESD = plugins/esd/esd.o \
269 plugins/esd/aout_esd.o
271 PLUGIN_FB = plugins/fb/fb.o \
272 plugins/fb/intf_fb.o \
275 PLUGIN_GGI = plugins/ggi/ggi.o \
276 plugins/ggi/intf_ggi.o \
277 plugins/ggi/vout_ggi.o
279 PLUGIN_GLIDE = plugins/glide/glide.o \
280 plugins/glide/intf_glide.o \
281 plugins/glide/vout_glide.o
283 PLUGIN_GNOME = plugins/gnome/gnome.o \
284 plugins/gnome/intf_gnome.o \
285 plugins/gnome/intf_gnome_callbacks.o \
286 plugins/gnome/intf_gnome_interface.o \
287 plugins/gnome/intf_gnome_support.o \
288 plugins/gnome/vout_gnome.o
290 PLUGIN_MGA = plugins/mga/mga.o \
291 plugins/mga/intf_mga.o \
292 plugins/mga/vout_mga.o
294 PLUGIN_X11 = plugins/x11/x11.o \
295 plugins/x11/intf_x11.o \
296 plugins/x11/vout_x11.o
298 PLUGIN_YUV = plugins/yuv/yuv.o \
299 plugins/yuv/video_yuv.o \
300 plugins/yuv/video_yuv8.o \
301 plugins/yuv/video_yuv15.o \
302 plugins/yuv/video_yuv16.o \
303 plugins/yuv/video_yuv24.o \
304 plugins/yuv/video_yuv32.o
306 PLUGIN_YUVMMX = plugins/yuvmmx/yuvmmx.o \
307 plugins/yuvmmx/video_yuv.o \
308 plugins/yuvmmx/video_yuv8.o \
309 plugins/yuvmmx/video_yuv15.o \
310 plugins/yuvmmx/video_yuv16.o \
311 plugins/yuvmmx/video_yuv24.o \
312 plugins/yuvmmx/video_yuv32.o
314 PLUGIN_OBJ = $(PLUGIN_BEOS) $(PLUGIN_DSP) $(PLUGIN_DUMMY) $(PLUGIN_ESD) \
315 $(PLUGIN_FB) $(PLUGIN_GGI) $(PLUGIN_GLIDE) $(PLUGIN_GNOME) \
316 $(PLUGIN_MGA) $(PLUGIN_X11) $(PLUGIN_YUV) $(PLUGIN_YUVMMX)
318 # Other lists of files
320 C_OBJ := $(C_OBJ:%.o=src/%.o)
321 CPP_OBJ := $(CPP_OBJ:%.o=src/%.o)
322 ASM_OBJ := $(ASM_OBJ:%.o=src/%.o)
323 sources_c := $(C_OBJ:%.o=%.c)
324 dependancies := $(sources_c:%.c=.dep/%.d)
326 # All symbols must be exported
329 ################################################################################
331 ################################################################################
336 all: vlc @ALIASES@ plugins
339 rm -f $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ) $(PLUGIN_OBJ)
340 rm -f vlc @ALIASES@ lib/*.so
343 rm -f src/*/*.o plugins/*/*.o **/*~ *.log
344 rm -f Makefile include/defs.h include/config.h
345 rm -f config.status config.cache config.log
346 rm -f gmon.out core build-stamp
350 mkdir -p $(prefix)/bin
351 $(INSTALL) vlc $(prefix)/bin
352 mkdir -p $(prefix)/lib/videolan/vlc
353 $(INSTALL) -m 644 $(PLUGINS) $(prefix)/lib/videolan/vlc
354 mkdir -p $(prefix)/share/videolan
355 $(INSTALL) -m 644 share/*.psf $(prefix)/share/videolan
356 $(INSTALL) -m 644 share/*.png $(prefix)/share/videolan
360 @echo CCFLAGS: $(CCFLAGS)
361 @echo DCFLAGS: $(DCFLAGS)
362 @echo LCFLAGS: $(CCFLAGS)
364 # ugliest of all, but I have no time to do it -- sam
366 rm -rf /tmp/${SNAPSHOTDIR}
367 mkdir /tmp/${SNAPSHOTDIR}
368 cp -r * /tmp/${SNAPSHOTDIR}
369 (cd /tmp/${SNAPSHOTDIR} ; \
371 find . -type d -name CVS | xargs rm -rf ; \
372 find . -type f -name '.*.swp' | xargs rm -f ; \
374 tar czvf ${SNAPSHOTDIR}.tar.gz ${SNAPSHOTDIR} ; \
375 tar cIvf ${SNAPSHOTDIR}.tar.bz2 ${SNAPSHOTDIR} )
376 rm -rf /tmp/${SNAPSHOTDIR}
377 mv /tmp/${SNAPSHOTDIR}.tar.gz ..
378 mv /tmp/${SNAPSHOTDIR}.tar.bz2 ..
379 @echo "Sources are in ../${SNAPSHOTDIR}.tar.[gz,bz2]"
386 vlc: $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ)
388 $(CC) $(CCFLAGS) $(LCFLAGS) $(CFLAGS) -Xlinker -soname=_APP_ -o $@ $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ)
389 rm -f ./plugins/_APP_
390 ln -s ../vlc ./plugins/_APP_
392 $(CC) $(CCFLAGS) $(LCFLAGS) $(CFLAGS) --export-dynamic -rdynamic -o $@ $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ)
395 gvlc xvlc fbvlc ggivlc glidevlc: vlc
396 rm -f $@ && ln -s vlc $@
401 # Generic rules (see below)
403 $(dependancies): %.d: FORCE
404 @$(MAKE) -s --no-print-directory -f Makefile.dep $@
406 $(C_OBJ): %.o: Makefile.dep
407 $(C_OBJ): %.o: .dep/%.d
409 $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
411 $(CPP_OBJ): %.o: %.cpp
412 $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
414 $(ASM_OBJ): %.o: Makefile.dep
416 $(CC) $(CFLAGS) -c -o $@ $<
418 #$(PLUGIN_OBJ): %.so: Makefile.dep
419 #$(PLUGIN_OBJ): %.so: .dep/%.d
421 lib/beos.so: $(PLUGIN_BEOS)
422 $(CC) $(CCFLAGS) $(CFLAGS) $(LCFLAGS) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_
423 $(PLUGIN_BEOS): %.o: %.cpp
424 $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
426 lib/esd.so: $(PLUGIN_ESD)
427 ifneq (,$(findstring bsd,$(SYS)))
428 ld -shared -lesd -o $@ $^
430 ld -shared -laudiofile -lesd -o $@ $^
432 $(PLUGIN_ESD): %.o: %.c
433 $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
435 lib/dsp.so: $(PLUGIN_DSP)
437 $(PLUGIN_DSP): %.o: %.c
438 $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
440 lib/dummy.so: $(PLUGIN_DUMMY)
442 $(PLUGIN_DUMMY): %.o: %.c
443 $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
445 lib/fb.so: $(PLUGIN_FB)
447 $(PLUGIN_FB): %.o: %.c
448 $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
450 lib/x11.so: $(PLUGIN_X11)
451 ld -shared -L/usr/X11R6/lib -lX11 -lXext -o $@ $^
452 $(PLUGIN_X11): %.o: %.c
453 $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
455 lib/mga.so: $(PLUGIN_MGA)
456 ld -shared -L/usr/X11R6/lib -lX11 -lXext -o $@ $^
457 $(PLUGIN_MGA): %.o: %.c
458 $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
460 lib/gnome.so: $(PLUGIN_GNOME)
461 ld -shared `gnome-config --libs gnomeui | sed 's,-rdynamic,,'` -o $@ $^
462 $(PLUGIN_GNOME): %.o: %.c
463 $(CC) $(CCFLAGS) $(CFLAGS) `gnome-config --cflags gnomeui` -c -o $@ $<
465 lib/glide.so: $(PLUGIN_GLIDE)
466 ld -shared -lglide2x -o $@ $^
467 $(PLUGIN_GLIDE): %.o: %.c
468 $(CC) $(CCFLAGS) $(CFLAGS) -I/usr/include/glide -c -o $@ $<
470 lib/ggi.so: $(PLUGIN_GGI)
471 ld -shared -lggi -o $@ $^
472 $(PLUGIN_GGI): %.o: %.c
473 $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
475 lib/yuv.so: $(PLUGIN_YUV)
477 $(CC) $(CCFLAGS) $(CFLAGS) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_
481 $(PLUGIN_YUV): %.o: %.c
482 $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
484 lib/yuvmmx.so: $(PLUGIN_YUVMMX)
486 $(CC) $(CCFLAGS) $(CFLAGS) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_
490 $(PLUGIN_YUVMMX): %.o: %.c
491 $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
493 ################################################################################
494 # Note on generic rules and dependancies
495 ################################################################################
497 # Note on dependancies: each .c file is associated with a .d file, which
498 # depends of it. The .o file associated with a .c file depends of the .d, of the
499 # .c itself, and of Makefile. The .d files are stored in a separate .dep/
501 # The dep directory should be ignored by CVS.
503 # Note on inclusions: depending of the target, the dependancies files must
504 # or must not be included. The problem is that if we ask make to include a file,
505 # and this file does not exist, it is made before it can be included. In a
506 # general way, a .d file should be included if and only if the corresponding .o
507 # needs to be re-made.
509 # Two makefiles are used: the main one (this one) has regular generic rules,
510 # except for .o files, for which it calls the object Makefile. Dependancies
511 # are not included in this file.
512 # The object Makefile known how to make a .o from a .c, and includes
513 # dependancies for the target, but only those required.