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