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