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)
20 SNAPSHOTDIR=vlc-@VLC_VERSION@
24 #----------------- do not change anything below this line ----------------------
26 ################################################################################
27 # Configuration pre-processing
28 ################################################################################
30 # PROGRAM_OPTIONS is an identification string of the compilation options
31 PROGRAM_OPTIONS = $(SYS) $(ARCH)
33 PROGRAM_OPTIONS += DEBUG
36 # PROGRAM_BUILD is a complete identification of the build
37 # ( we can't use fancy options with date since OSes like Solaris
38 # or FreeBSD have strange date implementations )
39 PROGRAM_BUILD = `date` $(USER)
40 # XXX: beos does not support hostname
41 #PROGRAM_BUILD = `date` $(USER)@`hostname`
43 # DEFINE will contain some of the constants definitions decided in Makefile,
44 # including SYS_xx. It will be passed to C compiler.
45 DEFINE += -DSYS_$(shell echo $(SYS) | sed 's/-.*//' | tr a-z A-Z)
46 DEFINE += -DPLUGIN_PATH="\"$(prefix)/lib/videolan/vlc\""
47 DEFINE += -DDATA_PATH="\"$(prefix)/share/videolan/vlc\""
48 #DEFINE += -DPROGRAM_OPTIONS="\"$(shell echo $(PROGRAM_OPTIONS) | tr 'A-Z' 'a-z')\""
49 #DEFINE += -DPROGRAM_BUILD="\"$(PROGRAM_BUILD)\""
54 ################################################################################
55 # Tuning and other variables - do not change anything except if you know
56 # exactly what you are doing
57 ################################################################################
60 # C headers directories
62 INCLUDE += -Iinclude -I/usr/local/include -I/usr/X11R6/include
72 ifneq (,$(findstring bsd,$(SYS)))
73 LIB += -pthread -lgnugetopt
74 LIB += -L/usr/local/lib
77 ifneq (,$(findstring linux,$(SYS)))
82 LIB += -lbe -lroot -lgame
88 # C compiler flags: compilation
90 CCFLAGS += $(DEFINE) $(INCLUDE)
92 CCFLAGS += -D_REENTRANT
93 CCFLAGS += -D_GNU_SOURCE
95 # flags needed for clean beos compilation
96 CCFLAGS += -Wno-multichar -Wno-ctor-dtor-privacy -Woverloaded-virtual
98 # Optimizations : don't compile debug versions with them
100 CCFLAGS += -ffast-math -funroll-loops -fargument-noalias-global
101 CCFLAGS += -fomit-frame-pointer
103 # Optimizations for x86 familiy
104 ifneq (,$(findstring 86,$(ARCH)))
105 CCFLAGS += -malign-double
106 #CCFLAGS += -march=pentium
107 # Eventual Pentium Pro optimizations
108 ifneq (,$(findstring pentiumpro,$(ARCH)))
110 CCFLAGS += -march=pentiumpro
113 # Eventual MMX optimizations for x86
114 ifneq (,$(findstring mmx,$(ARCH)))
119 # Optimizations for PowerPC
120 ifneq (,$(findstring ppc,$(ARCH)))
121 CCFLAGS += -mcpu=604e -mmultiple -mhard-float -mstring
124 # Optimizations for Sparc
125 ifneq (,$(findstring sparc,$(ARCH)))
126 CCFLAGS += -mhard-float
130 # C compiler flags: dependancies
132 DCFLAGS += $(INCLUDE)
136 # C compiler flags: linking
143 # Additionnal debugging flags
152 #################################################################################
154 #################################################################################
159 interface_obj = interface/main.o \
160 interface/interface.o \
161 interface/intf_msg.o \
162 interface/intf_cmd.o \
163 interface/intf_ctrl.o \
164 interface/intf_console.o
166 input_obj = input/input_vlan.o \
168 input/input_netlist.o \
169 input/input_network.o \
175 audio_output_obj = audio_output/audio_output.o
177 video_output_obj = video_output/video_output.o \
178 video_output/video_text.o \
179 video_output/video_spu.o \
180 video_output/video_yuv.o
182 ac3_decoder_obj = ac3_decoder/ac3_decoder_thread.o \
183 ac3_decoder/ac3_decoder.o \
184 ac3_decoder/ac3_parse.o \
185 ac3_decoder/ac3_exponent.o \
186 ac3_decoder/ac3_bit_allocate.o \
187 ac3_decoder/ac3_mantissa.o \
188 ac3_decoder/ac3_rematrix.o \
189 ac3_decoder/ac3_imdct.o \
190 ac3_decoder/ac3_downmix.o
192 lpcm_decoder_obj = lpcm_decoder/lpcm_decoder_thread.o \
193 lpcm_decoder/lpcm_decoder.o
195 audio_decoder_obj = audio_decoder/audio_decoder_thread.o \
196 audio_decoder/audio_decoder.o \
197 audio_decoder/audio_math.o
199 spu_decoder_obj = spu_decoder/spu_decoder.o
201 #??generic_decoder_obj = generic_decoder/generic_decoder.o
202 # remeber to add it to OBJ
204 video_parser_obj = video_parser/video_parser.o \
205 video_parser/vpar_headers.o \
206 video_parser/vpar_blocks.o \
207 video_parser/vpar_synchro.o \
208 video_parser/video_fifo.o
210 video_decoder_obj = video_decoder/video_decoder.o \
211 video_decoder/vdec_motion.o \
212 video_decoder/vdec_motion_inner.o \
213 video_decoder/vdec_idct.o
215 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 intf_plugin = $(INTF:%=plugins/intf/intf_%.so)
254 aout_plugin = $(AOUT:%=plugins/aout/aout_%.so)
255 vout_plugin = $(VOUT:%=plugins/vout/vout_%.so)
257 PLUGIN_OBJ = $(intf_plugin) $(aout_plugin) $(vout_plugin)
260 # Other lists of files
262 C_OBJ := $(C_OBJ:%.o=src/%.o)
263 CPP_OBJ := $(CPP_OBJ:%.o=src/%.o)
264 ASM_OBJ := $(ASM_OBJ:%.o=src/%.o)
265 sources_c := $(C_OBJ:%.o=%.c)
266 dependancies := $(sources_c:%.c=.dep/%.d)
268 # All symbols must be exported
271 ################################################################################
273 ################################################################################
281 rm -f $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ) $(PLUGIN_OBJ)
284 rm -f */*/*.o plugins/*/*.so **/*~ *.log
285 rm -f Makefile include/defs.h include/config.h
286 rm -f config.status config.cache config.log
287 rm -f vlc gmon.out core
291 $(INSTALL) vlc $(prefix)/bin
292 mkdir -p $(prefix)/lib/videolan/vlc
293 mkdir -p $(prefix)/share/videolan/vlc
294 $(INSTALL) $(PLUGIN_OBJ) $(prefix)/lib/videolan/vlc
295 $(INSTALL) share/*.psf $(prefix)/share/videolan/vlc
296 $(INSTALL) share/*.png $(prefix)/share/videolan/vlc
299 @echo "Command line for C objects:"
300 @echo $(CC) $(CCFLAGS) $(CFLAGS) -c -o "<dest.o>" "<src.c>"
302 @echo "Command line for assembler objects:"
303 @echo $(CC) $(CFLAGS) -c -o "<dest.o>" "<src.S>"
305 # ugliest of all, but I have no time to do it -- sam
307 rm -rf /tmp/${SNAPSHOTDIR}
308 mkdir /tmp/${SNAPSHOTDIR}
309 cp -r * /tmp/${SNAPSHOTDIR}
310 (cd /tmp/${SNAPSHOTDIR} ; \
312 find . -type d -name CVS | xargs rm -rf ; \
313 find . -type f -name '.*.swp' | xargs rm -f ; \
315 tar czvf ${SNAPSHOTDIR}.tar.gz ${SNAPSHOTDIR} )
316 rm -rf /tmp/${SNAPSHOTDIR}
317 mv /tmp/${SNAPSHOTDIR}.tar.gz ..
318 @echo "Sources are in ../${SNAPSHOTDIR}.tar.gz"
325 vlc: $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ)
327 $(CC) $(CCFLAGS) $(LCFLAGS) $(CFLAGS) -Xlinker -soname=_APP_ -o $@ $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ)
328 # ln -s ../vlc ./plugins/_APP_
330 $(CC) $(CCFLAGS) $(LCFLAGS) $(CFLAGS) --export-dynamic -rdynamic -o $@ $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ)
333 plugins: $(PLUGIN_OBJ)
336 # Generic rules (see below)
338 $(dependancies): %.d: FORCE
339 @$(MAKE) -s --no-print-directory -f Makefile.dep $@
341 $(C_OBJ): %.o: Makefile.dep
342 $(C_OBJ): %.o: .dep/%.d
344 $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
346 $(CPP_OBJ): %.o: %.cpp
347 $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
349 $(ASM_OBJ): %.o: Makefile.dep
351 $(CC) $(CFLAGS) -c -o $@ $<
353 #$(PLUGIN_OBJ): %.so: Makefile.dep
354 #$(PLUGIN_OBJ): %.so: .dep/%.d
357 plugins/aout/aout_dummy.so plugins/aout/aout_dsp.so: %.so: %.c
359 $(CC) $(CCFLAGS) $(CFLAGS) -nostart -Xlinker -soname=$@ -o $@ $< plugins/_APP_
361 $(CC) $(CCFLAGS) $(CFLAGS) -shared -o $@ $<
364 plugins/aout/aout_esd.so: %.so: %.c
365 ifneq (,$(findstring bsd,$(SYS)))
366 $(CC) $(CCFLAGS) $(CFLAGS) -lesd -shared -o $@ $<
368 $(CC) $(CCFLAGS) $(CFLAGS) -laudiofile -lesd -shared -o $@ $<
372 plugins/intf/intf_dummy.so plugins/vout/vout_dummy.so \
373 plugins/intf/intf_fb.so plugins/vout/vout_fb.so: %.so: %.c
375 $(CC) $(CCFLAGS) $(CFLAGS) -nostart -Xlinker -soname=$@ -o $@ $< plugins/_APP_
377 $(CC) $(CCFLAGS) $(CFLAGS) -shared -o $@ $<
380 plugins/intf/intf_x11.so plugins/vout/vout_x11.so: %.so: %.c
381 $(CC) $(CCFLAGS) $(CFLAGS) -I/usr/X11R6/include -L/usr/X11R6/lib -lX11 -lXext -shared -o $@ $<
383 plugins/intf/intf_mga.so plugins/vout/vout_mga.so: %.so: %.c
384 $(CC) $(CCFLAGS) $(CFLAGS) -I/usr/X11R6/include -L/usr/X11R6/lib -lX11 -lXext -shared -o $@ $<
386 plugins/intf/intf_gnome.so: %.so: %.c
387 $(CC) $(CCFLAGS) $(CFLAGS) $(LCFLAGS) `gnome-config --libs --cflags gnomeui` -shared -o $@ $< plugins/intf/intf_gnome_callbacks.c plugins/intf/intf_gnome_interface.c plugins/intf/intf_gnome_support.c
389 plugins/vout/vout_gnome.so: %.so: %.c
390 $(CC) $(CCFLAGS) $(CFLAGS) -I/usr/X11R6/include -L/usr/X11R6/lib -lX11 -lXext -shared -o $@ $<
392 plugins/intf/intf_glide.so plugins/vout/vout_glide.so: %.so: %.c
393 $(CC) $(CCFLAGS) $(CFLAGS) -I/usr/include/glide -lglide2x -shared -o $@ $<
395 plugins/intf/intf_ggi.so plugins/vout/vout_ggi.so: %.so: %.c
396 $(CC) $(CCFLAGS) $(CFLAGS) -lggi -shared -o $@ $<
398 plugins/intf/intf_beos.so: %.so: %.cpp
399 $(CC) $(LCFLAGS) $(CCFLAGS) $(CFLAGS) -nostart -Xlinker -soname=$@ -o $@ $< plugins/_APP_
401 plugins/vout/vout_beos.so: %.so: %.cpp
402 $(CC) $(LCFLAGS) $(CCFLAGS) $(CFLAGS) -nostart -Xlinker -soname=$@ -o $@ $< plugins/_APP_
405 ################################################################################
406 # Note on generic rules and dependancies
407 ################################################################################
409 # Note on dependancies: each .c file is associated with a .d file, which
410 # depends of it. The .o file associated with a .c file depends of the .d, of the
411 # .c itself, and of Makefile. The .d files are stored in a separate .dep/
413 # The dep directory should be ignored by CVS.
415 # Note on inclusions: depending of the target, the dependancies files must
416 # or must not be included. The problem is that if we ask make to include a file,
417 # and this file does not exist, it is made before it can be included. In a
418 # general way, a .d file should be included if and only if the corresponding .o
419 # needs to be re-made.
421 # Two makefiles are used: the main one (this one) has regular generic rules,
422 # except for .o files, for which it calls the object Makefile. Dependancies
423 # are not included in this file.
424 # The object Makefile known how to make a .o from a .c, and includes
425 # dependancies for the target, but only those required.