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)
44 DEFINE += -DPLUGIN_PATH="\"$(prefix)/lib/videolan/vlc\""
45 DEFINE += -DDATA_PATH="\"$(prefix)/share/videolan/vlc\""
47 ################################################################################
48 # Tuning and other variables - do not change anything except if you know
49 # exactly what you are doing
50 ################################################################################
53 # C headers directories
55 INCLUDE += -Iinclude -I/usr/local/include -I/usr/X11R6/include
65 ifneq (,$(findstring bsd,$(SYS)))
66 LIB += -pthread -lgnugetopt
67 LIB += -L/usr/local/lib
70 ifneq (,$(findstring linux,$(SYS)))
75 LIB += -lbe -lroot -lgame
81 # C compiler flags: compilation
83 CCFLAGS += $(DEFINE) $(INCLUDE)
85 CCFLAGS += -D_REENTRANT
86 CCFLAGS += -D_GNU_SOURCE
88 # flags needed for clean beos compilation
89 CCFLAGS += -Wno-multichar -Wno-ctor-dtor-privacy -Woverloaded-virtual
91 # Optimizations : don't compile debug versions with them
94 CCFLAGS += -ffast-math -funroll-loops -fargument-noalias-global
95 CCFLAGS += -fomit-frame-pointer
97 # Optimizations for x86 familiy
98 ifneq (,$(findstring 86,$(ARCH)))
99 CCFLAGS += -malign-double
100 #CCFLAGS += -march=pentium
101 # Eventual Pentium Pro optimizations
102 ifneq (,$(findstring pentiumpro,$(ARCH)))
104 CCFLAGS += -march=pentiumpro
107 # Eventual MMX optimizations for x86
108 ifneq (,$(findstring mmx,$(ARCH)))
113 # Optimizations for PowerPC
114 ifneq (,$(findstring ppc,$(ARCH)))
115 CCFLAGS += -mcpu=604e -mmultiple -mhard-float -mstring
118 # Optimizations for Sparc
119 ifneq (,$(findstring sparc,$(ARCH)))
120 CCFLAGS += -mhard-float
123 # End of optimizations
127 # C compiler flags: dependancies
129 DCFLAGS += $(INCLUDE)
133 # C compiler flags: linking
140 # Additionnal debugging flags
143 # Debugging and profiling support
148 #################################################################################
150 #################################################################################
155 interface_obj = interface/main.o \
156 interface/interface.o \
157 interface/intf_msg.o \
158 interface/intf_cmd.o \
159 interface/intf_ctrl.o \
160 interface/intf_console.o
162 input_obj = input/input_vlan.o \
164 input/input_netlist.o \
165 input/input_network.o \
171 audio_output_obj = audio_output/audio_output.o
173 video_output_obj = video_output/video_output.o \
174 video_output/video_text.o \
175 video_output/video_spu.o \
176 video_output/video_yuv.o
178 ac3_decoder_obj = ac3_decoder/ac3_decoder_thread.o \
179 ac3_decoder/ac3_decoder.o \
180 ac3_decoder/ac3_parse.o \
181 ac3_decoder/ac3_exponent.o \
182 ac3_decoder/ac3_bit_allocate.o \
183 ac3_decoder/ac3_mantissa.o \
184 ac3_decoder/ac3_rematrix.o \
185 ac3_decoder/ac3_imdct.o \
186 ac3_decoder/ac3_downmix.o
188 lpcm_decoder_obj = lpcm_decoder/lpcm_decoder_thread.o \
189 lpcm_decoder/lpcm_decoder.o
191 audio_decoder_obj = audio_decoder/audio_decoder_thread.o \
192 audio_decoder/audio_decoder.o \
193 audio_decoder/audio_math.o
195 spu_decoder_obj = spu_decoder/spu_decoder.o
197 #??generic_decoder_obj = generic_decoder/generic_decoder.o
198 # remeber to add it to OBJ
200 video_parser_obj = video_parser/video_parser.o \
201 video_parser/vpar_headers.o \
202 video_parser/vpar_blocks.o \
203 video_parser/vpar_synchro.o \
204 video_parser/video_fifo.o
206 video_decoder_obj = video_decoder/video_decoder.o \
207 video_decoder/vdec_motion.o \
208 video_decoder/vdec_motion_inner.o \
209 video_decoder/vdec_idct.o
211 misc_obj = misc/mtime.o \
218 C_OBJ = $(interface_obj) \
220 $(audio_output_obj) \
221 $(video_output_obj) \
223 $(lpcm_decoder_obj) \
224 $(audio_decoder_obj) \
226 $(generic_decoder_obj) \
227 $(video_parser_obj) \
228 $(video_decoder_obj) \
233 CPP_OBJ = misc/beos_specific.o
239 ifneq (,$(findstring 86,$(ARCH)))
240 ifneq (,$(findstring mmx,$(ARCH)))
241 ASM_OBJ = video_decoder/vdec_idctmmx.o \
242 video_output/video_yuv_mmx.o
249 PLUGINS := $(PLUGINS:%=lib/%.so)
251 PLUGIN_BEOS = plugins/beos/aout_beos.o \
252 plugins/beos/intf_beos.o \
253 plugins/beos/vout_beos.o
255 PLUGIN_DSP = plugins/dsp/aout_dsp.o
257 PLUGIN_DUMMY = plugins/dummy/aout_dummy.o \
258 plugins/dummy/intf_dummy.o \
259 plugins/dummy/vout_dummy.o
261 PLUGIN_ESD = plugins/esd/aout_esd.o
263 PLUGIN_FB = plugins/fb/intf_fb.o \
266 PLUGIN_GGI = plugins/ggi/intf_ggi.o \
267 plugins/ggi/vout_ggi.o
269 PLUGIN_GLIDE = plugins/glide/intf_glide.o \
270 plugins/glide/vout_glide.o
272 PLUGIN_GNOME = plugins/gnome/intf_gnome.o \
273 plugins/gnome/intf_gnome_callbacks.o \
274 plugins/gnome/intf_gnome_interface.o \
275 plugins/gnome/intf_gnome_support.o \
276 plugins/gnome/vout_gnome.o
278 PLUGIN_MGA = plugins/mga/intf_mga.o \
279 plugins/fb/vout_mga.o
281 PLUGIN_X11 = plugins/x11/intf_x11.o \
282 plugins/x11/vout_x11.o
284 PLUGIN_OBJ = $(PLUGIN_BEOS) $(PLUGIN_DSP) $(PLUGIN_DUMMY) $(PLUGIN_ESD) \
285 $(PLUGIN_FB) $(PLUGIN_GGI) $(PLUGIN_GLIDE) $(PLUGIN_GNOME) \
286 $(PLUGIN_MGA) $(PLUGIN_X11)
288 # Other lists of files
290 C_OBJ := $(C_OBJ:%.o=src/%.o)
291 CPP_OBJ := $(CPP_OBJ:%.o=src/%.o)
292 ASM_OBJ := $(ASM_OBJ:%.o=src/%.o)
293 sources_c := $(C_OBJ:%.o=%.c)
294 dependancies := $(sources_c:%.c=.dep/%.d)
296 # All symbols must be exported
299 ################################################################################
301 ################################################################################
309 rm -f $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ) $(PLUGIN_OBJ)
312 rm -f src/*/*.o plugins/*/*.o lib/*.so **/*~ *.log
313 rm -f Makefile include/defs.h include/config.h
314 rm -f config.status config.cache config.log
315 rm -f vlc gmon.out core build-stamp
319 $(INSTALL) vlc $(prefix)/bin
320 mkdir -p $(prefix)/lib/videolan/vlc
321 mkdir -p $(prefix)/share/videolan/vlc
322 $(INSTALL) -m 644 $(PLUGINS) $(prefix)/lib/videolan/vlc
323 $(INSTALL) -m 644 share/*.psf $(prefix)/share/videolan/vlc
324 $(INSTALL) -m 644 share/*.png $(prefix)/share/videolan/vlc
327 @echo "Command line for C objects:"
328 @echo $(CC) $(CCFLAGS) $(CFLAGS) -c -o "<dest.o>" "<src.c>"
330 @echo "Command line for assembler objects:"
331 @echo $(CC) $(CFLAGS) -c -o "<dest.o>" "<src.S>"
333 # ugliest of all, but I have no time to do it -- sam
335 rm -rf /tmp/${SNAPSHOTDIR}
336 mkdir /tmp/${SNAPSHOTDIR}
337 cp -r * /tmp/${SNAPSHOTDIR}
338 (cd /tmp/${SNAPSHOTDIR} ; \
340 find . -type d -name CVS | xargs rm -rf ; \
341 find . -type f -name '.*.swp' | xargs rm -f ; \
343 tar czvf ${SNAPSHOTDIR}.tar.gz ${SNAPSHOTDIR} )
344 rm -rf /tmp/${SNAPSHOTDIR}
345 mv /tmp/${SNAPSHOTDIR}.tar.gz ..
346 @echo "Sources are in ../${SNAPSHOTDIR}.tar.gz"
353 vlc: $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ)
355 $(CC) $(CCFLAGS) $(LCFLAGS) $(CFLAGS) -Xlinker -soname=_APP_ -o $@ $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ)
356 rm -f ./plugins/_APP_
357 ln -s ../vlc ./plugins/_APP_
359 $(CC) $(CCFLAGS) $(LCFLAGS) $(CFLAGS) --export-dynamic -rdynamic -o $@ $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ)
365 # Generic rules (see below)
367 $(dependancies): %.d: FORCE
368 @$(MAKE) -s --no-print-directory -f Makefile.dep $@
370 $(C_OBJ): %.o: Makefile.dep
371 $(C_OBJ): %.o: .dep/%.d
373 $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
375 $(CPP_OBJ): %.o: %.cpp
376 $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
378 $(ASM_OBJ): %.o: Makefile.dep
380 $(CC) $(CFLAGS) -c -o $@ $<
382 #$(PLUGIN_OBJ): %.so: Makefile.dep
383 #$(PLUGIN_OBJ): %.so: .dep/%.d
385 #$(CC) $(LCFLAGS) $(CCFLAGS) $(CFLAGS) -nostart -Xlinker -soname=$@ -o $@ $< plugins/_APP_
387 lib/beos.so: $(PLUGIN_BEOS)
388 ld -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_
389 $(PLUGIN_BEOS): %.o: %.c
390 $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
392 lib/esd.so: $(PLUGIN_ESD)
393 ifneq (,$(findstring bsd,$(SYS)))
394 ld -shared -lesd -o $@ $^
396 ld -shared -laudiofile -lesd -o $@ $^
398 $(PLUGIN_ESD): %.o: %.c
399 $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
401 lib/dummy.so: $(PLUGIN_DUMMY)
403 $(PLUGIN_DUMMY): %.o: %.c
404 $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
406 lib/fb.so: $(PLUGIN_FB)
408 $(PLUGIN_FB): %.o: %.c
409 $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
411 lib/x11.so: $(PLUGIN_X11)
412 ld -shared -L/usr/X11R6/lib -lX11 -lXext -o $@ $^
413 $(PLUGIN_X11): %.o: %.c
414 $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
416 lib/mga.so: $(PLUGIN_MGA)
417 ld -shared -L/usr/X11R6/lib -lX11 -lXext -o $@ $^
418 $(PLUGIN_MGA): %.o: %.c
419 $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
421 lib/gnome.so: $(PLUGIN_GNOME)
422 ld -shared `gnome-config --libs gnomeui | sed 's,-rdynamic,,'` -o $@ $^
423 $(PLUGIN_GNOME): %.o: %.c
424 $(CC) $(CCFLAGS) $(CFLAGS) `gnome-config --cflags gnomeui`-c -o $@ $<
426 lib/glide.so: $(PLUGIN_GLIDE)
427 ld -shared -lglide2x -o $@ $^
428 $(PLUGIN_GLIDE): %.o: %.c
429 $(CC) $(CCFLAGS) $(CFLAGS) -I/usr/include/glide -c -o $@ $<
431 lib/ggi.so: $(PLUGIN_GGI)
432 ld -shared -lggi -o $@ $^
433 $(PLUGIN_GGI): %.o: %.c
434 $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
436 ################################################################################
437 # Note on generic rules and dependancies
438 ################################################################################
440 # Note on dependancies: each .c file is associated with a .d file, which
441 # depends of it. The .o file associated with a .c file depends of the .d, of the
442 # .c itself, and of Makefile. The .d files are stored in a separate .dep/
444 # The dep directory should be ignored by CVS.
446 # Note on inclusions: depending of the target, the dependancies files must
447 # or must not be included. The problem is that if we ask make to include a file,
448 # and this file does not exist, it is made before it can be included. In a
449 # general way, a .d file should be included if and only if the corresponding .o
450 # needs to be re-made.
452 # Two makefiles are used: the main one (this one) has regular generic rules,
453 # except for .o files, for which it calls the object Makefile. Dependancies
454 # are not included in this file.
455 # The object Makefile known how to make a .o from a .c, and includes
456 # dependancies for the target, but only those required.