]> git.sesse.net Git - vlc/blob - Makefile.in
2d37bbc60eeff9791146ccb111e863be75c493f7
[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/rsc_files.o \
215                                                 misc/netutils.o \
216                                                 misc/playlist.o \
217                                                 misc/plugins.o \
218                                                 misc/decoder_fifo.o
219
220
221 C_OBJ = $(interface_obj) \
222                 $(input_obj) \
223                 $(audio_output_obj) \
224                 $(video_output_obj) \
225                 $(ac3_decoder_obj) \
226                 $(lpcm_decoder_obj) \
227                 $(audio_decoder_obj) \
228                 $(spu_decoder_obj) \
229                 $(generic_decoder_obj) \
230                 $(video_parser_obj) \
231                 $(video_decoder_obj) \
232                 $(vlan_obj) \
233                 $(misc_obj)
234
235 ifeq ($(SYS),beos)
236 CPP_OBJ =                       misc/beos_specific.o
237 endif
238
239 #
240 # Assembler Objects
241
242 ifneq (,$(findstring 86,$(ARCH)))
243 ifneq (,$(findstring mmx,$(ARCH)))
244 ASM_OBJ =                       video_decoder/vdec_idctmmx.o \
245                                                 video_output/video_yuv_mmx.o
246 endif
247 endif
248
249 #
250 # Plugins
251 #
252 PLUGINS := $(PLUGINS:%=lib/%.so)
253
254 PLUGIN_BEOS   = plugins/beos/beos.o \
255                 plugins/beos/aout_beos.o \
256                 plugins/beos/intf_beos.o \
257                 plugins/beos/vout_beos.o
258
259 PLUGIN_DSP    = plugins/dsp/dsp.o \
260                 plugins/dsp/aout_dsp.o \
261
262 PLUGIN_DUMMY  = plugins/dummy/dummy.o \
263                 plugins/dummy/aout_dummy.o \
264                 plugins/dummy/intf_dummy.o \
265                 plugins/dummy/vout_dummy.o
266
267 PLUGIN_ESD    = plugins/esd/esd.o \
268                 plugins/esd/aout_esd.o
269
270 PLUGIN_FB     = plugins/fb/fb.o \
271                 plugins/fb/intf_fb.o \
272                 plugins/fb/vout_fb.o
273
274 PLUGIN_GGI    = plugins/ggi/ggi.o \
275                 plugins/ggi/intf_ggi.o \
276                 plugins/ggi/vout_ggi.o
277
278 PLUGIN_GLIDE  = plugins/glide/glide.o \
279                 plugins/glide/intf_glide.o \
280                 plugins/glide/vout_glide.o
281
282 PLUGIN_GNOME  = plugins/gnome/gnome.o \
283                 plugins/gnome/intf_gnome.o \
284                 plugins/gnome/intf_gnome_callbacks.o \
285                 plugins/gnome/intf_gnome_interface.o \
286                 plugins/gnome/intf_gnome_support.o \
287                 plugins/gnome/vout_gnome.o
288
289 PLUGIN_MGA    = plugins/mga/mga.o \
290                 plugins/mga/intf_mga.o \
291                 plugins/mga/vout_mga.o
292
293 PLUGIN_X11    = plugins/x11/x11.o \
294                 plugins/x11/intf_x11.o \
295                 plugins/x11/vout_x11.o
296
297 PLUGIN_YUV    = plugins/yuv/yuv.o \
298                 plugins/yuv/video_yuv.o \
299                 plugins/yuv/video_yuv8.o \
300                 plugins/yuv/video_yuv15.o \
301                 plugins/yuv/video_yuv16.o \
302                 plugins/yuv/video_yuv24.o \
303                 plugins/yuv/video_yuv32.o
304
305 PLUGIN_YUVMMX = plugins/yuvmmx/yuvmmx.o \
306                 plugins/yuvmmx/video_yuv.o \
307                 plugins/yuvmmx/video_yuv8.o \
308                 plugins/yuvmmx/video_yuv15.o \
309                 plugins/yuvmmx/video_yuv16.o \
310                 plugins/yuvmmx/video_yuv24.o \
311                 plugins/yuvmmx/video_yuv32.o
312
313 PLUGIN_OBJ = $(PLUGIN_BEOS) $(PLUGIN_DSP) $(PLUGIN_DUMMY) $(PLUGIN_ESD) \
314                 $(PLUGIN_FB) $(PLUGIN_GGI) $(PLUGIN_GLIDE) $(PLUGIN_GNOME) \
315                 $(PLUGIN_MGA) $(PLUGIN_X11) $(PLUGIN_YUV) $(PLUGIN_YUVMMX)
316 #
317 # Other lists of files
318 #
319 C_OBJ := $(C_OBJ:%.o=src/%.o)
320 CPP_OBJ := $(CPP_OBJ:%.o=src/%.o)
321 ASM_OBJ := $(ASM_OBJ:%.o=src/%.o)
322 sources_c := $(C_OBJ:%.o=%.c)
323 dependancies := $(sources_c:%.c=.dep/%.d)
324
325 # All symbols must be exported
326 export
327
328 ################################################################################
329 # Targets
330 ################################################################################
331
332 #
333 # Virtual targets
334 #
335 all: vlc @ALIASES@ plugins
336
337 clean:
338         rm -f $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ) $(PLUGIN_OBJ)
339         rm -f vlc @ALIASES@ lib/*.so
340
341 distclean: clean
342         rm -f src/*/*.o plugins/*/*.o **/*~ *.log
343         rm -f Makefile include/defs.h include/config.h
344         rm -f config.status config.cache config.log
345         rm -f gmon.out core build-stamp
346         rm -rf .dep
347
348 install:
349         mkdir -p $(prefix)/bin
350         $(INSTALL) vlc $(prefix)/bin
351         mkdir -p $(prefix)/lib/videolan/vlc
352         $(INSTALL) -m 644 $(PLUGINS) $(prefix)/lib/videolan/vlc
353         mkdir -p $(prefix)/share/videolan
354         $(INSTALL) -m 644 share/*.psf $(prefix)/share/videolan
355         $(INSTALL) -m 644 share/*.png $(prefix)/share/videolan
356
357 show:
358         @echo CC: $(CC)
359         @echo CCFLAGS: $(CCFLAGS)
360         @echo DCFLAGS: $(DCFLAGS)
361         @echo LCFLAGS: $(CCFLAGS)
362
363 # ugliest of all, but I have no time to do it -- sam
364 snapshot:
365         rm -rf /tmp/${SNAPSHOTDIR}
366         mkdir /tmp/${SNAPSHOTDIR}
367         cp -r * /tmp/${SNAPSHOTDIR}
368                 (cd /tmp/${SNAPSHOTDIR} ; \
369                 make distclean ; \
370                 find . -type d -name CVS | xargs rm -rf ; \
371                 find . -type f -name '.*.swp' | xargs rm -f ; \
372                 cd .. ; \
373                 tar czvf ${SNAPSHOTDIR}.tar.gz ${SNAPSHOTDIR} ; \
374                 tar cIvf ${SNAPSHOTDIR}.tar.bz2 ${SNAPSHOTDIR} )
375         rm -rf /tmp/${SNAPSHOTDIR}
376         mv /tmp/${SNAPSHOTDIR}.tar.gz ..
377         mv /tmp/${SNAPSHOTDIR}.tar.bz2 ..
378         @echo "Sources are in ../${SNAPSHOTDIR}.tar.[gz,bz2]"
379
380 FORCE:
381
382 #
383 # Real targets
384 #
385 vlc: $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ)
386 ifeq ($(SYS),beos)
387         $(CC) $(CCFLAGS) $(LCFLAGS) $(CFLAGS) -Xlinker -soname=_APP_ -o $@ $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ)
388         rm -f ./plugins/_APP_
389         ln -s ../vlc ./plugins/_APP_
390 else
391         $(CC) $(CCFLAGS) $(LCFLAGS) $(CFLAGS) --export-dynamic -rdynamic -o $@ $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ)   
392 endif
393
394 gvlc xvlc fbvlc ggivlc glidevlc: vlc
395         rm -f $@ && ln -s vlc $@
396
397 plugins: $(PLUGINS)
398
399 #
400 # Generic rules (see below)
401 #
402 $(dependancies): %.d: FORCE
403         @$(MAKE) -s --no-print-directory -f Makefile.dep $@
404
405 $(C_OBJ): %.o: Makefile.dep
406 $(C_OBJ): %.o: .dep/%.d
407 $(C_OBJ): %.o: %.c
408         $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
409
410 $(CPP_OBJ): %.o: %.cpp
411         $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
412
413 $(ASM_OBJ): %.o: Makefile.dep
414 $(ASM_OBJ): %.o: %.S
415         $(CC) $(CFLAGS) -c -o $@ $<
416
417 #$(PLUGIN_OBJ): %.so: Makefile.dep
418 #$(PLUGIN_OBJ): %.so: .dep/%.d
419
420 lib/beos.so: $(PLUGIN_BEOS)
421         $(CC) $(CCFLAGS) $(CFLAGS) $(LCFLAGS) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_
422 $(PLUGIN_BEOS): %.o: %.cpp
423         $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
424
425 lib/esd.so: $(PLUGIN_ESD)
426 ifneq (,$(findstring bsd,$(SYS)))
427         ld -shared -lesd -o $@ $^
428 else
429         ld -shared -laudiofile -lesd -o $@ $^
430 endif
431 $(PLUGIN_ESD): %.o: %.c
432         $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
433
434 lib/dsp.so: $(PLUGIN_DSP)
435         ld -shared -o $@ $^
436 $(PLUGIN_DSP): %.o: %.c
437         $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
438
439 lib/dummy.so: $(PLUGIN_DUMMY)
440         ld -shared -o $@ $^
441 $(PLUGIN_DUMMY): %.o: %.c
442         $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
443
444 lib/fb.so: $(PLUGIN_FB)
445         ld -shared -o $@ $^
446 $(PLUGIN_FB): %.o: %.c
447         $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
448
449 lib/x11.so: $(PLUGIN_X11)
450         ld -shared -L/usr/X11R6/lib -lX11 -lXext -o $@ $^
451 $(PLUGIN_X11): %.o: %.c
452         $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
453
454 lib/mga.so: $(PLUGIN_MGA)
455         ld -shared -L/usr/X11R6/lib -lX11 -lXext -o $@ $^
456 $(PLUGIN_MGA): %.o: %.c
457         $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
458
459 lib/gnome.so: $(PLUGIN_GNOME)
460         ld -shared `gnome-config --libs gnomeui | sed 's,-rdynamic,,'` -o $@ $^
461 $(PLUGIN_GNOME): %.o: %.c
462         $(CC) $(CCFLAGS) $(CFLAGS) `gnome-config --cflags gnomeui` -c -o $@ $<
463
464 lib/glide.so: $(PLUGIN_GLIDE)
465         ld -shared -lglide2x -o $@ $^
466 $(PLUGIN_GLIDE): %.o: %.c
467         $(CC) $(CCFLAGS) $(CFLAGS) -I/usr/include/glide -c -o $@ $<
468
469 lib/ggi.so: $(PLUGIN_GGI)
470         ld -shared -lggi -o $@ $^
471 $(PLUGIN_GGI): %.o: %.c
472         $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
473
474 lib/yuv.so: $(PLUGIN_YUV)
475 ifeq ($(SYS),beos)
476         $(CC) $(CCFLAGS) $(CFLAGS) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_
477 else
478         ld -shared -o $@ $^
479 endif
480 $(PLUGIN_YUV): %.o: %.c
481         $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
482
483 lib/yuvmmx.so: $(PLUGIN_YUVMMX)
484 ifeq ($(SYS),beos)
485         $(CC) $(CCFLAGS) $(CFLAGS) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_
486 else
487         ld -shared -o $@ $^
488 endif
489 $(PLUGIN_YUVMMX): %.o: %.c
490         $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
491
492 ################################################################################
493 # Note on generic rules and dependancies
494 ################################################################################
495
496 # Note on dependancies: each .c file is associated with a .d file, which
497 # depends of it. The .o file associated with a .c file depends of the .d, of the
498 # .c itself, and of Makefile. The .d files are stored in a separate .dep/
499 # directory.
500 # The dep directory should be ignored by CVS.
501
502 # Note on inclusions: depending of the target, the dependancies files must
503 # or must not be included. The problem is that if we ask make to include a file,
504 # and this file does not exist, it is made before it can be included. In a
505 # general way, a .d file should be included if and only if the corresponding .o
506 # needs to be re-made.
507
508 # Two makefiles are used: the main one (this one) has regular generic rules,
509 # except for .o files, for which it calls the object Makefile. Dependancies
510 # are not included in this file.
511 # The object Makefile known how to make a .o from a .c, and includes
512 # dependancies for the target, but only those required.