. encore un peu plus loin dans le passage � autoconf
[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 ARCH=@ARCH@
17 AOUT=@AOUT@
18 VOUT=@VOUT@
19 INTF=@VOUT@
20 SNAPSHOTDIR=vlc-@VLC_VERSION@
21 INSTALL=@INSTALL@
22 prefix=@prefix@
23
24 #----------------- do not change anything below this line ----------------------
25
26 ################################################################################
27 # Configuration pre-processing
28 ################################################################################
29
30 # PROGRAM_OPTIONS is an identification string of the compilation options
31 PROGRAM_OPTIONS = $(SYS) $(ARCH)
32 ifeq ($(DEBUG),1)
33 PROGRAM_OPTIONS += DEBUG
34 endif
35
36 # PROGRAM_BUILD is a complete identification of the build
37 # ( we can't use fancy options with date since OSes like Solaris
38 # or FreeBSD have strange date implementations )
39 PROGRAM_BUILD = `date` $(USER)
40 # XXX: beos does not support hostname
41 #PROGRAM_BUILD = `date` $(USER)@`hostname`
42
43 # DEFINE will contain some of the constants definitions decided in Makefile, 
44 # including SYS_xx. It will be passed to C compiler.
45 DEFINE += -DSYS_`echo $(SYS) | sed 's/-.*//' | tr a-z A-Z`
46 DEFINE += -DPLUGIN_PATH="\"$(prefix)/lib/videolan/vlc\""
47 DEFINE += -DDATA_PATH="\"$(prefix)/share/videolan/vlc\""
48 #DEFINE += -DPROGRAM_OPTIONS="\"$(shell echo $(PROGRAM_OPTIONS) | tr 'A-Z' 'a-z')\""
49 #DEFINE += -DPROGRAM_BUILD="\"$(PROGRAM_BUILD)\""
50 ifeq ($(DEBUG),1)
51 DEFINE += -DDEBUG
52 endif
53
54 ################################################################################
55 # Tuning and other variables - do not change anything except if you know
56 # exactly what you are doing
57 ################################################################################
58
59 #
60 # C headers directories
61 #
62 INCLUDE += -Iinclude -I/usr/local/include -I/usr/X11R6/include
63
64 #
65 # Libraries
66 #
67
68 ifeq ($(SYS),gnu)
69 LIB += -lthreads -ldl
70 endif
71
72 ifneq (,$(findstring bsd,$(SYS)))
73 LIB += -pthread -lgnugetopt
74 LIB += -L/usr/local/lib
75 endif
76
77 ifneq (,$(findstring linux,$(SYS)))
78 LIB += -lpthread -ldl
79 endif
80
81 ifeq ($(SYS),beos)
82 LIB += -lbe -lroot -lgame
83 else
84 LIB += -lm
85 endif
86
87 #
88 # C compiler flags: compilation
89 #
90 CCFLAGS += $(DEFINE) $(INCLUDE)
91 CCFLAGS += -Wall
92 CCFLAGS += -D_REENTRANT
93 CCFLAGS += -D_GNU_SOURCE
94
95 # flags needed for clean beos compilation
96 CCFLAGS += -Wno-multichar -Wno-ctor-dtor-privacy -Woverloaded-virtual
97
98 # Optimizations : don't compile debug versions with them
99 CCFLAGS += -O6
100 CCFLAGS += -ffast-math -funroll-loops -fargument-noalias-global
101 CCFLAGS += -fomit-frame-pointer
102
103 # Optimizations for x86 familiy
104 ifneq (,$(findstring 86,$(ARCH)))
105 CCFLAGS += -malign-double
106 #CCFLAGS += -march=pentium
107 # Eventual Pentium Pro optimizations
108 ifneq (,$(findstring pentiumpro,$(ARCH)))
109 ifneq ($(SYS), BSD)
110 CCFLAGS += -march=pentiumpro
111 endif
112 endif
113 # Eventual MMX optimizations for x86
114 ifneq (,$(findstring mmx,$(ARCH)))
115 CFLAGS += -DHAVE_MMX
116 endif
117 endif
118
119 # Optimizations for PowerPC
120 ifneq (,$(findstring ppc,$(ARCH)))
121 CCFLAGS += -mcpu=604e -mmultiple -mhard-float -mstring
122 endif
123
124 # Optimizations for Sparc
125 ifneq (,$(findstring sparc,$(ARCH)))
126 CCFLAGS += -mhard-float
127 endif
128
129 #
130 # C compiler flags: dependancies
131 #
132 DCFLAGS += $(INCLUDE)
133 DCFLAGS += -MM
134
135 #
136 # C compiler flags: linking
137 #
138 LCFLAGS += $(LIB)
139 LCFLAGS += -Wall
140 #LCFLAGS += -s
141
142 #
143 # Additionnal debugging flags
144 #
145
146 # Debugging support
147 ifeq ($(DEBUG),1)
148 CFLAGS += -g
149 CFLAGS += -pg
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 video_decoder_obj =             video_decoder/video_decoder.o \
211                                                 video_decoder/vdec_motion.o \
212                                                 video_decoder/vdec_motion_inner.o \
213                                                 video_decoder/vdec_idct.o
214
215 misc_obj =                      misc/mtime.o \
216                                                 misc/rsc_files.o \
217                                                 misc/netutils.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 intf_plugin =           $(INTF:%=plugins/intf/intf_%.so)
254 aout_plugin =           $(AOUT:%=plugins/aout/aout_%.so)
255 vout_plugin =           $(VOUT:%=plugins/vout/vout_%.so)
256
257 PLUGIN_OBJ = $(intf_plugin) $(aout_plugin) $(vout_plugin)
258
259 #
260 # Other lists of files
261 #
262 C_OBJ := $(C_OBJ:%.o=src/%.o)
263 CPP_OBJ := $(CPP_OBJ:%.o=src/%.o)
264 ASM_OBJ := $(ASM_OBJ:%.o=src/%.o)
265 sources_c := $(C_OBJ:%.o=%.c)
266 dependancies := $(sources_c:%.c=.dep/%.d)
267
268 # All symbols must be exported
269 export
270
271 ################################################################################
272 # Targets
273 ################################################################################
274
275 #
276 # Virtual targets
277 #
278 all: vlc plugins
279
280 clean:
281         rm -f $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ) $(PLUGIN_OBJ)
282
283 distclean: clean
284         rm -f **/*.o **/*.so **/*~ *.log
285         rm -f Makefile include/defs.h config.cache config.log
286         rm -f vlc gmon.out core
287         rm -rf .dep
288
289 install:
290         $(INSTALL) vlc $(prefix)/bin
291         mkdir -p $(prefix)/lib/videolan/vlc
292         $(INSTALL) $(PLUGIN_OBJ) $(prefix)/lib/videolan/vlc
293         $(INSTALL) share/*.psf $(prefix)/share/videolan/vlc
294         $(INSTALL) share/*.png $(prefix)/share/videolan/vlc
295
296 show:
297         @echo "Command line for C objects:"
298         @echo $(CC) $(CCFLAGS) $(CFLAGS) -c -o "<dest.o>" "<src.c>"
299         @echo
300         @echo "Command line for assembler objects:"
301         @echo $(CC) $(CFLAGS) -c -o "<dest.o>" "<src.S>"
302
303 # ugliest of all, but I have no time to do it -- sam
304 snapshot:
305         rm -rf /tmp/${SNAPSHOTDIR}
306         mkdir /tmp/${SNAPSHOTDIR}
307         cp -a * /tmp/${SNAPSHOTDIR}
308                 (cd /tmp/${SNAPSHOTDIR} ; \
309                 make distclean ; \
310                 find . -type d -name CVS | xargs rm -rf ; \
311                 find . -type f -name '.*.swp' | xargs rm -f ; \
312                 cd .. ; \
313                 tar czvf ${SNAPSHOTDIR}.tar.gz ${SNAPSHOTDIR} )
314         rm -rf /tmp/${SNAPSHOTDIR}
315         mv /tmp/${SNAPSHOTDIR}.tar.gz ..
316         @echo "Sources are in ../${SNAPSHOTDIR}.tar.gz"
317
318 FORCE:
319
320 #
321 # Real targets
322 #
323 vlc: $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ)
324 ifeq ($(SYS),beos)
325         $(CC) $(CCFLAGS) $(LCFLAGS) $(CFLAGS) -Xlinker -soname=_APP_ -o $@ $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ)
326 #       ln -s ../vlc ./plugins/_APP_
327 else
328         $(CC) $(CCFLAGS) $(LCFLAGS) $(CFLAGS) --export-dynamic -rdynamic -o $@ $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ)   
329 endif
330
331 plugins: $(PLUGIN_OBJ)
332
333 #
334 # Generic rules (see below)
335 #
336 $(dependancies): %.d: FORCE
337         @$(MAKE) -s --no-print-directory -f Makefile.dep $@
338
339 $(C_OBJ): %.o: Makefile.dep
340 $(C_OBJ): %.o: .dep/%.d
341 $(C_OBJ): %.o: %.c
342         @echo "compiling $*.o from $*.c"
343         @$(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
344
345 $(CPP_OBJ): %.o: %.cpp
346         @echo "compiling $*.o from $*.cpp"
347         @$(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
348
349 $(ASM_OBJ): %.o: Makefile.dep
350 $(ASM_OBJ): %.o: %.S
351         @echo "assembling $*.o from $*.S"
352         @$(CC) $(CFLAGS) -c -o $@ $<
353
354 #$(PLUGIN_OBJ): %.so: Makefile.dep
355 #$(PLUGIN_OBJ): %.so: .dep/%.d
356
357 # audio plugins
358 plugins/aout/aout_dummy.so plugins/aout/aout_dsp.so: %.so: %.c
359                 @echo "compiling $*.so from $*.c"
360 ifeq ($(SYS),beos)
361                 @$(CC) $(CCFLAGS) $(CFLAGS) -nostart -Xlinker -soname=$@ -o $@ $< plugins/_APP_
362 else
363                 @$(CC) $(CCFLAGS) $(CFLAGS) -shared -o $@ $<
364 endif
365
366 plugins/aout/aout_esd.so: %.so: %.c
367                 @echo "compiling $*.so from $*.c"
368 ifneq (,$(findstring bsd,$(SYS)))
369                 @$(CC) $(CCFLAGS) $(CFLAGS) -lesd -shared -o $@ $<
370 else
371                 @$(CC) $(CCFLAGS) $(CFLAGS) -laudiofile -lesd -shared -o $@ $<
372 endif
373
374 # video plugins
375 plugins/intf/intf_dummy.so plugins/vout/vout_dummy.so \
376         plugins/intf/intf_fb.so plugins/vout/vout_fb.so: %.so: %.c
377                 @echo "compiling $*.so from $*.c"
378 ifeq ($(SYS),beos)
379                 @$(CC) $(CCFLAGS) $(CFLAGS) -nostart -Xlinker -soname=$@ -o $@ $< plugins/_APP_
380 else
381                 @$(CC) $(CCFLAGS) $(CFLAGS) -shared -o $@ $<
382 endif
383
384 plugins/intf/intf_x11.so plugins/vout/vout_x11.so: %.so: %.c
385                 @echo "compiling $*.so from $*.c"
386                 @$(CC) $(CCFLAGS) $(CFLAGS) -I/usr/X11R6/include -L/usr/X11R6/lib -lX11 -lXext -shared -o $@ $<
387
388 plugins/intf/intf_mga.so plugins/vout/vout_mga.so: %.so: %.c
389                 @echo "compiling $*.so from $*.c"
390                 @$(CC) $(CCFLAGS) $(CFLAGS) -I/usr/X11R6/include -L/usr/X11R6/lib -lX11 -lXext -shared -o $@ $<
391
392 plugins/intf/intf_gnome.so: %.so: %.c
393                 @echo "compiling $*.so from $*.c"
394                 @$(CC) $(CCFLAGS) $(CFLAGS) $(LCFLAGS) `gnome-config --libs --cflags gnomeui` -shared -o $@ $< plugins/intf/intf_gnome_callbacks.c plugins/intf/intf_gnome_interface.c plugins/intf/intf_gnome_support.c
395
396 plugins/vout/vout_gnome.so: %.so: %.c
397                 @echo "compiling $*.so from $*.c"
398                 @$(CC) $(CCFLAGS) $(CFLAGS) -I/usr/X11R6/include -L/usr/X11R6/lib -lX11 -lXext -shared -o $@ $<
399
400 plugins/intf/intf_glide.so plugins/vout/vout_glide.so: %.so: %.c
401                 @echo "compiling $*.so from $*.c"
402                 @$(CC) $(CCFLAGS) $(CFLAGS) -I/usr/include/glide -lglide2x -shared -o $@ $<
403
404 plugins/intf/intf_ggi.so plugins/vout/vout_ggi.so: %.so: %.c
405                 @echo "compiling $*.so from $*.c"
406                 @$(CC) $(CCFLAGS) $(CFLAGS) -lggi -shared -o $@ $<
407
408 plugins/intf/intf_beos.so: %.so: %.cpp
409                 @echo "compiling $*.so from $*.cpp"
410                 @$(CC) $(LCFLAGS) $(CCFLAGS) $(CFLAGS) -nostart -Xlinker -soname=$@ -o $@ $< plugins/_APP_
411
412 plugins/vout/vout_beos.so: %.so: %.cpp
413                 @echo "compiling $*.so from $*.cpp"
414                 @$(CC) $(LCFLAGS) $(CCFLAGS) $(CFLAGS) -nostart -Xlinker -soname=$@ -o $@ $< plugins/_APP_
415                 
416
417 ################################################################################
418 # Note on generic rules and dependancies
419 ################################################################################
420
421 # Note on dependancies: each .c file is associated with a .d file, which
422 # depends of it. The .o file associated with a .c file depends of the .d, of the
423 # .c itself, and of Makefile. The .d files are stored in a separate .dep/
424 # directory.
425 # The dep directory should be ignored by CVS.
426
427 # Note on inclusions: depending of the target, the dependancies files must
428 # or must not be included. The problem is that if we ask make to include a file,
429 # and this file does not exist, it is made before it can be included. In a
430 # general way, a .d file should be included if and only if the corresponding .o
431 # needs to be re-made.
432
433 # Two makefiles are used: the main one (this one) has regular generic rules,
434 # except for .o files, for which it calls the object Makefile. Dependancies
435 # are not included in this file.
436 # The object Makefile known how to make a .o from a .c, and includes
437 # dependancies for the target, but only those required.