]> git.sesse.net Git - vlc/blob - Makefile.in
88a627d0a028f39dfc87f72d65b369dee022034d
[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
83 CCFLAGS += -D_REENTRANT
84 CCFLAGS += -D_GNU_SOURCE
85
86 # flags needed for clean beos compilation
87 CCFLAGS += -Wno-multichar -Wno-ctor-dtor-privacy -Woverloaded-virtual
88
89 # Optimizations : don't compile debug versions with them
90 ifeq ($(DEBUG),0)
91 CCFLAGS += -O6
92 CCFLAGS += -ffast-math -funroll-loops -fargument-noalias-global
93 CCFLAGS += -fomit-frame-pointer
94
95 # Optimizations for x86 familiy
96 ifneq (,$(findstring 86,$(ARCH)))
97 CCFLAGS += -malign-double
98 #CCFLAGS += -march=pentium
99 # Eventual Pentium Pro optimizations
100 ifneq (,$(findstring pentiumpro,$(ARCH)))
101 ifneq ($(SYS), BSD)
102 CCFLAGS += -march=pentiumpro
103 endif
104 endif
105 # Eventual MMX optimizations for x86
106 ifneq (,$(findstring mmx,$(ARCH)))
107 CFLAGS += -DHAVE_MMX
108 endif
109 endif
110
111 # Optimizations for PowerPC
112 ifneq (,$(findstring ppc,$(ARCH)))
113 CCFLAGS += -mcpu=604e -mmultiple -mhard-float -mstring
114 endif
115
116 # Optimizations for Sparc
117 ifneq (,$(findstring sparc,$(ARCH)))
118 CCFLAGS += -mhard-float
119 endif
120
121 # End of optimizations
122 endif
123
124 #
125 # C compiler flags: dependancies
126 #
127 DCFLAGS += $(INCLUDE)
128 DCFLAGS += -MM
129
130 #
131 # C compiler flags: linking
132 #
133 LCFLAGS += $(LIB)
134 LCFLAGS += -Wall
135 #LCFLAGS += -s
136
137 #
138 # Additionnal debugging flags
139 #
140
141 # Debugging and profiling support
142 ifneq ($(DEBUG),0)
143 ifeq ($(SYS),beos)
144 CFLAGS += -g
145 else
146 CFLAGS += -pg
147 endif
148 endif
149
150 #################################################################################
151 # Objects and files
152 #################################################################################
153
154 #
155 # C Objects
156
157 interface_obj =                 interface/main.o \
158                                                 interface/interface.o \
159                                                 interface/intf_msg.o \
160                                                 interface/intf_cmd.o \
161                                                 interface/intf_ctrl.o \
162                                                 interface/intf_console.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
175 video_output_obj =              video_output/video_output.o \
176                                                 video_output/video_text.o \
177                                                 video_output/video_spu.o \
178                                                 video_output/video_yuv.o
179
180 ac3_decoder_obj =               ac3_decoder/ac3_decoder_thread.o \
181                                                 ac3_decoder/ac3_decoder.o \
182                                                 ac3_decoder/ac3_parse.o \
183                                                 ac3_decoder/ac3_exponent.o \
184                                                 ac3_decoder/ac3_bit_allocate.o \
185                                                 ac3_decoder/ac3_mantissa.o \
186                                                 ac3_decoder/ac3_rematrix.o \
187                                                 ac3_decoder/ac3_imdct.o \
188                                                 ac3_decoder/ac3_downmix.o
189                                                 
190 lpcm_decoder_obj =              lpcm_decoder/lpcm_decoder_thread.o \
191                                                 lpcm_decoder/lpcm_decoder.o
192
193 audio_decoder_obj =             audio_decoder/audio_decoder_thread.o \
194                                                 audio_decoder/audio_decoder.o \
195                                                 audio_decoder/audio_math.o
196
197 spu_decoder_obj =               spu_decoder/spu_decoder.o
198
199 #??generic_decoder_obj =                generic_decoder/generic_decoder.o
200 # remeber to add it to OBJ 
201
202 video_parser_obj =              video_parser/video_parser.o \
203                                                 video_parser/vpar_headers.o \
204                                                 video_parser/vpar_blocks.o \
205                                                 video_parser/vpar_synchro.o \
206                                                 video_parser/video_fifo.o
207
208 video_decoder_obj =             video_decoder/video_decoder.o \
209                                                 video_decoder/vdec_motion.o \
210                                                 video_decoder/vdec_motion_inner.o \
211                                                 video_decoder/vdec_idct.o
212
213 misc_obj =                      misc/mtime.o \
214                                                 misc/tests.o \
215                                                 misc/rsc_files.o \
216                                                 misc/netutils.o \
217                                                 misc/playlist.o \
218                                                 misc/plugins.o \
219                                                 misc/decoder_fifo.o
220
221
222 C_OBJ = $(interface_obj) \
223                 $(input_obj) \
224                 $(audio_output_obj) \
225                 $(video_output_obj) \
226                 $(ac3_decoder_obj) \
227                 $(lpcm_decoder_obj) \
228                 $(audio_decoder_obj) \
229                 $(spu_decoder_obj) \
230                 $(generic_decoder_obj) \
231                 $(video_parser_obj) \
232                 $(video_decoder_obj) \
233                 $(vlan_obj) \
234                 $(misc_obj)
235
236 ifeq ($(SYS),beos)
237 CPP_OBJ =                       misc/beos_specific.o
238 endif
239
240 #
241 # Assembler Objects
242
243 ifneq (,$(findstring 86,$(ARCH)))
244 ifneq (,$(findstring mmx,$(ARCH)))
245 ASM_OBJ =                       video_decoder/vdec_idctmmx.o \
246                                                 video_output/video_yuv_mmx.o
247 endif
248 endif
249
250 #
251 # Plugins
252 #
253 PLUGINS := $(PLUGINS:%=lib/%.so)
254
255 PLUGIN_BEOS   = plugins/beos/beos.o \
256                 plugins/beos/aout_beos.o \
257                 plugins/beos/intf_beos.o \
258                 plugins/beos/vout_beos.o
259
260 PLUGIN_DSP    = plugins/dsp/dsp.o \
261                 plugins/dsp/aout_dsp.o \
262
263 PLUGIN_DUMMY  = plugins/dummy/dummy.o \
264                 plugins/dummy/aout_dummy.o \
265                 plugins/dummy/intf_dummy.o \
266                 plugins/dummy/vout_dummy.o
267
268 PLUGIN_ESD    = plugins/esd/esd.o \
269                 plugins/esd/aout_esd.o
270
271 PLUGIN_FB     = plugins/fb/fb.o \
272                 plugins/fb/intf_fb.o \
273                 plugins/fb/vout_fb.o
274
275 PLUGIN_GGI    = plugins/ggi/ggi.o \
276                 plugins/ggi/intf_ggi.o \
277                 plugins/ggi/vout_ggi.o
278
279 PLUGIN_GLIDE  = plugins/glide/glide.o \
280                 plugins/glide/intf_glide.o \
281                 plugins/glide/vout_glide.o
282
283 PLUGIN_GNOME  = plugins/gnome/gnome.o \
284                 plugins/gnome/intf_gnome.o \
285                 plugins/gnome/intf_gnome_callbacks.o \
286                 plugins/gnome/intf_gnome_interface.o \
287                 plugins/gnome/intf_gnome_support.o \
288                 plugins/gnome/vout_gnome.o
289
290 PLUGIN_MGA    = plugins/mga/mga.o \
291                 plugins/mga/intf_mga.o \
292                 plugins/mga/vout_mga.o
293
294 PLUGIN_X11    = plugins/x11/x11.o \
295                 plugins/x11/intf_x11.o \
296                 plugins/x11/vout_x11.o
297
298 PLUGIN_YUV    = plugins/yuv/yuv.o \
299                 plugins/yuv/video_yuv.o \
300                 plugins/yuv/video_yuv8.o \
301                 plugins/yuv/video_yuv15.o \
302                 plugins/yuv/video_yuv16.o \
303                 plugins/yuv/video_yuv24.o \
304                 plugins/yuv/video_yuv32.o
305
306 PLUGIN_YUVMMX = plugins/yuvmmx/yuvmmx.o \
307                 plugins/yuvmmx/video_yuv.o \
308                 plugins/yuvmmx/video_yuv8.o \
309                 plugins/yuvmmx/video_yuv15.o \
310                 plugins/yuvmmx/video_yuv16.o \
311                 plugins/yuvmmx/video_yuv24.o \
312                 plugins/yuvmmx/video_yuv32.o
313
314 PLUGIN_OBJ = $(PLUGIN_BEOS) $(PLUGIN_DSP) $(PLUGIN_DUMMY) $(PLUGIN_ESD) \
315                 $(PLUGIN_FB) $(PLUGIN_GGI) $(PLUGIN_GLIDE) $(PLUGIN_GNOME) \
316                 $(PLUGIN_MGA) $(PLUGIN_X11) $(PLUGIN_YUV) $(PLUGIN_YUVMMX)
317 #
318 # Other lists of files
319 #
320 C_OBJ := $(C_OBJ:%.o=src/%.o)
321 CPP_OBJ := $(CPP_OBJ:%.o=src/%.o)
322 ASM_OBJ := $(ASM_OBJ:%.o=src/%.o)
323 sources_c := $(C_OBJ:%.o=%.c)
324 dependancies := $(sources_c:%.c=.dep/%.d)
325
326 # All symbols must be exported
327 export
328
329 ################################################################################
330 # Targets
331 ################################################################################
332
333 #
334 # Virtual targets
335 #
336 all: vlc @ALIASES@ plugins
337
338 clean:
339         rm -f $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ) $(PLUGIN_OBJ)
340         rm -f vlc @ALIASES@ lib/*.so
341
342 distclean: clean
343         rm -f src/*/*.o plugins/*/*.o **/*~ *.log
344         rm -f Makefile include/defs.h include/config.h
345         rm -f config.status config.cache config.log
346         rm -f gmon.out core build-stamp
347         rm -rf .dep
348
349 install:
350         mkdir -p $(prefix)/bin
351         $(INSTALL) vlc $(prefix)/bin
352         mkdir -p $(prefix)/lib/videolan/vlc
353         $(INSTALL) -m 644 $(PLUGINS) $(prefix)/lib/videolan/vlc
354         mkdir -p $(prefix)/share/videolan
355         $(INSTALL) -m 644 share/*.psf $(prefix)/share/videolan
356         $(INSTALL) -m 644 share/*.png $(prefix)/share/videolan
357
358 show:
359         @echo CC: $(CC)
360         @echo CCFLAGS: $(CCFLAGS)
361         @echo DCFLAGS: $(DCFLAGS)
362         @echo LCFLAGS: $(CCFLAGS)
363
364 # ugliest of all, but I have no time to do it -- sam
365 snapshot:
366         rm -rf /tmp/${SNAPSHOTDIR}
367         mkdir /tmp/${SNAPSHOTDIR}
368         cp -r * /tmp/${SNAPSHOTDIR}
369                 (cd /tmp/${SNAPSHOTDIR} ; \
370                 make distclean ; \
371                 find . -type d -name CVS | xargs rm -rf ; \
372                 find . -type f -name '.*.swp' | xargs rm -f ; \
373                 cd .. ; \
374                 tar czvf ${SNAPSHOTDIR}.tar.gz ${SNAPSHOTDIR} ; \
375                 tar cIvf ${SNAPSHOTDIR}.tar.bz2 ${SNAPSHOTDIR} )
376         rm -rf /tmp/${SNAPSHOTDIR}
377         mv /tmp/${SNAPSHOTDIR}.tar.gz ..
378         mv /tmp/${SNAPSHOTDIR}.tar.bz2 ..
379         @echo "Sources are in ../${SNAPSHOTDIR}.tar.[gz,bz2]"
380
381 FORCE:
382
383 #
384 # Real targets
385 #
386 vlc: $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ)
387 ifeq ($(SYS),beos)
388         $(CC) $(CCFLAGS) $(LCFLAGS) $(CFLAGS) -Xlinker -soname=_APP_ -o $@ $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ)
389         rm -f ./plugins/_APP_
390         ln -s ../vlc ./plugins/_APP_
391 else
392         $(CC) $(CCFLAGS) $(LCFLAGS) $(CFLAGS) --export-dynamic -rdynamic -o $@ $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ)   
393 endif
394
395 gvlc xvlc fbvlc ggivlc glidevlc: vlc
396         rm -f $@ && ln -s vlc $@
397
398 plugins: $(PLUGINS)
399
400 #
401 # Generic rules (see below)
402 #
403 $(dependancies): %.d: FORCE
404         @$(MAKE) -s --no-print-directory -f Makefile.dep $@
405
406 $(C_OBJ): %.o: Makefile.dep
407 $(C_OBJ): %.o: .dep/%.d
408 $(C_OBJ): %.o: %.c
409         $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
410
411 $(CPP_OBJ): %.o: %.cpp
412         $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
413
414 $(ASM_OBJ): %.o: Makefile.dep
415 $(ASM_OBJ): %.o: %.S
416         $(CC) $(CFLAGS) -c -o $@ $<
417
418 #$(PLUGIN_OBJ): %.so: Makefile.dep
419 #$(PLUGIN_OBJ): %.so: .dep/%.d
420
421 lib/beos.so: $(PLUGIN_BEOS)
422         $(CC) $(CCFLAGS) $(CFLAGS) $(LCFLAGS) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_
423 $(PLUGIN_BEOS): %.o: %.cpp
424         $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
425
426 lib/esd.so: $(PLUGIN_ESD)
427 ifneq (,$(findstring bsd,$(SYS)))
428         ld -shared -lesd -o $@ $^
429 else
430         ld -shared -laudiofile -lesd -o $@ $^
431 endif
432 $(PLUGIN_ESD): %.o: %.c
433         $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
434
435 lib/dsp.so: $(PLUGIN_DSP)
436         ld -shared -o $@ $^
437 $(PLUGIN_DSP): %.o: %.c
438         $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
439
440 lib/dummy.so: $(PLUGIN_DUMMY)
441         ld -shared -o $@ $^
442 $(PLUGIN_DUMMY): %.o: %.c
443         $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
444
445 lib/fb.so: $(PLUGIN_FB)
446         ld -shared -o $@ $^
447 $(PLUGIN_FB): %.o: %.c
448         $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
449
450 lib/x11.so: $(PLUGIN_X11)
451         ld -shared -L/usr/X11R6/lib -lX11 -lXext -o $@ $^
452 $(PLUGIN_X11): %.o: %.c
453         $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
454
455 lib/mga.so: $(PLUGIN_MGA)
456         ld -shared -L/usr/X11R6/lib -lX11 -lXext -o $@ $^
457 $(PLUGIN_MGA): %.o: %.c
458         $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
459
460 lib/gnome.so: $(PLUGIN_GNOME)
461         ld -shared `gnome-config --libs gnomeui | sed 's,-rdynamic,,'` -o $@ $^
462 $(PLUGIN_GNOME): %.o: %.c
463         $(CC) $(CCFLAGS) $(CFLAGS) `gnome-config --cflags gnomeui` -c -o $@ $<
464
465 lib/glide.so: $(PLUGIN_GLIDE)
466         ld -shared -lglide2x -o $@ $^
467 $(PLUGIN_GLIDE): %.o: %.c
468         $(CC) $(CCFLAGS) $(CFLAGS) -I/usr/include/glide -c -o $@ $<
469
470 lib/ggi.so: $(PLUGIN_GGI)
471         ld -shared -lggi -o $@ $^
472 $(PLUGIN_GGI): %.o: %.c
473         $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
474
475 lib/yuv.so: $(PLUGIN_YUV)
476 ifeq ($(SYS),beos)
477         $(CC) $(CCFLAGS) $(CFLAGS) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_
478 else
479         ld -shared -o $@ $^
480 endif
481 $(PLUGIN_YUV): %.o: %.c
482         $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
483
484 lib/yuvmmx.so: $(PLUGIN_YUVMMX)
485 ifeq ($(SYS),beos)
486         $(CC) $(CCFLAGS) $(CFLAGS) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_
487 else
488         ld -shared -o $@ $^
489 endif
490 $(PLUGIN_YUVMMX): %.o: %.c
491         $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
492
493 ################################################################################
494 # Note on generic rules and dependancies
495 ################################################################################
496
497 # Note on dependancies: each .c file is associated with a .d file, which
498 # depends of it. The .o file associated with a .c file depends of the .d, of the
499 # .c itself, and of Makefile. The .d files are stored in a separate .dep/
500 # directory.
501 # The dep directory should be ignored by CVS.
502
503 # Note on inclusions: depending of the target, the dependancies files must
504 # or must not be included. The problem is that if we ask make to include a file,
505 # and this file does not exist, it is made before it can be included. In a
506 # general way, a .d file should be included if and only if the corresponding .o
507 # needs to be re-made.
508
509 # Two makefiles are used: the main one (this one) has regular generic rules,
510 # except for .o files, for which it calls the object Makefile. Dependancies
511 # are not included in this file.
512 # The object Makefile known how to make a .o from a .c, and includes
513 # dependancies for the target, but only those required.