]> git.sesse.net Git - vlc/blob - Makefile.in
* vlc.init becomes ~/.vlcrc
[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
45 ################################################################################
46 # Tuning and other variables - do not change anything except if you know
47 # exactly what you are doing
48 ################################################################################
49
50 #
51 # C headers directories
52 #
53 INCLUDE += -Iinclude -I/usr/local/include -I/usr/X11R6/include
54
55 #
56 # Libraries
57 #
58
59 ifeq ($(SYS),gnu)
60 LIB += -lthreads -ldl
61 endif
62
63 ifneq (,$(findstring bsd,$(SYS)))
64 LIB += -pthread -lgnugetopt
65 LIB += -L/usr/local/lib
66 endif
67
68 ifneq (,$(findstring linux,$(SYS)))
69 LIB += -lpthread -ldl
70 endif
71
72 ifeq ($(SYS),beos)
73 LIB += -lbe -lroot -lgame
74 else
75 LIB += -lm
76 endif
77
78 #
79 # C compiler flags: compilation
80 #
81 CCFLAGS += $(DEFINE) $(INCLUDE)
82 CCFLAGS += -Wall -Winline
83 CCFLAGS += -D_REENTRANT
84 CCFLAGS += -D_GNU_SOURCE
85
86 # flags needed for clean beos compilation
87 ifeq ($(SYS),beos)
88 CCFLAGS += -Wno-multichar -Wno-ctor-dtor-privacy -Woverloaded-virtual
89 endif
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 ifeq ($(SYS),beos)
146 CFLAGS += -g
147 else
148 CFLAGS += -pg
149 endif
150 endif
151
152 #################################################################################
153 # Objects and files
154 #################################################################################
155
156 #
157 # C Objects
158
159 interface_obj =         interface/main.o \
160                                 interface/interface.o \
161                                 interface/intf_msg.o \
162                                 interface/intf_cmd.o \
163                                 interface/intf_ctrl.o \
164                                 interface/intf_console.o
165
166 input_obj =             input/input_vlan.o \
167                                 input/input_file.o \
168                                 input/input_netlist.o \
169                                 input/input_network.o \
170                                 input/input_ctrl.o \
171                                 input/input_pcr.o \
172                                 input/input_psi.o \
173                                 input/input.o
174
175 audio_output_obj =      audio_output/audio_output.o
176
177 video_output_obj =      video_output/video_output.o \
178                                 video_output/video_text.o \
179                                 video_output/video_spu.o \
180                                 video_output/video_yuv.o
181
182 ac3_decoder_obj =       ac3_decoder/ac3_decoder_thread.o \
183                                 ac3_decoder/ac3_decoder.o \
184                                 ac3_decoder/ac3_parse.o \
185                                 ac3_decoder/ac3_exponent.o \
186                                 ac3_decoder/ac3_bit_allocate.o \
187                                 ac3_decoder/ac3_mantissa.o \
188                                 ac3_decoder/ac3_rematrix.o \
189                                 ac3_decoder/ac3_imdct.o \
190                                 ac3_decoder/ac3_downmix.o
191                                                 
192 lpcm_decoder_obj =      lpcm_decoder/lpcm_decoder_thread.o \
193                                 lpcm_decoder/lpcm_decoder.o
194
195 audio_decoder_obj =     audio_decoder/audio_decoder_thread.o \
196                                 audio_decoder/audio_decoder.o \
197                                 audio_decoder/audio_math.o
198
199 spu_decoder_obj =       spu_decoder/spu_decoder.o
200
201 #??generic_decoder_obj =                generic_decoder/generic_decoder.o
202 # remeber to add it to OBJ 
203
204 video_parser_obj =      video_parser/video_parser.o \
205                                 video_parser/vpar_headers.o \
206                                 video_parser/vpar_blocks.o \
207                                 video_parser/vpar_synchro.o \
208                                 video_parser/video_fifo.o
209
210 ifneq (,$(findstring mmx,$(ARCH)))
211         vdec_motion_inner = video_decoder/vdec_motion_inner_mmx.o
212 else
213         vdec_motion_inner = video_decoder/vdec_motion_inner.o
214 endif
215
216 video_decoder_obj =     video_decoder/video_decoder.o \
217                                 video_decoder/vdec_motion.o \
218                                 video_decoder/vdec_idct.o \
219                                 $(vdec_motion_inner)
220
221 misc_obj =              misc/mtime.o \
222                                 misc/tests.o \
223                                 misc/rsc_files.o \
224                                 misc/netutils.o \
225                                 misc/playlist.o \
226                                 misc/plugins.o \
227                                 misc/decoder_fifo.o
228
229
230 C_OBJ = $(interface_obj) \
231                 $(input_obj) \
232                 $(audio_output_obj) \
233                 $(video_output_obj) \
234                 $(ac3_decoder_obj) \
235                 $(lpcm_decoder_obj) \
236                 $(audio_decoder_obj) \
237                 $(spu_decoder_obj) \
238                 $(generic_decoder_obj) \
239                 $(video_parser_obj) \
240                 $(video_decoder_obj) \
241                 $(vlan_obj) \
242                 $(misc_obj)
243
244 ifeq ($(SYS),beos)
245 CPP_OBJ =                       misc/beos_specific.o
246 endif
247
248 #
249 # Assembler Objects
250
251 ifneq (,$(findstring 86,$(ARCH)))
252 ifneq (,$(findstring mmx,$(ARCH)))
253 ASM_OBJ =                       video_decoder/vdec_idctmmx.o \
254                                                 video_output/video_yuv_mmx.o
255 endif
256 endif
257
258 #
259 # Plugins
260 #
261 PLUGINS := $(PLUGINS:%=lib/%.so)
262
263 PLUGIN_BEOS   = plugins/beos/beos.o \
264                 plugins/beos/aout_beos.o \
265                 plugins/beos/intf_beos.o \
266                 plugins/beos/vout_beos.o
267
268 PLUGIN_DSP    = plugins/dsp/dsp.o \
269                 plugins/dsp/aout_dsp.o \
270
271 PLUGIN_DUMMY  = plugins/dummy/dummy.o \
272                 plugins/dummy/aout_dummy.o \
273                 plugins/dummy/intf_dummy.o \
274                 plugins/dummy/vout_dummy.o
275
276 PLUGIN_ESD    = plugins/esd/esd.o \
277                 plugins/esd/aout_esd.o
278
279 PLUGIN_FB     = plugins/fb/fb.o \
280                 plugins/fb/intf_fb.o \
281                 plugins/fb/vout_fb.o
282
283 PLUGIN_GGI    = plugins/ggi/ggi.o \
284                 plugins/ggi/intf_ggi.o \
285                 plugins/ggi/vout_ggi.o
286
287 PLUGIN_GLIDE  = plugins/glide/glide.o \
288                 plugins/glide/intf_glide.o \
289                 plugins/glide/vout_glide.o
290
291 PLUGIN_GNOME  = plugins/gnome/gnome.o \
292                 plugins/gnome/intf_gnome.o \
293                 plugins/gnome/intf_gnome_callbacks.o \
294                 plugins/gnome/intf_gnome_interface.o \
295                 plugins/gnome/intf_gnome_support.o \
296                 plugins/gnome/vout_gnome.o
297
298 PLUGIN_MGA    = plugins/mga/mga.o \
299                 plugins/mga/intf_mga.o \
300                 plugins/mga/vout_mga.o
301
302 PLUGIN_X11    = plugins/x11/x11.o \
303                 plugins/x11/intf_x11.o \
304                 plugins/x11/vout_x11.o
305
306 PLUGIN_YUV    = plugins/yuv/yuv.o \
307                 plugins/yuv/video_yuv.o \
308                 plugins/yuv/video_yuv8.o \
309                 plugins/yuv/video_yuv15.o \
310                 plugins/yuv/video_yuv16.o \
311                 plugins/yuv/video_yuv24.o \
312                 plugins/yuv/video_yuv32.o
313
314 PLUGIN_YUVMMX = plugins/yuvmmx/yuvmmx.o \
315                 plugins/yuvmmx/video_yuv.o \
316                 plugins/yuvmmx/video_yuv8.o \
317                 plugins/yuvmmx/video_yuv15.o \
318                 plugins/yuvmmx/video_yuv16.o \
319                 plugins/yuvmmx/video_yuv24.o \
320                 plugins/yuvmmx/video_yuv32.o
321
322 PLUGIN_OBJ = $(PLUGIN_BEOS) $(PLUGIN_DSP) $(PLUGIN_DUMMY) $(PLUGIN_ESD) \
323                 $(PLUGIN_FB) $(PLUGIN_GGI) $(PLUGIN_GLIDE) $(PLUGIN_GNOME) \
324                 $(PLUGIN_MGA) $(PLUGIN_X11) $(PLUGIN_YUV) $(PLUGIN_YUVMMX)
325 #
326 # Other lists of files
327 #
328 C_OBJ := $(C_OBJ:%.o=src/%.o)
329 CPP_OBJ := $(CPP_OBJ:%.o=src/%.o)
330 ASM_OBJ := $(ASM_OBJ:%.o=src/%.o)
331 sources_c := $(C_OBJ:%.o=%.c)
332 dependancies := $(sources_c:%.c=.dep/%.d)
333
334 # All symbols must be exported
335 export
336
337 ################################################################################
338 # Targets
339 ################################################################################
340
341 #
342 # Virtual targets
343 #
344 all: vlc @ALIASES@ plugins
345
346 clean:
347         rm -f $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ) $(PLUGIN_OBJ)
348         rm -f vlc @ALIASES@ lib/*.so
349
350 distclean: clean
351         rm -f src/*/*.o plugins/*/*.o **/*~ *.log
352         rm -f Makefile include/defs.h include/config.h
353         rm -f config.status config.cache config.log
354         rm -f gmon.out core build-stamp
355         rm -rf .dep
356
357 install:
358         mkdir -p $(prefix)/bin
359         $(INSTALL) vlc $(prefix)/bin
360         mkdir -p $(prefix)/lib/videolan/vlc
361         $(INSTALL) -m 644 $(PLUGINS) $(prefix)/lib/videolan/vlc
362         mkdir -p $(prefix)/share/videolan
363         $(INSTALL) -m 644 share/*.psf $(prefix)/share/videolan
364         $(INSTALL) -m 644 share/*.png $(prefix)/share/videolan
365
366 show:
367         @echo CC: $(CC)
368         @echo CCFLAGS: $(CCFLAGS)
369         @echo DCFLAGS: $(DCFLAGS)
370         @echo LCFLAGS: $(CCFLAGS)
371
372 # ugliest of all, but I have no time to do it -- sam
373 snapshot:
374         rm -rf /tmp/${SNAPSHOTDIR}
375         mkdir /tmp/${SNAPSHOTDIR}
376         cp -r * /tmp/${SNAPSHOTDIR}
377                 (cd /tmp/${SNAPSHOTDIR} ; \
378                 make distclean ; \
379                 find . -type d -name CVS | xargs rm -rf ; \
380                 find . -type f -name '.*.swp' | xargs rm -f ; \
381                 cd .. ; \
382                 tar czvf ${SNAPSHOTDIR}.tar.gz ${SNAPSHOTDIR} ; \
383                 tar cIvf ${SNAPSHOTDIR}.tar.bz2 ${SNAPSHOTDIR} )
384         rm -rf /tmp/${SNAPSHOTDIR}
385         mv /tmp/${SNAPSHOTDIR}.tar.gz ..
386         mv /tmp/${SNAPSHOTDIR}.tar.bz2 ..
387         @echo "Sources are in ../${SNAPSHOTDIR}.tar.[gz,bz2]"
388
389 FORCE:
390
391 #
392 # Real targets
393 #
394 vlc: $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ)
395 ifeq ($(SYS),beos)
396         $(CC) $(CCFLAGS) $(LCFLAGS) $(CFLAGS) -Xlinker -soname=_APP_ -o $@ $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ)
397         rm -f ./plugins/_APP_
398         ln -s ../vlc ./plugins/_APP_
399 else
400         $(CC) $(CCFLAGS) $(LCFLAGS) $(CFLAGS) --export-dynamic -rdynamic -o $@ $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ)   
401 endif
402
403 gvlc xvlc fbvlc ggivlc glidevlc: vlc
404         rm -f $@ && ln -s vlc $@
405
406 plugins: $(PLUGINS)
407
408 #
409 # Generic rules (see below)
410 #
411 $(dependancies): %.d: FORCE
412         @$(MAKE) -s --no-print-directory -f Makefile.dep $@
413
414 $(C_OBJ): %.o: Makefile.dep
415 $(C_OBJ): %.o: .dep/%.d
416 $(C_OBJ): %.o: %.c
417         $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
418
419 $(CPP_OBJ): %.o: %.cpp
420         $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
421
422 $(ASM_OBJ): %.o: Makefile.dep
423 $(ASM_OBJ): %.o: %.S
424         $(CC) $(CFLAGS) -c -o $@ $<
425
426 #$(PLUGIN_OBJ): %.so: Makefile.dep
427 #$(PLUGIN_OBJ): %.so: .dep/%.d
428
429 lib/beos.so: $(PLUGIN_BEOS)
430         $(CC) $(CCFLAGS) $(CFLAGS) $(LCFLAGS) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_
431 $(PLUGIN_BEOS): %.o: %.cpp
432         $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
433
434 lib/esd.so: $(PLUGIN_ESD)
435 ifneq (,$(findstring bsd,$(SYS)))
436         ld -shared -lesd -o $@ $^
437 else
438         ld -shared -laudiofile -lesd -o $@ $^
439 endif
440 $(PLUGIN_ESD): %.o: %.c
441         $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
442
443 lib/dsp.so: $(PLUGIN_DSP)
444         ld -shared -o $@ $^
445 $(PLUGIN_DSP): %.o: %.c
446         $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
447
448 lib/dummy.so: $(PLUGIN_DUMMY)
449         ld -shared -o $@ $^
450 $(PLUGIN_DUMMY): %.o: %.c
451         $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
452
453 lib/fb.so: $(PLUGIN_FB)
454         ld -shared -o $@ $^
455 $(PLUGIN_FB): %.o: %.c
456         $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
457
458 lib/x11.so: $(PLUGIN_X11)
459         ld -shared -L/usr/X11R6/lib -lX11 -lXext -o $@ $^
460 $(PLUGIN_X11): %.o: %.c
461         $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
462
463 lib/mga.so: $(PLUGIN_MGA)
464         ld -shared -L/usr/X11R6/lib -lX11 -lXext -o $@ $^
465 $(PLUGIN_MGA): %.o: %.c
466         $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
467
468 lib/gnome.so: $(PLUGIN_GNOME)
469         ld -shared `gnome-config --libs gnomeui | sed 's,-rdynamic,,'` -o $@ $^
470 $(PLUGIN_GNOME): %.o: %.c
471         $(CC) $(CCFLAGS) $(CFLAGS) `gnome-config --cflags gnomeui` -c -o $@ $<
472
473 lib/glide.so: $(PLUGIN_GLIDE)
474         ld -shared -lglide2x -o $@ $^
475 $(PLUGIN_GLIDE): %.o: %.c
476         $(CC) $(CCFLAGS) $(CFLAGS) -I/usr/include/glide -c -o $@ $<
477
478 lib/ggi.so: $(PLUGIN_GGI)
479         ld -shared -lggi -o $@ $^
480 $(PLUGIN_GGI): %.o: %.c
481         $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
482
483 lib/yuv.so: $(PLUGIN_YUV)
484 ifeq ($(SYS),beos)
485         $(CC) $(CCFLAGS) $(CFLAGS) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_
486 else
487         ld -shared -o $@ $^
488 endif
489 $(PLUGIN_YUV): %.o: %.c
490         $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
491
492 lib/yuvmmx.so: $(PLUGIN_YUVMMX)
493 ifeq ($(SYS),beos)
494         $(CC) $(CCFLAGS) $(CFLAGS) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_
495 else
496         ld -shared -o $@ $^
497 endif
498 $(PLUGIN_YUVMMX): %.o: %.c
499         $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
500
501 ################################################################################
502 # Note on generic rules and dependancies
503 ################################################################################
504
505 # Note on dependancies: each .c file is associated with a .d file, which
506 # depends of it. The .o file associated with a .c file depends of the .d, of the
507 # .c itself, and of Makefile. The .d files are stored in a separate .dep/
508 # directory.
509 # The dep directory should be ignored by CVS.
510
511 # Note on inclusions: depending of the target, the dependancies files must
512 # or must not be included. The problem is that if we ask make to include a file,
513 # and this file does not exist, it is made before it can be included. In a
514 # general way, a .d file should be included if and only if the corresponding .o
515 # needs to be re-made.
516
517 # Two makefiles are used: the main one (this one) has regular generic rules,
518 # except for .o files, for which it calls the object Makefile. Dependancies
519 # are not included in this file.
520 # The object Makefile known how to make a .o from a .c, and includes
521 # dependancies for the target, but only those required.