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