]> git.sesse.net Git - vlc/blob - Makefile.in
. la version et le codename sont d�finis uniquement dans configure.in
[vlc] / Makefile.in
1 ################################################################################
2 # vlc (VideoLAN Client) main makefile
3 # (c)1998 VideoLAN
4 ################################################################################
5 # This makefile is the main makefile for the VideoLAN client.
6 ################################################################################
7
8 ################################################################################
9 # Configuration
10 ################################################################################
11
12 # Audio output settings
13 AUDIO = dsp
14 #AUDIO += esd
15 # Not yet supported
16 #AUDIO += alsa
17 # Fallback method that should always work
18 AUDIO += dummy
19
20 # Video output settings
21 VOUT = x11
22 #VOUT += fb
23 #VOUT += ggi
24 #VOUT += glide
25 # Not yet supported
26 #VOUT = beos
27 #VOUT += dga
28 # Fallback method that should always work
29 VOUT += dummy
30
31 # Interface settings
32 INTF = x11
33 #INTF += fb
34 #INTF += ggi
35 #INTF += glide
36 # Not yet supported
37 #INTF = beos
38 #INTF += dga
39 # Fallback method that should always work
40 INTF += dummy
41
42 # Target architecture
43 ARCH=X86
44 #ARCH=PPC
45 #ARCH=SPARC
46
47 # Target operating system
48 SYS=LINUX
49 #SYS=GNU
50 #SYS=BSD
51 #SYS=BEOS
52
53 # For x86 architecture, choose MMX support
54 ARCH += MMX
55 # For x86 architecture, optimize for Pentium Pro
56 # (choose NO if you get `Invalid instruction' errors)
57 ARCH += PPRO
58
59 # Decoder choice - ?? old decoder will be removed soon
60 #DECODER=old
61 DECODER=new
62
63 # Debugging mode on or off (set to 1 to activate)
64 DEBUG=0
65
66 #----------------- do not change anything below this line ----------------------
67
68 ################################################################################
69 # Configuration pre-processing
70 ################################################################################
71
72 # audio and video options
73 AUDIO := $(shell echo $(AUDIO) | tr 'A-Z' 'a-z')
74 VIDEO := $(shell echo $(VIDEO) | tr 'A-Z' 'a-z')
75
76 # PROGRAM_OPTIONS is an identification string of the compilation options
77 PROGRAM_OPTIONS = $(SYS) $(ARCH)
78 ifeq ($(DEBUG),1)
79 PROGRAM_OPTIONS += DEBUG
80 endif
81
82 # PROGRAM_BUILD is a complete identification of the build
83 # ( we can't use fancy options with date since OSes like Solaris
84 # or FreeBSD have strange date implementations )
85 PROGRAM_BUILD = `date` $(USER)
86 # XXX: beos does not support hostname
87 #PROGRAM_BUILD = `date` $(USER)@`hostname`
88
89 # DEFINE will contain some of the constants definitions decided in Makefile, 
90 # including ARCH_xx and SYS_xx. It will be passed to C compiler.
91 DEFINE += -DARCH_$(shell echo $(ARCH) | cut -f1 -d' ')
92 DEFINE += -DSYS_$(SYS)
93 DEFINE += -DPLUGIN_PATH="\"$(PREFIX)/lib/videolan/vlc\""
94 DEFINE += -DPROGRAM_VERSION="\"@VLC_VERSION@\""
95 DEFINE += -DPROGRAM_CODENAME="\"@VLC_CODENAME@\""
96 DEFINE += -DPROGRAM_OPTIONS="\"$(shell echo $(PROGRAM_OPTIONS) | tr 'A-Z' 'a-z')\""
97 DEFINE += -DPROGRAM_BUILD="\"$(PROGRAM_BUILD)\""
98 ifeq ($(DEBUG),1)
99 DEFINE += -DDEBUG
100 endif
101
102 ################################################################################
103 # Tuning and other variables - do not change anything except if you know
104 # exactly what you are doing
105 ################################################################################
106
107 #
108 # C headers directories
109 #
110 INCLUDE += -Iinclude -I/usr/local/include -I/usr/X11R6/include
111
112 #
113 # Libraries
114 #
115
116 ifeq ($(SYS),GNU)
117 LIB += -lthreads -ldl
118 endif
119
120 ifeq ($(SYS),BSD)
121 LIB += -pthread -lgnugetopt
122 LIB += -L/usr/local/lib
123 endif
124
125 ifeq ($(SYS),LINUX)
126 LIB += -lpthread -ldl
127 endif
128
129 ifeq ($SYS),BEOS)
130 LIB += -llibroot -llibgame -llibbe
131 endif
132
133 LIB += -lm
134
135 #
136 # C compiler flags: compilation
137 #
138 CCFLAGS += $(DEFINE) $(INCLUDE)
139 CCFLAGS += -Wall
140 CCFLAGS += -D_REENTRANT
141 CCFLAGS += -D_GNU_SOURCE
142
143 # Optimizations : don't compile debug versions with them
144 CCFLAGS += -O6
145 CCFLAGS += -ffast-math -funroll-loops -fargument-noalias-global
146 CCFLAGS += -fomit-frame-pointer
147
148 # Optimizations for x86 familiy
149 ifneq (,$(findstring X86,$(ARCH)))
150 CCFLAGS += -malign-double
151 #CCFLAGS += -march=pentium
152 # Eventual Pentium Pro optimizations
153 ifneq (,$(findstring PPRO,$(ARCH)))
154 ifneq ($(SYS), BSD)
155 CCFLAGS += -march=pentiumpro
156 endif
157 endif
158 # Eventual MMX optimizations for x86
159 ifneq (,$(findstring MMX,$(ARCH)))
160 CFLAGS += -DHAVE_MMX
161 endif
162 endif
163
164 # Optimizations for PowerPC
165 ifneq (,$(findstring PPC,$(ARCH)))
166 CCFLAGS += -mcpu=604e -mmultiple -mhard-float -mstring
167 endif
168
169 # Optimizations for Sparc
170 ifneq (,$(findstring SPARC,$(ARCH)))
171 CCFLAGS += -mhard-float
172 endif
173
174 #
175 # C compiler flags: dependancies
176 #
177 DCFLAGS += $(INCLUDE)
178 DCFLAGS += -MM
179
180 #
181 # C compiler flags: linking
182 #
183 LCFLAGS += $(LIB)
184 LCFLAGS += -Wall
185 #LCFLAGS += -s
186
187 #
188 # Additionnal debugging flags
189 #
190
191 # Debugging support
192 ifeq ($(DEBUG),1)
193 CFLAGS += -g
194 #CFLAGS += -pg
195 endif
196
197 #################################################################################
198 # Objects and files
199 #################################################################################
200
201 #
202 # C Objects
203
204 interface_obj =                 interface/main.o \
205                                                 interface/interface.o \
206                                                 interface/intf_msg.o \
207                                                 interface/intf_cmd.o \
208                                                 interface/intf_ctrl.o \
209                                                 interface/intf_console.o
210
211 input_obj =                     input/input_vlan.o \
212                                                 input/input_file.o \
213                                                 input/input_netlist.o \
214                                                 input/input_network.o \
215                                                 input/input_ctrl.o \
216                                                 input/input_pcr.o \
217                                                 input/input_psi.o \
218                                                 input/input.o
219
220 audio_output_obj =              audio_output/audio_output.o
221
222 video_output_obj =              video_output/video_output.o \
223                                                 video_output/video_text.o \
224                                                 video_output/video_yuv.o
225
226 ac3_decoder_obj =               ac3_decoder/ac3_decoder_thread.o \
227                                                 ac3_decoder/ac3_decoder.o \
228                                                 ac3_decoder/ac3_parse.o \
229                                                 ac3_decoder/ac3_exponent.o \
230                                                 ac3_decoder/ac3_bit_allocate.o \
231                                                 ac3_decoder/ac3_mantissa.o \
232                                                 ac3_decoder/ac3_rematrix.o \
233                                                 ac3_decoder/ac3_imdct.o \
234                                                 ac3_decoder/ac3_downmix.o
235
236 audio_decoder_obj =             audio_decoder/audio_decoder.o \
237                                                 audio_decoder/audio_math.o
238
239 spu_decoder_obj =               spu_decoder/spu_decoder.o
240
241 #??generic_decoder_obj =                generic_decoder/generic_decoder.o
242 # remeber to add it to OBJ 
243
244 ifeq ($(DECODER),old)
245 CFLAGS += -DOLD_DECODER
246 video_decoder_obj =             video_decoder_ref/video_decoder.o \
247                                                 video_decoder_ref/display.o \
248                                                 video_decoder_ref/getblk.o \
249                                                 video_decoder_ref/gethdr.o \
250                                                 video_decoder_ref/getpic.o \
251                                                 video_decoder_ref/getvlc.o \
252                                                 video_decoder_ref/idct.o \
253                                                 video_decoder_ref/motion.o \
254                                                 video_decoder_ref/mpeg2dec.o \
255                                                 video_decoder_ref/recon.o \
256                                                 video_decoder_ref/spatscal.o
257 else
258 video_parser_obj =              video_parser/video_parser.o \
259                                                 video_parser/vpar_headers.o \
260                                                 video_parser/vpar_blocks.o \
261                                                 video_parser/vpar_synchro.o \
262                                                 video_parser/video_fifo.o
263
264 video_decoder_obj =             video_decoder/video_decoder.o \
265                                                 video_decoder/vdec_motion.o \
266                                                 video_decoder/vdec_motion_inner.o \
267                                                 video_decoder/vdec_idct.o
268 endif
269
270 misc_obj =                      misc/mtime.o \
271                                                 misc/rsc_files.o \
272                                                 misc/netutils.o \
273                                                 misc/plugins.o \
274                                                 misc/decoder_fifo.o
275
276 C_OBJ = $(interface_obj) \
277                 $(input_obj) \
278                 $(audio_output_obj) \
279                 $(video_output_obj) \
280                 $(ac3_decoder_obj) \
281                 $(audio_decoder_obj) \
282                 $(spu_decoder_obj) \
283                 $(generic_decoder_obj) \
284                 $(video_parser_obj) \
285                 $(video_decoder_obj) \
286                 $(vlan_obj) \
287                 $(misc_obj)
288
289 #
290 # Assembler Objects
291
292 ifneq (,$(findstring X86,$(ARCH)))
293 ifneq (,$(findstring MMX,$(ARCH)))
294 ifeq ($(DECODER),new)
295 ASM_OBJ =                       video_decoder/vdec_idctmmx.o \
296                                                 video_output/video_yuv_mmx.o
297 else
298 ASM_OBJ =                       video_decoder_ref/vdec_idctmmx.o \
299                                                 video_output/video_yuv_mmx.o
300 endif
301 endif
302 endif
303
304 #
305 # Plugins
306 #
307 intf_plugin =           $(INTF:%=plugins/intf/intf_%.so)
308 aout_plugin =           $(AOUT:%=plugins/aout/aout_%.so)
309 vout_plugin =           $(VOUT:%=plugins/vout/vout_%.so)
310
311 PLUGIN_OBJ = $(intf_plugin) $(aout_plugin) $(vout_plugin)
312
313 #
314 # Other lists of files
315 #
316 C_OBJ := $(C_OBJ:%.o=src/%.o)
317 ASM_OBJ := $(ASM_OBJ:%.o=src/%.o)
318 sources := $(C_OBJ:%.o=%.c) $(PLUGIN_OBJ:%.so=%.c)
319 dependancies := $(sources:%.c=.dep/%.d)
320
321 # All symbols must be exported
322 export
323
324 ################################################################################
325 # Targets
326 ################################################################################
327
328 #
329 # Virtual targets
330 #
331 all: vlc
332
333 clean:
334         rm -f $(C_OBJ) $(ASM_OBJ) $(PLUGIN_OBJ)
335
336 distclean: clean
337         rm -f **/*.o **/*.so **/*~ *.log
338         rm -f Makefile include/defs.h config.cache config.log
339         rm -f vlc gmon.out core
340         rm -rf .dep
341
342 install:
343         $(INSTALL) vlc $(PREFIX)/bin
344         mkdir -p $(PREFIX)/lib/videolan/vlc
345         $(INSTALL) $(PLUGIN_OBJ) $(PREFIX)/lib/videolan/vlc
346
347 show:
348         @echo "Command line for C objects:"
349         @echo $(CC) $(CCFLAGS) $(CFLAGS) -c -o "<dest.o>" "<src.c>"
350         @echo
351         @echo "Command line for assembler objects:"
352         @echo $(CC) $(CFLAGS) -c -o "<dest.o>" "<src.S>"
353
354 FORCE:
355
356 #
357 # Real targets
358 #
359 vlc: $(C_OBJ) $(ASM_OBJ) $(PLUGIN_OBJ)
360         $(CC) $(CCFLAGS) $(LCFLAGS) $(CFLAGS) --export-dynamic -rdynamic -o $@ $(C_OBJ) $(ASM_OBJ)      
361
362 #
363 # Generic rules (see below)
364 #
365 $(dependancies): %.d: FORCE
366         @$(MAKE) -s --no-print-directory -f Makefile.dep $@
367
368 $(C_OBJ): %.o: Makefile.dep
369 $(C_OBJ): %.o: .dep/%.d
370 $(C_OBJ): %.o: %.c
371         @echo "compiling $*.o from $*.c"
372         @$(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
373
374 $(ASM_OBJ): %.o: Makefile.dep
375 $(ASM_OBJ): %.o: %.S
376         @echo "assembling $*.o from $*.S"
377         @$(CC) $(CFLAGS) -c -o $@ $<
378
379 $(PLUGIN_OBJ): %.so: Makefile.dep
380 $(PLUGIN_OBJ): %.so: .dep/%.d
381
382 # audio plugins
383 plugins/aout/aout_dummy.so plugins/aout/aout_dsp.so: %.so: %.c
384                 @echo "compiling $*.so from $*.c"
385                 @$(CC) $(CCFLAGS) $(CFLAGS) -shared -o $@ $<
386
387 plugins/aout/aout_esd.so: %.so: %.c
388                 @echo "compiling $*.so from $*.c"
389 ifeq ($(SYS), BSD)
390                 @$(CC) $(CCFLAGS) $(CFLAGS) -lesd -shared -o $@ $<
391 else
392                 @$(CC) $(CCFLAGS) $(CFLAGS) -laudiofile -lesd -shared -o $@ $<
393 endif
394
395 # video plugins
396 plugins/intf/intf_dummy.so plugins/vout/vout_dummy.so \
397         plugins/intf/intf_fb.so plugins/vout/vout_fb.so: %.so: %.c
398                 @echo "compiling $*.so from $*.c"
399                 @$(CC) $(CCFLAGS) $(CFLAGS) -shared -o $@ $<
400
401 plugins/intf/intf_x11.so plugins/vout/vout_x11.so: %.so: %.c
402                 @echo "compiling $*.so from $*.c"
403                 @$(CC) $(CCFLAGS) $(CFLAGS) -I/usr/X11R6/include -L/usr/X11R6/lib -lX11 -lXext -shared -o $@ $<
404
405 plugins/intf/intf_glide.so plugins/vout/vout_glide.so: %.so: %.c
406                 @echo "compiling $*.so from $*.c"
407                 @$(CC) $(CCFLAGS) $(CFLAGS) -I/usr/include/glide -lglide2x -shared -o $@ $<
408
409 plugins/intf/intf_ggi.so plugins/vout/vout_ggi.so: %.so: %.c
410                 @echo "compiling $*.so from $*.c"
411                 @$(CC) $(CCFLAGS) $(CFLAGS) -lggi -shared -o $@ $<
412
413
414 ################################################################################
415 # Note on generic rules and dependancies
416 ################################################################################
417
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/
421 # directory.
422 # The dep directory should be ignored by CVS.
423
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.
429
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.