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
37 # PROGRAM_BUILD is a complete identification of the build
38 # ( we can't use fancy options with date since OSes like Solaris
39 # or FreeBSD have strange date implementations )
40 PROGRAM_BUILD = `date` $(USER)
41 # XXX: beos does not support hostname
42 #PROGRAM_BUILD = `date` $(USER)@`hostname`
44 # DEFINE will contain some of the constants definitions decided in Makefile,
45 # including SYS_xx. It will be passed to C compiler.
46 DEFINE += -DSYS_$(shell echo $(SYS) | sed 's/-.*//' | tr a-z A-Z)
47 DEFINE += -DPLUGIN_PATH="\"$(prefix)/lib/videolan/vlc\""
48 DEFINE += -DDATA_PATH="\"$(prefix)/share/videolan/vlc\""
50 ################################################################################
51 # Tuning and other variables - do not change anything except if you know
52 # exactly what you are doing
53 ################################################################################
56 # C headers directories
58 INCLUDE += -Iinclude -I/usr/local/include -I/usr/X11R6/include
68 ifneq (,$(findstring bsd,$(SYS)))
69 LIB += -pthread -lgnugetopt
70 LIB += -L/usr/local/lib
73 ifneq (,$(findstring linux,$(SYS)))
78 LIB += -lbe -lroot -lgame
84 # C compiler flags: compilation
86 CCFLAGS += $(DEFINE) $(INCLUDE)
88 CCFLAGS += -D_REENTRANT
89 CCFLAGS += -D_GNU_SOURCE
91 # flags needed for clean beos compilation
92 CCFLAGS += -Wno-multichar -Wno-ctor-dtor-privacy -Woverloaded-virtual
94 # Optimizations : don't compile debug versions with them
97 CCFLAGS += -ffast-math -funroll-loops -fargument-noalias-global
98 CCFLAGS += -fomit-frame-pointer
100 # Optimizations for x86 familiy
101 ifneq (,$(findstring 86,$(ARCH)))
102 CCFLAGS += -malign-double
103 #CCFLAGS += -march=pentium
104 # Eventual Pentium Pro optimizations
105 ifneq (,$(findstring pentiumpro,$(ARCH)))
107 CCFLAGS += -march=pentiumpro
110 # Eventual MMX optimizations for x86
111 ifneq (,$(findstring mmx,$(ARCH)))
116 # Optimizations for PowerPC
117 ifneq (,$(findstring ppc,$(ARCH)))
118 CCFLAGS += -mcpu=604e -mmultiple -mhard-float -mstring
121 # Optimizations for Sparc
122 ifneq (,$(findstring sparc,$(ARCH)))
123 CCFLAGS += -mhard-float
126 # End of optimizations
130 # C compiler flags: dependancies
132 DCFLAGS += $(INCLUDE)
136 # C compiler flags: linking
143 # Additionnal debugging flags
146 # Debugging and profiling support
151 #################################################################################
153 #################################################################################
158 interface_obj = interface/main.o \
159 interface/interface.o \
160 interface/intf_msg.o \
161 interface/intf_cmd.o \
162 interface/intf_ctrl.o \
163 interface/intf_console.o
165 input_obj = input/input_vlan.o \
167 input/input_netlist.o \
168 input/input_network.o \
174 audio_output_obj = audio_output/audio_output.o
176 video_output_obj = video_output/video_output.o \
177 video_output/video_text.o \
178 video_output/video_spu.o \
179 video_output/video_yuv.o
181 ac3_decoder_obj = ac3_decoder/ac3_decoder_thread.o \
182 ac3_decoder/ac3_decoder.o \
183 ac3_decoder/ac3_parse.o \
184 ac3_decoder/ac3_exponent.o \
185 ac3_decoder/ac3_bit_allocate.o \
186 ac3_decoder/ac3_mantissa.o \
187 ac3_decoder/ac3_rematrix.o \
188 ac3_decoder/ac3_imdct.o \
189 ac3_decoder/ac3_downmix.o
191 lpcm_decoder_obj = lpcm_decoder/lpcm_decoder_thread.o \
192 lpcm_decoder/lpcm_decoder.o
194 audio_decoder_obj = audio_decoder/audio_decoder_thread.o \
195 audio_decoder/audio_decoder.o \
196 audio_decoder/audio_math.o
198 spu_decoder_obj = spu_decoder/spu_decoder.o
200 #??generic_decoder_obj = generic_decoder/generic_decoder.o
201 # remeber to add it to OBJ
203 video_parser_obj = video_parser/video_parser.o \
204 video_parser/vpar_headers.o \
205 video_parser/vpar_blocks.o \
206 video_parser/vpar_synchro.o \
207 video_parser/video_fifo.o
209 video_decoder_obj = video_decoder/video_decoder.o \
210 video_decoder/vdec_motion.o \
211 video_decoder/vdec_motion_inner.o \
212 video_decoder/vdec_idct.o
214 misc_obj = misc/mtime.o \
221 C_OBJ = $(interface_obj) \
223 $(audio_output_obj) \
224 $(video_output_obj) \
226 $(lpcm_decoder_obj) \
227 $(audio_decoder_obj) \
229 $(generic_decoder_obj) \
230 $(video_parser_obj) \
231 $(video_decoder_obj) \
236 CPP_OBJ = misc/beos_specific.o
242 ifneq (,$(findstring 86,$(ARCH)))
243 ifneq (,$(findstring mmx,$(ARCH)))
244 ASM_OBJ = video_decoder/vdec_idctmmx.o \
245 video_output/video_yuv_mmx.o
252 intf_plugin = $(INTF:%=plugins/intf/intf_%.so)
253 aout_plugin = $(AOUT:%=plugins/aout/aout_%.so)
254 vout_plugin = $(VOUT:%=plugins/vout/vout_%.so)
256 PLUGIN_OBJ = $(intf_plugin) $(aout_plugin) $(vout_plugin)
259 # Other lists of files
261 C_OBJ := $(C_OBJ:%.o=src/%.o)
262 CPP_OBJ := $(CPP_OBJ:%.o=src/%.o)
263 ASM_OBJ := $(ASM_OBJ:%.o=src/%.o)
264 sources_c := $(C_OBJ:%.o=%.c)
265 dependancies := $(sources_c:%.c=.dep/%.d)
267 # All symbols must be exported
270 ################################################################################
272 ################################################################################
280 rm -f $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ) $(PLUGIN_OBJ)
283 rm -f */*/*.o plugins/*/*.so **/*~ *.log
284 rm -f Makefile include/defs.h include/config.h
285 rm -f config.status config.cache config.log
286 rm -f vlc gmon.out core build-stamp
290 $(INSTALL) vlc $(prefix)/bin
291 mkdir -p $(prefix)/lib/videolan/vlc
292 mkdir -p $(prefix)/share/videolan/vlc
293 $(INSTALL) $(PLUGIN_OBJ) $(prefix)/lib/videolan/vlc
294 $(INSTALL) share/*.psf $(prefix)/share/videolan/vlc
295 $(INSTALL) share/*.png $(prefix)/share/videolan/vlc
298 @echo "Command line for C objects:"
299 @echo $(CC) $(CCFLAGS) $(CFLAGS) -c -o "<dest.o>" "<src.c>"
301 @echo "Command line for assembler objects:"
302 @echo $(CC) $(CFLAGS) -c -o "<dest.o>" "<src.S>"
304 # ugliest of all, but I have no time to do it -- sam
306 rm -rf /tmp/${SNAPSHOTDIR}
307 mkdir /tmp/${SNAPSHOTDIR}
308 cp -r * /tmp/${SNAPSHOTDIR}
309 (cd /tmp/${SNAPSHOTDIR} ; \
311 find . -type d -name CVS | xargs rm -rf ; \
312 find . -type f -name '.*.swp' | xargs rm -f ; \
314 tar czvf ${SNAPSHOTDIR}.tar.gz ${SNAPSHOTDIR} )
315 rm -rf /tmp/${SNAPSHOTDIR}
316 mv /tmp/${SNAPSHOTDIR}.tar.gz ..
317 @echo "Sources are in ../${SNAPSHOTDIR}.tar.gz"
320 dpkg-buildpackage -rfakeroot -us -uc
330 vlc: $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ)
332 $(CC) $(CCFLAGS) $(LCFLAGS) $(CFLAGS) -Xlinker -soname=_APP_ -o $@ $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ)
333 rm -f ./plugins/_APP_
334 ln -s ../vlc ./plugins/_APP_
336 $(CC) $(CCFLAGS) $(LCFLAGS) $(CFLAGS) --export-dynamic -rdynamic -o $@ $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ)
339 plugins: $(PLUGIN_OBJ)
342 # Generic rules (see below)
344 $(dependancies): %.d: FORCE
345 @$(MAKE) -s --no-print-directory -f Makefile.dep $@
347 $(C_OBJ): %.o: Makefile.dep
348 $(C_OBJ): %.o: .dep/%.d
350 $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
352 $(CPP_OBJ): %.o: %.cpp
353 $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
355 $(ASM_OBJ): %.o: Makefile.dep
357 $(CC) $(CFLAGS) -c -o $@ $<
359 #$(PLUGIN_OBJ): %.so: Makefile.dep
360 #$(PLUGIN_OBJ): %.so: .dep/%.d
363 plugins/aout/aout_dummy.so plugins/aout/aout_dsp.so: %.so: %.c
365 $(CC) $(CCFLAGS) $(CFLAGS) -nostart -Xlinker -soname=$@ -o $@ $< plugins/_APP_
367 $(CC) $(CCFLAGS) $(CFLAGS) -shared -o $@ $<
370 plugins/aout/aout_esd.so: %.so: %.c
371 ifneq (,$(findstring bsd,$(SYS)))
372 $(CC) $(CCFLAGS) $(CFLAGS) -lesd -shared -o $@ $<
374 $(CC) $(CCFLAGS) $(CFLAGS) -laudiofile -lesd -shared -o $@ $<
377 plugins/aout/aout_beos.so: %.so: %.cpp
378 $(CC) $(LCFLAGS) $(CCFLAGS) $(CFLAGS) -nostart -Xlinker -soname=$@ -o $@ $< plugins/_APP_
381 plugins/intf/intf_dummy.so plugins/vout/vout_dummy.so \
382 plugins/intf/intf_fb.so plugins/vout/vout_fb.so: %.so: %.c
384 $(CC) $(CCFLAGS) $(CFLAGS) -nostart -Xlinker -soname=$@ -o $@ $< plugins/_APP_
386 $(CC) $(CCFLAGS) $(CFLAGS) -shared -o $@ $<
389 plugins/intf/intf_x11.so plugins/vout/vout_x11.so: %.so: %.c
390 $(CC) $(CCFLAGS) $(CFLAGS) -I/usr/X11R6/include -L/usr/X11R6/lib -lX11 -lXext -shared -o $@ $<
392 plugins/intf/intf_mga.so plugins/vout/vout_mga.so: %.so: %.c
393 $(CC) $(CCFLAGS) $(CFLAGS) -I/usr/X11R6/include -L/usr/X11R6/lib -lX11 -lXext -shared -o $@ $<
395 plugins/intf/intf_gnome.so: %.so: %.c
396 $(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
398 plugins/vout/vout_gnome.so: %.so: %.c
399 $(CC) $(CCFLAGS) $(CFLAGS) -I/usr/X11R6/include -L/usr/X11R6/lib -lX11 -lXext -shared -o $@ $<
401 plugins/intf/intf_glide.so plugins/vout/vout_glide.so: %.so: %.c
402 $(CC) $(CCFLAGS) $(CFLAGS) -I/usr/include/glide -lglide2x -shared -o $@ $<
404 plugins/intf/intf_ggi.so plugins/vout/vout_ggi.so: %.so: %.c
405 $(CC) $(CCFLAGS) $(CFLAGS) -lggi -shared -o $@ $<
407 plugins/intf/intf_beos.so: %.so: %.cpp
408 $(CC) $(LCFLAGS) $(CCFLAGS) $(CFLAGS) -nostart -Xlinker -soname=$@ -o $@ $< plugins/_APP_
410 plugins/vout/vout_beos.so: %.so: %.cpp
411 $(CC) $(LCFLAGS) $(CCFLAGS) $(CFLAGS) -nostart -Xlinker -soname=$@ -o $@ $< plugins/_APP_
414 ################################################################################
415 # Note on generic rules and dependancies
416 ################################################################################
418 # Note on dependancies: each .c file is associated with a .d file, which
419 # depends of it. The .o file associated with a .c file depends of the .d, of the
420 # .c itself, and of Makefile. The .d files are stored in a separate .dep/
422 # The dep directory should be ignored by CVS.
424 # Note on inclusions: depending of the target, the dependancies files must
425 # or must not be included. The problem is that if we ask make to include a file,
426 # and this file does not exist, it is made before it can be included. In a
427 # general way, a .d file should be included if and only if the corresponding .o
428 # needs to be re-made.
430 # Two makefiles are used: the main one (this one) has regular generic rules,
431 # except for .o files, for which it calls the object Makefile. Dependancies
432 # are not included in this file.
433 # The object Makefile known how to make a .o from a .c, and includes
434 # dependancies for the target, but only those required.