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