]> git.sesse.net Git - vlc/blob - Makefile
* Makefile :
[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=DGA (not yet supported)
19 #VIDEO=FB
20 #VIDEO=GGI
21 #VIDEO=BEOS (not yet supported)
22
23 # Target architecture and optimization
24 #ARCH=
25 ARCH=MMX
26 #ARCH=PPC
27
28 # Decoder choice - ?? old decoder will be removed soon
29 DECODER=old
30 #DECODER=new
31 # !!! don't forget to run this command after changing decoder type !!!
32 # touch input/input.c input/input_ctrl.c include/vlc.h include/video_decoder.h
33
34 #----------------- do not change anything below this line ----------------------
35
36 ################################################################################
37 # Configuration pre-processing
38 ################################################################################
39
40 # DEFINE will contain all the constants definitions decided in Makefile
41 DEFINE = -DVIDEO_$(VIDEO)
42
43 # video is a lowercase version of VIDEO used for filenames
44 video = $(shell echo $(VIDEO) | tr 'A-Z' 'a-z')
45
46 ################################################################################
47 # Tunning and other variables
48 ################################################################################
49
50 #
51 # Transformation for video decompression (Fourier or cosine)
52 #
53 TRANSFORM=vdec_idct
54 #TRANSFORM=vdec_idft
55
56 #
57 # C headers directories
58 #
59 INCLUDE += -Iinclude
60
61 ifeq ($(VIDEO),X11)
62 INCLUDE += -I/usr/X11R6/include
63 endif
64
65 #
66 # Libraries
67 #
68 LIB += -lpthread
69 LIB += -lm
70
71 ifeq ($(VIDEO),X11)
72 LIB += -L/usr/X11R6/lib
73 LIB += -lX11
74 LIB += -lXext 
75 endif
76 ifeq ($(VIDEO),GGI)
77 LIB += -lggi
78 endif
79
80 # System dependant libraries
81 #??LIB += -lXxf86dga
82
83 #
84 # C compiler flags: compilation
85 #
86 CCFLAGS += $(DEFINE) $(INCLUDE)
87 CCFLAGS += -Wall
88 CCFLAGS += -D_REENTRANT
89 CCFLAGS += -D_GNU_SOURCE
90
91 # Optimizations : don't compile debug versions with them
92 CCFLAGS += -O6
93 CCFLAGS += -ffast-math -funroll-loops -fargument-noalias-global
94 CCFLAGS += -fomit-frame-pointer
95
96 # Optimizations for x86 familiy, without MMX
97 ifeq ($(ARCH),)
98 CCFLAGS += -malign-double
99 CCFLAGS += -march=pentiumpro
100 #CCFLAGS += -march=pentium
101 endif
102
103 # Optimization for x86 with MMX support
104 ifeq ($(ARCH),MMX)
105 CCFLAGS += -malign-double
106 CCFLAGS += -march=pentiumpro
107 endif
108
109 # Optimizations for PowerPC
110 ifeq ($(ARCH),PPC)
111 CCFLAGS += -mcpu=604e -mmultiple -mhard-float -mstring
112 endif
113
114 #
115 # C compiler flags: dependancies
116 #
117 DCFLAGS += $(INCLUDE)
118 DCFLAGS += -MM
119
120 #
121 # C compiler flags: linking
122 #
123 LCFLAGS += $(LIB)
124 LCFLAGS += -Wall
125 #LCFLAGS += -s
126
127 #
128 # C compiler flags: common flags
129 #
130
131 # Optimizations for x86 with MMX support
132 ifeq ($(ARCH),MMX)
133 CFLAGS += -DHAVE_MMX
134 endif
135
136 #
137 # Additionnal debugging flags
138 #
139 # Debugging settings: electric fence, debuging symbols and profiling support. 
140 # Note that electric fence and accurate profiling are quite uncompatible.
141 #CCFLAGS += -g
142 #CCFLAGS += -pg
143 #LCFLAGS += -g 
144 #LCFLAGS += -pg
145 #LIB += -ldmalloc
146 #LIB += -lefence
147
148 #################################################################################
149 # Objects and files
150 #################################################################################
151
152 #
153 # Objects
154
155 interface_obj =                 interface/main.o \
156                                                 interface/interface.o \
157                                                 interface/intf_msg.o \
158                                                 interface/intf_cmd.o \
159                                                 interface/intf_ctrl.o \
160                                                 interface/control.o \
161                                                 interface/intf_console.o \
162                                                 interface/intf_$(video).o
163
164 input_obj =                     input/input_vlan.o \
165                                                 input/input_file.o \
166                                                 input/input_netlist.o \
167                                                 input/input_network.o \
168                                                 input/input_ctrl.o \
169                                                 input/input_pcr.o \
170                                                 input/input_psi.o \
171                                                 input/input.o
172
173 audio_output_obj =              audio_output/audio_output.o \
174                                                 audio_output/audio_dsp.o
175
176 video_output_obj =              video_output/video_output.o \
177                                                 video_output/video_$(video).o \
178                                                 video_output/video_yuv.o
179
180 ac3_decoder_obj =               ac3_decoder/ac3_decoder.o \
181                                                 ac3_decoder/ac3_parse.o \
182                                                 ac3_decoder/ac3_exponent.o \
183                                                 ac3_decoder/ac3_bit_allocate.o \
184                                                 ac3_decoder/ac3_mantissa.o \
185                                                 ac3_decoder/ac3_rematrix.o \
186                                                 ac3_decoder/ac3_imdct.o \
187                                                 ac3_decoder/ac3_downmix.o
188
189 audio_decoder_obj =             audio_decoder/audio_decoder.o \
190                                                 audio_decoder/audio_math.o
191
192 subtitle_decoder_obj =          subtitle_decoder/subtitle_decoder.o
193
194 #??generic_decoder_obj =                generic_decoder/generic_decoder.o
195 # remeber to add it to OBJ 
196
197 ifeq ($(DECODER),old)
198 CFLAGS += -DOLD_DECODER
199 video_decoder_obj =             video_decoder_ref/video_decoder.o \
200                                                 video_decoder_ref/display.o \
201                                                 video_decoder_ref/getblk.o \
202                                                 video_decoder_ref/gethdr.o \
203                                                 video_decoder_ref/getpic.o \
204                                                 video_decoder_ref/getvlc.o \
205                                                 video_decoder_ref/idct.o \
206                                                 video_decoder_ref/motion.o \
207                                                 video_decoder_ref/mpeg2dec.o \
208                                                 video_decoder_ref/recon.o \
209                                                 video_decoder_ref/spatscal.o
210 else
211 video_parser_obj =              video_parser/video_parser.o \
212                                                 video_parser/vpar_headers.o \
213                                                 video_parser/vpar_blocks.o \
214                                                 video_parser/vpar_motion.o \
215                                                 video_parser/vpar_synchro.o \
216                                                 video_parser/video_fifo.o
217
218 video_decoder_obj =             video_decoder/video_decoder.o \
219                                                 video_decoder/vdec_motion.o \
220                         video_decoder/$(TRANSFORM).o
221 endif
222
223 misc_obj =                      misc/mtime.o \
224                                                 misc/rsc_files.o \
225                                                 misc/netutils.o
226
227 ifeq ($(ARCH),MMX)
228 ASM_OBJ =                       video_decoder_ref/idctmmx.o \
229                                                 video_output/video_yuv_mmx.o
230 endif
231
232 C_OBJ = $(interface_obj) \
233                 $(input_obj) \
234                 $(audio_output_obj) \
235                 $(video_output_obj) \
236                 $(ac3_decoder_obj) \
237                 $(audio_decoder_obj) \
238                 $(subtitle_decoder_obj) \
239                 $(generic_decoder_obj) \
240                 $(video_parser_obj) \
241                 $(video_decoder_obj) \
242                 $(vlan_obj) \
243                 $(misc_obj)
244
245 #
246 # Other lists of files
247 #
248 sources := $(C_OBJ:%.o=%.c)
249 dependancies := $(sources:%.c=dep/%.d)
250
251 # All symbols must be exported
252 export
253
254 ################################################################################
255 # Targets
256 ################################################################################
257
258 #
259 # Virtual targets
260 #
261 all: vlc
262
263 clean:
264         rm -f $(C_OBJ) $(ASM_OBJ)
265
266 distclean: clean
267         rm -f **/*.o **/*~ *.log
268         rm -f vlc gmon.out core
269         rm -rf dep
270
271 FORCE:
272
273 #
274 # Real targets
275 #
276 vlc: $(C_OBJ) $(ASM_OBJ)
277         $(CC) $(LCFLAGS) $(CFLAGS) -o $@ $(C_OBJ) $(ASM_OBJ)
278
279 #
280 # Generic rules (see below)
281 #
282 $(dependancies): %.d: FORCE
283         @$(MAKE) -s --no-print-directory -f Makefile.dep $@
284
285 $(C_OBJ): %.o: dep/%.d
286
287 $(C_OBJ): %.o: %.c
288         $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
289 $(ASM_OBJ): %.o: %.S
290         $(CC) $(CFLAGS) -c -o $@ $<
291
292 ################################################################################
293 # Note on generic rules and dependancies
294 ################################################################################
295
296 # Note on dependancies: each .c file is associated with a .d file, which
297 # depends of it. The .o file associated with a .c file depends of the .d, of the 
298 # .c itself, and of Makefile. The .d files are stored in a separate dep/ 
299 # directory.
300 # The dep directory should be ignored by CVS.
301
302 # Note on inclusions: depending of the target, the dependancies files must 
303 # or must not be included. The problem is that if we ask make to include a file,
304 # and this file does not exist, it is made before it can be included. In a 
305 # general way, a .d file should be included if and only if the corresponding .o 
306 # needs to be re-made.
307
308 # Two makefiles are used: the main one (this one) has regular generic rules,
309 # except for .o files, for which it calls the object Makefile. Dependancies
310 # are not included in this file.
311 # The object Makefile known how to make a .o from a .c, and includes
312 # dependancies for the target, but only those required.