]> git.sesse.net Git - vlc/blob - Makefile.in
. autoconf
[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 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_$(shell 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 plugins/*/*.so **/*~ *.log
285         rm -f Makefile include/defs.h include/config.h
286         rm -f config.status config.cache config.log
287         rm -f vlc gmon.out core
288         rm -rf .dep
289
290 install:
291         $(INSTALL) vlc $(prefix)/bin
292         mkdir -p $(prefix)/lib/videolan/vlc
293         mkdir -p $(prefix)/share/videolan/vlc
294         $(INSTALL) $(PLUGIN_OBJ) $(prefix)/lib/videolan/vlc
295         $(INSTALL) share/*.psf $(prefix)/share/videolan/vlc
296         $(INSTALL) share/*.png $(prefix)/share/videolan/vlc
297
298 show:
299         @echo "Command line for C objects:"
300         @echo $(CC) $(CCFLAGS) $(CFLAGS) -c -o "<dest.o>" "<src.c>"
301         @echo
302         @echo "Command line for assembler objects:"
303         @echo $(CC) $(CFLAGS) -c -o "<dest.o>" "<src.S>"
304
305 # ugliest of all, but I have no time to do it -- sam
306 snapshot:
307         rm -rf /tmp/${SNAPSHOTDIR}
308         mkdir /tmp/${SNAPSHOTDIR}
309         cp -r * /tmp/${SNAPSHOTDIR}
310                 (cd /tmp/${SNAPSHOTDIR} ; \
311                 make distclean ; \
312                 find . -type d -name CVS | xargs rm -rf ; \
313                 find . -type f -name '.*.swp' | xargs rm -f ; \
314                 cd .. ; \
315                 tar czvf ${SNAPSHOTDIR}.tar.gz ${SNAPSHOTDIR} )
316         rm -rf /tmp/${SNAPSHOTDIR}
317         mv /tmp/${SNAPSHOTDIR}.tar.gz ..
318         @echo "Sources are in ../${SNAPSHOTDIR}.tar.gz"
319
320 FORCE:
321
322 #
323 # Real targets
324 #
325 vlc: $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ)
326 ifeq ($(SYS),beos)
327         $(CC) $(CCFLAGS) $(LCFLAGS) $(CFLAGS) -Xlinker -soname=_APP_ -o $@ $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ)
328 #       ln -s ../vlc ./plugins/_APP_
329 else
330         $(CC) $(CCFLAGS) $(LCFLAGS) $(CFLAGS) --export-dynamic -rdynamic -o $@ $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ)   
331 endif
332
333 plugins: $(PLUGIN_OBJ)
334
335 #
336 # Generic rules (see below)
337 #
338 $(dependancies): %.d: FORCE
339         @$(MAKE) -s --no-print-directory -f Makefile.dep $@
340
341 $(C_OBJ): %.o: Makefile.dep
342 $(C_OBJ): %.o: .dep/%.d
343 $(C_OBJ): %.o: %.c
344         $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
345
346 $(CPP_OBJ): %.o: %.cpp
347         $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
348
349 $(ASM_OBJ): %.o: Makefile.dep
350 $(ASM_OBJ): %.o: %.S
351         $(CC) $(CFLAGS) -c -o $@ $<
352
353 #$(PLUGIN_OBJ): %.so: Makefile.dep
354 #$(PLUGIN_OBJ): %.so: .dep/%.d
355
356 # audio plugins
357 plugins/aout/aout_dummy.so plugins/aout/aout_dsp.so: %.so: %.c
358 ifeq ($(SYS),beos)
359         $(CC) $(CCFLAGS) $(CFLAGS) -nostart -Xlinker -soname=$@ -o $@ $< plugins/_APP_
360 else
361         $(CC) $(CCFLAGS) $(CFLAGS) -shared -o $@ $<
362 endif
363
364 plugins/aout/aout_esd.so: %.so: %.c
365 ifneq (,$(findstring bsd,$(SYS)))
366         $(CC) $(CCFLAGS) $(CFLAGS) -lesd -shared -o $@ $<
367 else
368         $(CC) $(CCFLAGS) $(CFLAGS) -laudiofile -lesd -shared -o $@ $<
369 endif
370
371 # video plugins
372 plugins/intf/intf_dummy.so plugins/vout/vout_dummy.so \
373         plugins/intf/intf_fb.so plugins/vout/vout_fb.so: %.so: %.c
374 ifeq ($(SYS),beos)
375         $(CC) $(CCFLAGS) $(CFLAGS) -nostart -Xlinker -soname=$@ -o $@ $< plugins/_APP_
376 else
377         $(CC) $(CCFLAGS) $(CFLAGS) -shared -o $@ $<
378 endif
379
380 plugins/intf/intf_x11.so plugins/vout/vout_x11.so: %.so: %.c
381         $(CC) $(CCFLAGS) $(CFLAGS) -I/usr/X11R6/include -L/usr/X11R6/lib -lX11 -lXext -shared -o $@ $<
382
383 plugins/intf/intf_mga.so plugins/vout/vout_mga.so: %.so: %.c
384         $(CC) $(CCFLAGS) $(CFLAGS) -I/usr/X11R6/include -L/usr/X11R6/lib -lX11 -lXext -shared -o $@ $<
385
386 plugins/intf/intf_gnome.so: %.so: %.c
387         $(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
388
389 plugins/vout/vout_gnome.so: %.so: %.c
390         $(CC) $(CCFLAGS) $(CFLAGS) -I/usr/X11R6/include -L/usr/X11R6/lib -lX11 -lXext -shared -o $@ $<
391
392 plugins/intf/intf_glide.so plugins/vout/vout_glide.so: %.so: %.c
393         $(CC) $(CCFLAGS) $(CFLAGS) -I/usr/include/glide -lglide2x -shared -o $@ $<
394
395 plugins/intf/intf_ggi.so plugins/vout/vout_ggi.so: %.so: %.c
396         $(CC) $(CCFLAGS) $(CFLAGS) -lggi -shared -o $@ $<
397
398 plugins/intf/intf_beos.so: %.so: %.cpp
399         $(CC) $(LCFLAGS) $(CCFLAGS) $(CFLAGS) -nostart -Xlinker -soname=$@ -o $@ $< plugins/_APP_
400
401 plugins/vout/vout_beos.so: %.so: %.cpp
402         $(CC) $(LCFLAGS) $(CCFLAGS) $(CFLAGS) -nostart -Xlinker -soname=$@ -o $@ $< plugins/_APP_
403                 
404
405 ################################################################################
406 # Note on generic rules and dependancies
407 ################################################################################
408
409 # Note on dependancies: each .c file is associated with a .d file, which
410 # depends of it. The .o file associated with a .c file depends of the .d, of the
411 # .c itself, and of Makefile. The .d files are stored in a separate .dep/
412 # directory.
413 # The dep directory should be ignored by CVS.
414
415 # Note on inclusions: depending of the target, the dependancies files must
416 # or must not be included. The problem is that if we ask make to include a file,
417 # and this file does not exist, it is made before it can be included. In a
418 # general way, a .d file should be included if and only if the corresponding .o
419 # needs to be re-made.
420
421 # Two makefiles are used: the main one (this one) has regular generic rules,
422 # except for .o files, for which it calls the object Makefile. Dependancies
423 # are not included in this file.
424 # The object Makefile known how to make a .o from a .c, and includes
425 # dependancies for the target, but only those required.