Makefile.in 11.8 KB
Newer Older
Michel Kaempf's avatar
Michel Kaempf committed
1
2
3
4
5
6
7
8
9
10
11
################################################################################
# vlc (VideoLAN Client) main makefile
# (c)1998 VideoLAN
################################################################################
# This makefile is the main makefile for the VideoLAN client.
################################################################################

################################################################################
# Configuration
################################################################################

Vincent Seguin's avatar
Vincent Seguin committed
12
# Debugging mode on or off (set to 1 to activate)
Michel Lespinasse's avatar
   
Michel Lespinasse committed
13
DEBUG=0
Jean-Marc Dressler's avatar
   
Jean-Marc Dressler committed
14

15
16
17
18
19
20
SYS=@SYS@
ARCH=@ARCH@
AOUT=@AOUT@
VOUT=@VOUT@
INTF=@VOUT@
SNAPSHOTDIR=vlc-@VLC_VERSION@
21
INSTALL=@INSTALL@
22
23
24
prefix=@prefix@

#----------------- do not change anything below this line ----------------------
25

Vincent Seguin's avatar
Vincent Seguin committed
26
27
28
29
################################################################################
# Configuration pre-processing
################################################################################

Vincent Seguin's avatar
Vincent Seguin committed
30
# PROGRAM_OPTIONS is an identification string of the compilation options
31
PROGRAM_OPTIONS = $(SYS) $(ARCH)
Vincent Seguin's avatar
Vincent Seguin committed
32
ifeq ($(DEBUG),1)
Vincent Seguin's avatar
Vincent Seguin committed
33
PROGRAM_OPTIONS += DEBUG
34
DEFINE += -DDEBUG
Vincent Seguin's avatar
Vincent Seguin committed
35
36
37
endif

# PROGRAM_BUILD is a complete identification of the build
38
39
# ( we can't use fancy options with date since OSes like Solaris
# or FreeBSD have strange date implementations )
40
41
42
PROGRAM_BUILD = `date` $(USER)
# XXX: beos does not support hostname
#PROGRAM_BUILD = `date` $(USER)@`hostname`
Vincent Seguin's avatar
Vincent Seguin committed
43
44

# DEFINE will contain some of the constants definitions decided in Makefile, 
45
# including SYS_xx. It will be passed to C compiler.
46
DEFINE += -DSYS_$(shell echo $(SYS) | sed 's/-.*//' | tr a-z A-Z)
47
48
DEFINE += -DPLUGIN_PATH="\"$(prefix)/lib/videolan/vlc\""
DEFINE += -DDATA_PATH="\"$(prefix)/share/videolan/vlc\""
Vincent Seguin's avatar
Vincent Seguin committed
49

Michel Kaempf's avatar
Michel Kaempf committed
50
################################################################################
51
# Tuning and other variables - do not change anything except if you know
Vincent Seguin's avatar
Vincent Seguin committed
52
# exactly what you are doing
Michel Kaempf's avatar
Michel Kaempf committed
53
54
55
56
57
################################################################################

#
# C headers directories
#
58
INCLUDE += -Iinclude -I/usr/local/include -I/usr/X11R6/include
Vincent Seguin's avatar
Vincent Seguin committed
59

Michel Kaempf's avatar
Michel Kaempf committed
60
61
62
#
# Libraries
#
63

64
ifeq ($(SYS),gnu)
65
66
67
LIB += -lthreads -ldl
endif

68
ifneq (,$(findstring bsd,$(SYS)))
69
70
LIB += -pthread -lgnugetopt
LIB += -L/usr/local/lib
71
endif
72

73
ifneq (,$(findstring linux,$(SYS)))
74
75
76
LIB += -lpthread -ldl
endif

77
ifeq ($(SYS),beos)
78
79
LIB += -lbe -lroot -lgame
else
80
LIB += -lm
81
endif
82

Michel Kaempf's avatar
Michel Kaempf committed
83
84
85
#
# C compiler flags: compilation
#
Vincent Seguin's avatar
Vincent Seguin committed
86
CCFLAGS += $(DEFINE) $(INCLUDE)
Michel Kaempf's avatar
Michel Kaempf committed
87
88
89
90
CCFLAGS += -Wall
CCFLAGS += -D_REENTRANT
CCFLAGS += -D_GNU_SOURCE

91
92
93
# flags needed for clean beos compilation
CCFLAGS += -Wno-multichar -Wno-ctor-dtor-privacy -Woverloaded-virtual

Michel Kaempf's avatar
Michel Kaempf committed
94
# Optimizations : don't compile debug versions with them
95
ifeq ($(DEBUG),0)
96
97
CCFLAGS += -O6
CCFLAGS += -ffast-math -funroll-loops -fargument-noalias-global
Michel Lespinasse's avatar
   
Michel Lespinasse committed
98
CCFLAGS += -fomit-frame-pointer
99

100
# Optimizations for x86 familiy
101
ifneq (,$(findstring 86,$(ARCH)))
102
CCFLAGS += -malign-double
103
#CCFLAGS += -march=pentium
104
# Eventual Pentium Pro optimizations
105
ifneq (,$(findstring pentiumpro,$(ARCH)))
106
ifneq ($(SYS), BSD)
107
108
CCFLAGS += -march=pentiumpro
endif
109
endif
110
# Eventual MMX optimizations for x86
111
ifneq (,$(findstring mmx,$(ARCH)))
112
113
CFLAGS += -DHAVE_MMX
endif
Vincent Seguin's avatar
Vincent Seguin committed
114
endif
115

Vincent Seguin's avatar
Vincent Seguin committed
116
# Optimizations for PowerPC
117
ifneq (,$(findstring ppc,$(ARCH)))
Vincent Seguin's avatar
Vincent Seguin committed
118
119
CCFLAGS += -mcpu=604e -mmultiple -mhard-float -mstring
endif
Michel Kaempf's avatar
Michel Kaempf committed
120

121
# Optimizations for Sparc
122
ifneq (,$(findstring sparc,$(ARCH)))
123
124
125
CCFLAGS += -mhard-float
endif

126
127
128
# End of optimizations
endif

Michel Kaempf's avatar
Michel Kaempf committed
129
130
131
132
133
134
135
136
137
138
139
#
# C compiler flags: dependancies
#
DCFLAGS += $(INCLUDE)
DCFLAGS += -MM

#
# C compiler flags: linking
#
LCFLAGS += $(LIB)
LCFLAGS += -Wall
Vincent Seguin's avatar
Vincent Seguin committed
140
#LCFLAGS += -s
Michel Kaempf's avatar
Michel Kaempf committed
141
142
143
144

#
# Additionnal debugging flags
#
Vincent Seguin's avatar
Vincent Seguin committed
145

146
147
# Debugging and profiling support
ifneq ($(DEBUG),0)
148
CFLAGS += -pg
Vincent Seguin's avatar
Vincent Seguin committed
149
endif
Michel Kaempf's avatar
Michel Kaempf committed
150
151
152
153
154
155

#################################################################################
# Objects and files
#################################################################################

#
Vincent Seguin's avatar
Vincent Seguin committed
156
# C Objects
Michel Kaempf's avatar
Michel Kaempf committed
157
158
159
160
161
162
# 
interface_obj =  		interface/main.o \
						interface/interface.o \
						interface/intf_msg.o \
						interface/intf_cmd.o \
						interface/intf_ctrl.o \
163
						interface/intf_console.o
Michel Kaempf's avatar
Michel Kaempf committed
164
165
166
167
168
169
170
171
172
173

input_obj =         		input/input_vlan.o \
						input/input_file.o \
						input/input_netlist.o \
						input/input_network.o \
						input/input_ctrl.o \
						input/input_pcr.o \
						input/input_psi.o \
						input/input.o

174
audio_output_obj = 		audio_output/audio_output.o
Michel Kaempf's avatar
Michel Kaempf committed
175

Vincent Seguin's avatar
Vincent Seguin committed
176
video_output_obj = 		video_output/video_output.o \
Vincent Seguin's avatar
Vincent Seguin committed
177
						video_output/video_text.o \
Sam Hocevar's avatar
NEWS:    
Sam Hocevar committed
178
						video_output/video_spu.o \
179
						video_output/video_yuv.o
Michel Kaempf's avatar
Michel Kaempf committed
180

Michel Lespinasse's avatar
   
Michel Lespinasse committed
181
182
ac3_decoder_obj =		ac3_decoder/ac3_decoder_thread.o \
						ac3_decoder/ac3_decoder.o \
183
184
185
186
187
188
189
						ac3_decoder/ac3_parse.o \
						ac3_decoder/ac3_exponent.o \
						ac3_decoder/ac3_bit_allocate.o \
						ac3_decoder/ac3_mantissa.o \
						ac3_decoder/ac3_rematrix.o \
						ac3_decoder/ac3_imdct.o \
						ac3_decoder/ac3_downmix.o
190
191
192
						
lpcm_decoder_obj =		lpcm_decoder/lpcm_decoder_thread.o \
						lpcm_decoder/lpcm_decoder.o
Michel Kaempf's avatar
Michel Kaempf committed
193

Michel Lespinasse's avatar
   
Michel Lespinasse committed
194
195
audio_decoder_obj =		audio_decoder/audio_decoder_thread.o \
						audio_decoder/audio_decoder.o \
196
						audio_decoder/audio_math.o
Michel Kaempf's avatar
Michel Kaempf committed
197

198
spu_decoder_obj =		spu_decoder/spu_decoder.o
199

Vincent Seguin's avatar
Vincent Seguin committed
200
201
#??generic_decoder_obj =		generic_decoder/generic_decoder.o
# remeber to add it to OBJ 
202

Jean-Marc Dressler's avatar
   
Jean-Marc Dressler committed
203
204
205
206
207
208
209
210
video_parser_obj = 		video_parser/video_parser.o \
						video_parser/vpar_headers.o \
						video_parser/vpar_blocks.o \
						video_parser/vpar_synchro.o \
						video_parser/video_fifo.o

video_decoder_obj =		video_decoder/video_decoder.o \
						video_decoder/vdec_motion.o \
Michel Lespinasse's avatar
   
Michel Lespinasse committed
211
						video_decoder/vdec_motion_inner.o \
Vincent Seguin's avatar
Vincent Seguin committed
212
			                        video_decoder/vdec_idct.o
213

Michel Kaempf's avatar
Michel Kaempf committed
214
215
misc_obj =			misc/mtime.o \
						misc/rsc_files.o \
216
						misc/netutils.o \
217
						misc/plugins.o \
218
						misc/decoder_fifo.o
Michel Kaempf's avatar
Michel Kaempf committed
219

220

Jean-Marc Dressler's avatar
   
Jean-Marc Dressler committed
221
C_OBJ = $(interface_obj) \
Michel Kaempf's avatar
Michel Kaempf committed
222
223
224
		$(input_obj) \
		$(audio_output_obj) \
		$(video_output_obj) \
Michel Kaempf's avatar
Michel Kaempf committed
225
		$(ac3_decoder_obj) \
226
		$(lpcm_decoder_obj) \
Michel Kaempf's avatar
Michel Kaempf committed
227
		$(audio_decoder_obj) \
228
		$(spu_decoder_obj) \
Michel Kaempf's avatar
Michel Kaempf committed
229
		$(generic_decoder_obj) \
230
		$(video_parser_obj) \
Michel Kaempf's avatar
Michel Kaempf committed
231
232
		$(video_decoder_obj) \
		$(vlan_obj) \
Vincent Seguin's avatar
Vincent Seguin committed
233
		$(misc_obj)
Michel Kaempf's avatar
Michel Kaempf committed
234

235
ifeq ($(SYS),beos)
236
237
238
CPP_OBJ =			misc/beos_specific.o
endif

Vincent Seguin's avatar
Vincent Seguin committed
239
240
241
#
# Assembler Objects
# 
242
243
ifneq (,$(findstring 86,$(ARCH)))
ifneq (,$(findstring mmx,$(ARCH)))
244
ASM_OBJ = 			video_decoder/vdec_idctmmx.o \
Vincent Seguin's avatar
Vincent Seguin committed
245
246
						video_output/video_yuv_mmx.o
endif
247
endif
Vincent Seguin's avatar
Vincent Seguin committed
248

249
250
251
#
# Plugins
#
252
253
254
intf_plugin =           $(INTF:%=plugins/intf/intf_%.so)
aout_plugin =           $(AOUT:%=plugins/aout/aout_%.so)
vout_plugin =           $(VOUT:%=plugins/vout/vout_%.so)
255

256
PLUGIN_OBJ = $(intf_plugin) $(aout_plugin) $(vout_plugin)
257

Michel Kaempf's avatar
Michel Kaempf committed
258
259
260
#
# Other lists of files
#
261
C_OBJ := $(C_OBJ:%.o=src/%.o)
262
CPP_OBJ := $(CPP_OBJ:%.o=src/%.o)
263
ASM_OBJ := $(ASM_OBJ:%.o=src/%.o)
264
265
sources_c := $(C_OBJ:%.o=%.c)
dependancies := $(sources_c:%.c=.dep/%.d)
Michel Kaempf's avatar
Michel Kaempf committed
266
267
268
269
270
271
272
273
274
275
276

# All symbols must be exported
export

################################################################################
# Targets
################################################################################

#
# Virtual targets
#
277
all: vlc plugins
Michel Kaempf's avatar
Michel Kaempf committed
278
279

clean:
280
	rm -f $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ) $(PLUGIN_OBJ)
Michel Kaempf's avatar
Michel Kaempf committed
281
282

distclean: clean
283
	rm -f */*/*.o plugins/*/*.so **/*~ *.log
284
285
	rm -f Makefile include/defs.h include/config.h
	rm -f config.status config.cache config.log
Sam Hocevar's avatar
Sam Hocevar committed
286
	rm -f vlc gmon.out core
287
288
289
	rm -rf .dep

install:
290
291
	$(INSTALL) vlc $(prefix)/bin
	mkdir -p $(prefix)/lib/videolan/vlc
Sam Hocevar's avatar
Sam Hocevar committed
292
	mkdir -p $(prefix)/share/videolan/vlc
293
294
295
	$(INSTALL) $(PLUGIN_OBJ) $(prefix)/lib/videolan/vlc
	$(INSTALL) share/*.psf $(prefix)/share/videolan/vlc
	$(INSTALL) share/*.png $(prefix)/share/videolan/vlc
Michel Kaempf's avatar
Michel Kaempf committed
296

Vincent Seguin's avatar
Vincent Seguin committed
297
298
299
300
301
302
303
show:
	@echo "Command line for C objects:"
	@echo $(CC) $(CCFLAGS) $(CFLAGS) -c -o "<dest.o>" "<src.c>"
	@echo
	@echo "Command line for assembler objects:"
	@echo $(CC) $(CFLAGS) -c -o "<dest.o>" "<src.S>"

Sam Hocevar's avatar
Sam Hocevar committed
304
305
306
307
# ugliest of all, but I have no time to do it -- sam
snapshot:
	rm -rf /tmp/${SNAPSHOTDIR}
	mkdir /tmp/${SNAPSHOTDIR}
308
	cp -r * /tmp/${SNAPSHOTDIR}
Sam Hocevar's avatar
Sam Hocevar committed
309
310
311
312
313
314
315
316
317
318
		(cd /tmp/${SNAPSHOTDIR} ; \
		make distclean ; \
		find . -type d -name CVS | xargs rm -rf ; \
		find . -type f -name '.*.swp' | xargs rm -f ; \
		cd .. ; \
		tar czvf ${SNAPSHOTDIR}.tar.gz ${SNAPSHOTDIR} )
	rm -rf /tmp/${SNAPSHOTDIR}
	mv /tmp/${SNAPSHOTDIR}.tar.gz ..
	@echo "Sources are in ../${SNAPSHOTDIR}.tar.gz"

Michel Kaempf's avatar
Michel Kaempf committed
319
320
321
322
323
FORCE:

#
# Real targets
#
324
vlc: $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ)
325
ifeq ($(SYS),beos)
326
327
328
329
330
331
332
	$(CC) $(CCFLAGS) $(LCFLAGS) $(CFLAGS) -Xlinker -soname=_APP_ -o $@ $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ)
#	ln -s ../vlc ./plugins/_APP_
else
	$(CC) $(CCFLAGS) $(LCFLAGS) $(CFLAGS) --export-dynamic -rdynamic -o $@ $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ)	
endif

plugins: $(PLUGIN_OBJ)
Michel Kaempf's avatar
Michel Kaempf committed
333
334
335
336
337

#
# Generic rules (see below)
#
$(dependancies): %.d: FORCE
338
	@$(MAKE) -s --no-print-directory -f Makefile.dep $@
Michel Kaempf's avatar
Michel Kaempf committed
339

340
$(C_OBJ): %.o: Makefile.dep
341
$(C_OBJ): %.o: .dep/%.d
Jean-Marc Dressler's avatar
   
Jean-Marc Dressler committed
342
$(C_OBJ): %.o: %.c
343
	$(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
Vincent Seguin's avatar
Vincent Seguin committed
344

345
$(CPP_OBJ): %.o: %.cpp
346
	$(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
347

348
$(ASM_OBJ): %.o: Makefile.dep
Jean-Marc Dressler's avatar
   
Jean-Marc Dressler committed
349
$(ASM_OBJ): %.o: %.S
350
	$(CC) $(CFLAGS) -c -o $@ $<
Michel Kaempf's avatar
Michel Kaempf committed
351

352
353
#$(PLUGIN_OBJ): %.so: Makefile.dep
#$(PLUGIN_OBJ): %.so: .dep/%.d
354
355

# audio plugins
356
plugins/aout/aout_dummy.so plugins/aout/aout_dsp.so: %.so: %.c
357
ifeq ($(SYS),beos)
358
	$(CC) $(CCFLAGS) $(CFLAGS) -nostart -Xlinker -soname=$@ -o $@ $< plugins/_APP_
359
else
360
	$(CC) $(CCFLAGS) $(CFLAGS) -shared -o $@ $<
361
endif
362

363
plugins/aout/aout_esd.so: %.so: %.c
364
ifneq (,$(findstring bsd,$(SYS)))
365
	$(CC) $(CCFLAGS) $(CFLAGS) -lesd -shared -o $@ $<
366
else
367
	$(CC) $(CCFLAGS) $(CFLAGS) -laudiofile -lesd -shared -o $@ $<
368
endif
369
370

# video plugins
371
372
plugins/intf/intf_dummy.so plugins/vout/vout_dummy.so \
	plugins/intf/intf_fb.so plugins/vout/vout_fb.so: %.so: %.c
373
ifeq ($(SYS),beos)
374
	$(CC) $(CCFLAGS) $(CFLAGS) -nostart -Xlinker -soname=$@ -o $@ $< plugins/_APP_
375
else
376
	$(CC) $(CCFLAGS) $(CFLAGS) -shared -o $@ $<
377
endif
378

379
plugins/intf/intf_x11.so plugins/vout/vout_x11.so: %.so: %.c
380
	$(CC) $(CCFLAGS) $(CFLAGS) -I/usr/X11R6/include -L/usr/X11R6/lib -lX11 -lXext -shared -o $@ $<
381

382
plugins/intf/intf_mga.so plugins/vout/vout_mga.so: %.so: %.c
383
	$(CC) $(CCFLAGS) $(CFLAGS) -I/usr/X11R6/include -L/usr/X11R6/lib -lX11 -lXext -shared -o $@ $<
384

385
plugins/intf/intf_gnome.so: %.so: %.c
386
	$(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
387
388

plugins/vout/vout_gnome.so: %.so: %.c
389
	$(CC) $(CCFLAGS) $(CFLAGS) -I/usr/X11R6/include -L/usr/X11R6/lib -lX11 -lXext -shared -o $@ $<
390

391
plugins/intf/intf_glide.so plugins/vout/vout_glide.so: %.so: %.c
392
	$(CC) $(CCFLAGS) $(CFLAGS) -I/usr/include/glide -lglide2x -shared -o $@ $<
393

394
plugins/intf/intf_ggi.so plugins/vout/vout_ggi.so: %.so: %.c
395
	$(CC) $(CCFLAGS) $(CFLAGS) -lggi -shared -o $@ $<
396

397
plugins/intf/intf_beos.so: %.so: %.cpp
398
	$(CC) $(LCFLAGS) $(CCFLAGS) $(CFLAGS) -nostart -Xlinker -soname=$@ -o $@ $< plugins/_APP_
399
400

plugins/vout/vout_beos.so: %.so: %.cpp
401
	$(CC) $(LCFLAGS) $(CCFLAGS) $(CFLAGS) -nostart -Xlinker -soname=$@ -o $@ $< plugins/_APP_
402
		
403

Michel Kaempf's avatar
Michel Kaempf committed
404
405
406
407
408
################################################################################
# Note on generic rules and dependancies
################################################################################

# Note on dependancies: each .c file is associated with a .d file, which
409
410
# depends of it. The .o file associated with a .c file depends of the .d, of the
# .c itself, and of Makefile. The .d files are stored in a separate .dep/
Michel Kaempf's avatar
Michel Kaempf committed
411
412
413
# directory.
# The dep directory should be ignored by CVS.

414
# Note on inclusions: depending of the target, the dependancies files must
Michel Kaempf's avatar
Michel Kaempf committed
415
# or must not be included. The problem is that if we ask make to include a file,
416
417
# and this file does not exist, it is made before it can be included. In a
# general way, a .d file should be included if and only if the corresponding .o
Michel Kaempf's avatar
Michel Kaempf committed
418
419
420
421
422
# needs to be re-made.

# Two makefiles are used: the main one (this one) has regular generic rules,
# except for .o files, for which it calls the object Makefile. Dependancies
# are not included in this file.
Michel Kaempf's avatar
Michel Kaempf committed
423
424
# The object Makefile known how to make a .o from a .c, and includes
# dependancies for the target, but only those required.