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