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