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