]> git.sesse.net Git - vlc/blob - Makefile.in
Le Makefile genere ne gerait pas correctement le mode debug=1
[vlc] / Makefile.in
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 # Debugging mode on or off (set to 1 to activate)
13 DEBUG=0
14
15 SYS=@SYS@
16 ARCH=@ARCH@
17 AOUT=@AOUT@
18 VOUT=@VOUT@
19 INTF=@VOUT@
20 SNAPSHOTDIR=vlc-@VLC_VERSION@
21 INSTALL=@INSTALL@
22 prefix=@prefix@
23
24 #----------------- do not change anything below this line ----------------------
25
26 ################################################################################
27 # Configuration pre-processing
28 ################################################################################
29
30 # PROGRAM_OPTIONS is an identification string of the compilation options
31 PROGRAM_OPTIONS = $(SYS) $(ARCH)
32 ifeq ($(DEBUG),1)
33 PROGRAM_OPTIONS += DEBUG
34 endif
35
36 # PROGRAM_BUILD is a complete identification of the build
37 # ( we can't use fancy options with date since OSes like Solaris
38 # or FreeBSD have strange date implementations )
39 PROGRAM_BUILD = `date` $(USER)
40 # XXX: beos does not support hostname
41 #PROGRAM_BUILD = `date` $(USER)@`hostname`
42
43 # DEFINE will contain some of the constants definitions decided in Makefile, 
44 # including SYS_xx. It will be passed to C compiler.
45 DEFINE += -DSYS_$(shell echo $(SYS) | sed 's/-.*//' | tr a-z A-Z)
46 DEFINE += -DPLUGIN_PATH="\"$(prefix)/lib/videolan/vlc\""
47 DEFINE += -DDATA_PATH="\"$(prefix)/share/videolan/vlc\""
48 #DEFINE += -DPROGRAM_OPTIONS="\"$(shell echo $(PROGRAM_OPTIONS) | tr 'A-Z' 'a-z')\""
49 #DEFINE += -DPROGRAM_BUILD="\"$(PROGRAM_BUILD)\""
50 ifeq ($(DEBUG),1)
51 DEFINE += -DDEBUG
52 endif
53
54 ################################################################################
55 # Tuning and other variables - do not change anything except if you know
56 # exactly what you are doing
57 ################################################################################
58
59 #
60 # C headers directories
61 #
62 INCLUDE += -Iinclude -I/usr/local/include -I/usr/X11R6/include
63
64 #
65 # Libraries
66 #
67
68 ifeq ($(SYS),gnu)
69 LIB += -lthreads -ldl
70 endif
71
72 ifneq (,$(findstring bsd,$(SYS)))
73 LIB += -pthread -lgnugetopt
74 LIB += -L/usr/local/lib
75 endif
76
77 ifneq (,$(findstring linux,$(SYS)))
78 LIB += -lpthread -ldl
79 endif
80
81 ifeq ($(SYS),beos)
82 LIB += -lbe -lroot -lgame
83 else
84 LIB += -lm
85 endif
86
87 #
88 # C compiler flags: compilation
89 #
90 CCFLAGS += $(DEFINE) $(INCLUDE)
91 CCFLAGS += -Wall
92 CCFLAGS += -D_REENTRANT
93 CCFLAGS += -D_GNU_SOURCE
94
95 # flags needed for clean beos compilation
96 CCFLAGS += -Wno-multichar -Wno-ctor-dtor-privacy -Woverloaded-virtual
97
98 # Optimizations : don't compile debug versions with them
99 ifeq ($(DEBUG),0)
100 CCFLAGS += -O6
101 CCFLAGS += -ffast-math -funroll-loops -fargument-noalias-global
102 CCFLAGS += -fomit-frame-pointer
103
104 # Optimizations for x86 familiy
105 ifneq (,$(findstring 86,$(ARCH)))
106 CCFLAGS += -malign-double
107 #CCFLAGS += -march=pentium
108 # Eventual Pentium Pro optimizations
109 ifneq (,$(findstring pentiumpro,$(ARCH)))
110 ifneq ($(SYS), BSD)
111 CCFLAGS += -march=pentiumpro
112 endif
113 endif
114 # Eventual MMX optimizations for x86
115 ifneq (,$(findstring mmx,$(ARCH)))
116 CFLAGS += -DHAVE_MMX
117 endif
118 endif
119
120 # Optimizations for PowerPC
121 ifneq (,$(findstring ppc,$(ARCH)))
122 CCFLAGS += -mcpu=604e -mmultiple -mhard-float -mstring
123 endif
124
125 # Optimizations for Sparc
126 ifneq (,$(findstring sparc,$(ARCH)))
127 CCFLAGS += -mhard-float
128 endif
129
130 # End of optimizations
131 endif
132
133 #
134 # C compiler flags: dependancies
135 #
136 DCFLAGS += $(INCLUDE)
137 DCFLAGS += -MM
138
139 #
140 # C compiler flags: linking
141 #
142 LCFLAGS += $(LIB)
143 LCFLAGS += -Wall
144 #LCFLAGS += -s
145
146 #
147 # Additionnal debugging flags
148 #
149
150 # Debugging and profiling support
151 ifneq ($(DEBUG),0)
152 CFLAGS += -pg
153 endif
154
155 #################################################################################
156 # Objects and files
157 #################################################################################
158
159 #
160 # C Objects
161
162 interface_obj =                 interface/main.o \
163                                                 interface/interface.o \
164                                                 interface/intf_msg.o \
165                                                 interface/intf_cmd.o \
166                                                 interface/intf_ctrl.o \
167                                                 interface/intf_console.o
168
169 input_obj =                     input/input_vlan.o \
170                                                 input/input_file.o \
171                                                 input/input_netlist.o \
172                                                 input/input_network.o \
173                                                 input/input_ctrl.o \
174                                                 input/input_pcr.o \
175                                                 input/input_psi.o \
176                                                 input/input.o
177
178 audio_output_obj =              audio_output/audio_output.o
179
180 video_output_obj =              video_output/video_output.o \
181                                                 video_output/video_text.o \
182                                                 video_output/video_spu.o \
183                                                 video_output/video_yuv.o
184
185 ac3_decoder_obj =               ac3_decoder/ac3_decoder_thread.o \
186                                                 ac3_decoder/ac3_decoder.o \
187                                                 ac3_decoder/ac3_parse.o \
188                                                 ac3_decoder/ac3_exponent.o \
189                                                 ac3_decoder/ac3_bit_allocate.o \
190                                                 ac3_decoder/ac3_mantissa.o \
191                                                 ac3_decoder/ac3_rematrix.o \
192                                                 ac3_decoder/ac3_imdct.o \
193                                                 ac3_decoder/ac3_downmix.o
194                                                 
195 lpcm_decoder_obj =              lpcm_decoder/lpcm_decoder_thread.o \
196                                                 lpcm_decoder/lpcm_decoder.o
197
198 audio_decoder_obj =             audio_decoder/audio_decoder_thread.o \
199                                                 audio_decoder/audio_decoder.o \
200                                                 audio_decoder/audio_math.o
201
202 spu_decoder_obj =               spu_decoder/spu_decoder.o
203
204 #??generic_decoder_obj =                generic_decoder/generic_decoder.o
205 # remeber to add it to OBJ 
206
207 video_parser_obj =              video_parser/video_parser.o \
208                                                 video_parser/vpar_headers.o \
209                                                 video_parser/vpar_blocks.o \
210                                                 video_parser/vpar_synchro.o \
211                                                 video_parser/video_fifo.o
212
213 video_decoder_obj =             video_decoder/video_decoder.o \
214                                                 video_decoder/vdec_motion.o \
215                                                 video_decoder/vdec_motion_inner.o \
216                                                 video_decoder/vdec_idct.o
217
218 misc_obj =                      misc/mtime.o \
219                                                 misc/rsc_files.o \
220                                                 misc/netutils.o \
221                                                 misc/plugins.o \
222                                                 misc/decoder_fifo.o
223
224
225 C_OBJ = $(interface_obj) \
226                 $(input_obj) \
227                 $(audio_output_obj) \
228                 $(video_output_obj) \
229                 $(ac3_decoder_obj) \
230                 $(lpcm_decoder_obj) \
231                 $(audio_decoder_obj) \
232                 $(spu_decoder_obj) \
233                 $(generic_decoder_obj) \
234                 $(video_parser_obj) \
235                 $(video_decoder_obj) \
236                 $(vlan_obj) \
237                 $(misc_obj)
238
239 ifeq ($(SYS),beos)
240 CPP_OBJ =                       misc/beos_specific.o
241 endif
242
243 #
244 # Assembler Objects
245
246 ifneq (,$(findstring 86,$(ARCH)))
247 ifneq (,$(findstring mmx,$(ARCH)))
248 ASM_OBJ =                       video_decoder/vdec_idctmmx.o \
249                                                 video_output/video_yuv_mmx.o
250 endif
251 endif
252
253 #
254 # Plugins
255 #
256 intf_plugin =           $(INTF:%=plugins/intf/intf_%.so)
257 aout_plugin =           $(AOUT:%=plugins/aout/aout_%.so)
258 vout_plugin =           $(VOUT:%=plugins/vout/vout_%.so)
259
260 PLUGIN_OBJ = $(intf_plugin) $(aout_plugin) $(vout_plugin)
261
262 #
263 # Other lists of files
264 #
265 C_OBJ := $(C_OBJ:%.o=src/%.o)
266 CPP_OBJ := $(CPP_OBJ:%.o=src/%.o)
267 ASM_OBJ := $(ASM_OBJ:%.o=src/%.o)
268 sources_c := $(C_OBJ:%.o=%.c)
269 dependancies := $(sources_c:%.c=.dep/%.d)
270
271 # All symbols must be exported
272 export
273
274 ################################################################################
275 # Targets
276 ################################################################################
277
278 #
279 # Virtual targets
280 #
281 all: vlc plugins
282
283 clean:
284         rm -f $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ) $(PLUGIN_OBJ)
285
286 distclean: clean
287         rm -f */*/*.o plugins/*/*.so **/*~ *.log
288         rm -f Makefile include/defs.h include/config.h
289         rm -f config.status config.cache config.log
290         rm -f vlc gmon.out core
291         rm -rf .dep
292
293 install:
294         $(INSTALL) vlc $(prefix)/bin
295         mkdir -p $(prefix)/lib/videolan/vlc
296         mkdir -p $(prefix)/share/videolan/vlc
297         $(INSTALL) $(PLUGIN_OBJ) $(prefix)/lib/videolan/vlc
298         $(INSTALL) share/*.psf $(prefix)/share/videolan/vlc
299         $(INSTALL) share/*.png $(prefix)/share/videolan/vlc
300
301 show:
302         @echo "Command line for C objects:"
303         @echo $(CC) $(CCFLAGS) $(CFLAGS) -c -o "<dest.o>" "<src.c>"
304         @echo
305         @echo "Command line for assembler objects:"
306         @echo $(CC) $(CFLAGS) -c -o "<dest.o>" "<src.S>"
307
308 # ugliest of all, but I have no time to do it -- sam
309 snapshot:
310         rm -rf /tmp/${SNAPSHOTDIR}
311         mkdir /tmp/${SNAPSHOTDIR}
312         cp -r * /tmp/${SNAPSHOTDIR}
313                 (cd /tmp/${SNAPSHOTDIR} ; \
314                 make distclean ; \
315                 find . -type d -name CVS | xargs rm -rf ; \
316                 find . -type f -name '.*.swp' | xargs rm -f ; \
317                 cd .. ; \
318                 tar czvf ${SNAPSHOTDIR}.tar.gz ${SNAPSHOTDIR} )
319         rm -rf /tmp/${SNAPSHOTDIR}
320         mv /tmp/${SNAPSHOTDIR}.tar.gz ..
321         @echo "Sources are in ../${SNAPSHOTDIR}.tar.gz"
322
323 FORCE:
324
325 #
326 # Real targets
327 #
328 vlc: $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ)
329 ifeq ($(SYS),beos)
330         $(CC) $(CCFLAGS) $(LCFLAGS) $(CFLAGS) -Xlinker -soname=_APP_ -o $@ $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ)
331 #       ln -s ../vlc ./plugins/_APP_
332 else
333         $(CC) $(CCFLAGS) $(LCFLAGS) $(CFLAGS) --export-dynamic -rdynamic -o $@ $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ)   
334 endif
335
336 plugins: $(PLUGIN_OBJ)
337
338 #
339 # Generic rules (see below)
340 #
341 $(dependancies): %.d: FORCE
342         @$(MAKE) -s --no-print-directory -f Makefile.dep $@
343
344 $(C_OBJ): %.o: Makefile.dep
345 $(C_OBJ): %.o: .dep/%.d
346 $(C_OBJ): %.o: %.c
347         $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
348
349 $(CPP_OBJ): %.o: %.cpp
350         $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
351
352 $(ASM_OBJ): %.o: Makefile.dep
353 $(ASM_OBJ): %.o: %.S
354         $(CC) $(CFLAGS) -c -o $@ $<
355
356 #$(PLUGIN_OBJ): %.so: Makefile.dep
357 #$(PLUGIN_OBJ): %.so: .dep/%.d
358
359 # audio plugins
360 plugins/aout/aout_dummy.so plugins/aout/aout_dsp.so: %.so: %.c
361 ifeq ($(SYS),beos)
362         $(CC) $(CCFLAGS) $(CFLAGS) -nostart -Xlinker -soname=$@ -o $@ $< plugins/_APP_
363 else
364         $(CC) $(CCFLAGS) $(CFLAGS) -shared -o $@ $<
365 endif
366
367 plugins/aout/aout_esd.so: %.so: %.c
368 ifneq (,$(findstring bsd,$(SYS)))
369         $(CC) $(CCFLAGS) $(CFLAGS) -lesd -shared -o $@ $<
370 else
371         $(CC) $(CCFLAGS) $(CFLAGS) -laudiofile -lesd -shared -o $@ $<
372 endif
373
374 # video plugins
375 plugins/intf/intf_dummy.so plugins/vout/vout_dummy.so \
376         plugins/intf/intf_fb.so plugins/vout/vout_fb.so: %.so: %.c
377 ifeq ($(SYS),beos)
378         $(CC) $(CCFLAGS) $(CFLAGS) -nostart -Xlinker -soname=$@ -o $@ $< plugins/_APP_
379 else
380         $(CC) $(CCFLAGS) $(CFLAGS) -shared -o $@ $<
381 endif
382
383 plugins/intf/intf_x11.so plugins/vout/vout_x11.so: %.so: %.c
384         $(CC) $(CCFLAGS) $(CFLAGS) -I/usr/X11R6/include -L/usr/X11R6/lib -lX11 -lXext -shared -o $@ $<
385
386 plugins/intf/intf_mga.so plugins/vout/vout_mga.so: %.so: %.c
387         $(CC) $(CCFLAGS) $(CFLAGS) -I/usr/X11R6/include -L/usr/X11R6/lib -lX11 -lXext -shared -o $@ $<
388
389 plugins/intf/intf_gnome.so: %.so: %.c
390         $(CC) $(CCFLAGS) $(CFLAGS) $(LCFLAGS) `gnome-config --libs --cflags gnomeui` -shared -o $@ $< plugins/intf/intf_gnome_callbacks.c plugins/intf/intf_gnome_interface.c plugins/intf/intf_gnome_support.c
391
392 plugins/vout/vout_gnome.so: %.so: %.c
393         $(CC) $(CCFLAGS) $(CFLAGS) -I/usr/X11R6/include -L/usr/X11R6/lib -lX11 -lXext -shared -o $@ $<
394
395 plugins/intf/intf_glide.so plugins/vout/vout_glide.so: %.so: %.c
396         $(CC) $(CCFLAGS) $(CFLAGS) -I/usr/include/glide -lglide2x -shared -o $@ $<
397
398 plugins/intf/intf_ggi.so plugins/vout/vout_ggi.so: %.so: %.c
399         $(CC) $(CCFLAGS) $(CFLAGS) -lggi -shared -o $@ $<
400
401 plugins/intf/intf_beos.so: %.so: %.cpp
402         $(CC) $(LCFLAGS) $(CCFLAGS) $(CFLAGS) -nostart -Xlinker -soname=$@ -o $@ $< plugins/_APP_
403
404 plugins/vout/vout_beos.so: %.so: %.cpp
405         $(CC) $(LCFLAGS) $(CCFLAGS) $(CFLAGS) -nostart -Xlinker -soname=$@ -o $@ $< plugins/_APP_
406                 
407
408 ################################################################################
409 # Note on generic rules and dependancies
410 ################################################################################
411
412 # Note on dependancies: each .c file is associated with a .d file, which
413 # depends of it. The .o file associated with a .c file depends of the .d, of the
414 # .c itself, and of Makefile. The .d files are stored in a separate .dep/
415 # directory.
416 # The dep directory should be ignored by CVS.
417
418 # Note on inclusions: depending of the target, the dependancies files must
419 # or must not be included. The problem is that if we ask make to include a file,
420 # and this file does not exist, it is made before it can be included. In a
421 # general way, a .d file should be included if and only if the corresponding .o
422 # needs to be re-made.
423
424 # Two makefiles are used: the main one (this one) has regular generic rules,
425 # except for .o files, for which it calls the object Makefile. Dependancies
426 # are not included in this file.
427 # The object Makefile known how to make a .o from a .c, and includes
428 # dependancies for the target, but only those required.